From 417f9e0116d0ba4dc8e57e9f9f8f4df3d3e7190a Mon Sep 17 00:00:00 2001 From: nobody Date: Fri, 25 Feb 2000 23:33:55 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'GNOME_CORE_1_1_6'. svn path=/tags/GNOME_CORE_1_1_6/; revision=1947 --- .cvsignore | 21 - AUTHORS | 32 - COPYING | 340 - ChangeLog | 3236 ---- INSTALL | 182 - MAINTAINERS | 1 - Makefile.am | 35 - NEWS | 8 - README | 6 - acconfig.h | 16 - addressbook/.cvsignore | 6 - addressbook/Makefile.am | 2 - addressbook/backend/ebook/Makefile.am | 79 - addressbook/backend/ebook/TODO | 2 - addressbook/backend/ebook/e-book-listener.c | 511 - addressbook/backend/ebook/e-book-listener.h | 88 - addressbook/backend/ebook/e-book.c | 871 - addressbook/backend/ebook/e-book.h | 115 - addressbook/backend/ebook/e-card-cursor.h | 47 - addressbook/backend/ebook/e-card-pairs.h | 139 - addressbook/backend/ebook/e-card-types.h | 246 - addressbook/backend/ebook/e-card.c | 1856 -- addressbook/backend/ebook/e-card.h | 79 - addressbook/backend/idl/Makefile.am | 6 - addressbook/backend/idl/addressbook.idl | 83 - addressbook/backend/pas/Makefile.am | 72 - addressbook/backend/pas/TODO | 2 - addressbook/backend/pas/pas-backend-file.c | 272 - addressbook/backend/pas/pas-backend-file.h | 32 - addressbook/backend/pas/pas-backend.c | 98 - addressbook/backend/pas/pas-backend.h | 66 - addressbook/backend/pas/pas-book-factory.c | 474 - addressbook/backend/pas/pas-book-factory.h | 44 - addressbook/backend/pas/pas-book.c | 573 - addressbook/backend/pas/pas-book.h | 84 - addressbook/backend/pas/pas.c | 54 - addressbook/backend/pas/wombat.gnorba | 5 - addressbook/contact-editor/.cvsignore | 7 - addressbook/contact-editor/Makefile.am | 35 - addressbook/contact-editor/arrow.png | Bin 122 -> 0 bytes addressbook/contact-editor/briefcase.png | Bin 390 -> 0 bytes addressbook/contact-editor/contact-editor.glade | 2205 --- .../contact-editor/e-contact-editor-strings.h | 48 - addressbook/contact-editor/e-contact-editor.c | 567 - addressbook/contact-editor/e-contact-editor.h | 84 - addressbook/contact-editor/email.png | Bin 331 -> 0 bytes addressbook/contact-editor/head.png | Bin 493 -> 0 bytes addressbook/contact-editor/netfreebusy.png | Bin 755 -> 0 bytes addressbook/contact-editor/netmeeting.png | Bin 803 -> 0 bytes addressbook/contact-editor/phone.png | Bin 506 -> 0 bytes addressbook/contact-editor/snailmail.png | Bin 516 -> 0 bytes addressbook/contact-editor/test-editor.c | 99 - addressbook/contact-editor/web.png | Bin 573 -> 0 bytes addressbook/gui/contact-editor/.cvsignore | 7 - addressbook/gui/contact-editor/Makefile.am | 35 - addressbook/gui/contact-editor/arrow.png | Bin 122 -> 0 bytes addressbook/gui/contact-editor/briefcase.png | Bin 390 -> 0 bytes .../gui/contact-editor/contact-editor.glade | 2205 --- .../gui/contact-editor/e-contact-editor-strings.h | 48 - addressbook/gui/contact-editor/e-contact-editor.c | 567 - addressbook/gui/contact-editor/e-contact-editor.h | 84 - addressbook/gui/contact-editor/email.png | Bin 331 -> 0 bytes addressbook/gui/contact-editor/head.png | Bin 493 -> 0 bytes addressbook/gui/contact-editor/netfreebusy.png | Bin 755 -> 0 bytes addressbook/gui/contact-editor/netmeeting.png | Bin 803 -> 0 bytes addressbook/gui/contact-editor/phone.png | Bin 506 -> 0 bytes addressbook/gui/contact-editor/snailmail.png | Bin 516 -> 0 bytes addressbook/gui/contact-editor/test-editor.c | 99 - addressbook/gui/contact-editor/web.png | Bin 573 -> 0 bytes addressbook/gui/minicard/.cvsignore | 9 - addressbook/gui/minicard/Makefile.am | 47 - addressbook/gui/minicard/e-minicard-label.c | 462 - addressbook/gui/minicard/e-minicard-label.h | 84 - addressbook/gui/minicard/e-minicard.c | 471 - addressbook/gui/minicard/e-minicard.h | 91 - addressbook/gui/minicard/e-reflow.c | 787 - addressbook/gui/minicard/e-reflow.h | 104 - addressbook/gui/minicard/test-minicard-label.c | 127 - addressbook/gui/minicard/test-minicard.c | 117 - addressbook/gui/minicard/test-reflow.c | 163 - addressbook/gui/widgets/Makefile.am | 47 - addressbook/gui/widgets/e-minicard-label.c | 462 - addressbook/gui/widgets/e-minicard-label.h | 84 - addressbook/gui/widgets/e-minicard.c | 471 - addressbook/gui/widgets/e-minicard.h | 91 - addressbook/gui/widgets/test-minicard-label.c | 127 - addressbook/gui/widgets/test-minicard.c | 117 - addressbook/gui/widgets/test-reflow.c | 163 - addressbook/printing/.cvsignore | 8 - addressbook/printing/Makefile.am | 44 - .../printing/e-contact-print-style-editor.c | 150 - .../printing/e-contact-print-style-editor.h | 74 - addressbook/printing/e-contact-print-types.h | 74 - addressbook/printing/e-contact-print.c | 953 - addressbook/printing/e-contact-print.glade | 1993 --- addressbook/printing/e-contact-print.h | 31 - addressbook/printing/medbook.ecps | 30 - addressbook/printing/phonelist.ecps | 29 - addressbook/printing/smallbook.ecps | 30 - .../printing/test-contact-print-style-editor.c | 85 - addressbook/printing/test-print.c | 80 - autogen.sh | 10 - calendar/.cvsignore | 20 - calendar/AUTHORS | 4 - calendar/ChangeLog | 2916 --- calendar/GnomeCal.idl | 104 - calendar/Makefile.am | 303 - calendar/TODO | 68 - calendar/alarm.c | 250 - calendar/alarm.h | 13 - calendar/bell.xpm | 83 - calendar/cal-backend.c | 1083 -- calendar/cal-backend.h | 92 - calendar/cal-client.c | 783 - calendar/cal-client.h | 90 - calendar/cal-client/cal-client.c | 783 - calendar/cal-client/cal-client.h | 90 - calendar/cal-client/cal-listener.c | 421 - calendar/cal-client/cal-listener.h | 86 - calendar/cal-client/cal-util.c | 74 - calendar/cal-client/cal-util.h | 61 - calendar/cal-client/client-test.c | 160 - calendar/cal-common.h | 41 - calendar/cal-factory.c | 681 - calendar/cal-factory.h | 70 - calendar/cal-listener.c | 421 - calendar/cal-listener.h | 86 - calendar/cal-util.c | 74 - calendar/cal-util.h | 61 - calendar/cal-util/calobj.c | 1608 -- calendar/cal-util/calobj.h | 263 - calendar/cal.c | 559 - calendar/cal.h | 70 - calendar/cal_struct.h | 27 - calendar/calendar-conduit-control-applet.c | 360 - calendar/calendar-conduit-control-applet.desktop | 7 - calendar/calendar-conduit.c | 1416 -- calendar/calendar-conduit.h | 138 - calendar/calendar-pilot-sync.c | 658 - calendar/calendar.c | 663 - calendar/calendar.h | 92 - calendar/calobj.c | 1608 -- calendar/calobj.h | 263 - .../calendar/calendar-conduit-control-applet.c | 360 - .../calendar-conduit-control-applet.desktop | 7 - calendar/conduits/calendar/calendar-conduit.c | 1416 -- calendar/conduits/calendar/calendar-conduit.h | 138 - .../conduits/todo/todo-conduit-control-applet.c | 287 - .../todo/todo-conduit-control-applet.desktop | 6 - calendar/conduits/todo/todo-conduit.c | 256 - calendar/conduits/todo/todo-conduit.h | 59 - calendar/corba-cal-factory.c | 130 - calendar/corba-cal-factory.h | 11 - calendar/corba-cal.c | 343 - calendar/corba-cal.h | 6 - calendar/doc/.cvsignore | 2 - calendar/doc/C/.cvsignore | 5 - calendar/doc/C/Makefile.am | 44 - calendar/doc/C/gnomecal.sgml | 465 - calendar/doc/C/images/cal-props.gif | Bin 8929 -> 0 bytes calendar/doc/C/images/calday.gif | Bin 16264 -> 0 bytes calendar/doc/C/images/calmonth.gif | Bin 13299 -> 0 bytes calendar/doc/C/images/calweek.gif | Bin 14650 -> 0 bytes calendar/doc/C/images/calyear.gif | Bin 27058 -> 0 bytes calendar/doc/C/topic.dat | 2 - calendar/doc/Makefile.am | 1 - calendar/eventedit.c | 1584 -- calendar/eventedit.h | 83 - calendar/evolution-calendar.idl | 127 - calendar/getdate.y | 1001 -- calendar/gncal-day-panel.c | 277 - calendar/gncal-day-panel.h | 65 - calendar/gncal-day-view.c | 411 - calendar/gncal-day-view.h | 56 - calendar/gncal-full-day.c | 2287 --- calendar/gncal-full-day.h | 74 - calendar/gncal-todo.c | 877 - calendar/gncal-todo.h | 55 - calendar/gncal-week-view.c | 255 - calendar/gncal-week-view.h | 57 - calendar/gncal.desktop | 37 - calendar/gnome-cal.c | 616 - calendar/gnome-cal.h | 82 - calendar/gnome-cal.html | 44 - calendar/gnome-calendar-conduit.png | Bin 3000 -> 0 bytes calendar/gnome-month-item.c | 1246 -- calendar/gnome-month-item.h | 165 - calendar/gnomecal.gnorba | 11 - calendar/goto.c | 323 - calendar/gui/GnomeCal.idl | 104 - calendar/gui/Makefile.am | 303 - calendar/gui/alarm-notify/alarm.c | 250 - calendar/gui/alarm-notify/alarm.h | 13 - calendar/gui/alarm.c | 250 - calendar/gui/alarm.h | 13 - calendar/gui/bell.xpm | 83 - calendar/gui/cal_struct.h | 27 - calendar/gui/calendar-conduit-control-applet.c | 360 - .../gui/calendar-conduit-control-applet.desktop | 7 - calendar/gui/calendar-conduit.c | 1416 -- calendar/gui/calendar-conduit.h | 138 - calendar/gui/calendar-pilot-sync.c | 658 - calendar/gui/calendar.c | 663 - calendar/gui/calendar.h | 92 - calendar/gui/corba-cal-factory.c | 130 - calendar/gui/corba-cal-factory.h | 11 - calendar/gui/corba-cal.c | 343 - calendar/gui/corba-cal.h | 6 - calendar/gui/eventedit.c | 1584 -- calendar/gui/eventedit.h | 83 - calendar/gui/getdate.y | 1001 -- calendar/gui/gncal-day-panel.c | 277 - calendar/gui/gncal-day-panel.h | 65 - calendar/gui/gncal-day-view.c | 411 - calendar/gui/gncal-day-view.h | 56 - calendar/gui/gncal-full-day.c | 2287 --- calendar/gui/gncal-full-day.h | 74 - calendar/gui/gncal-todo.c | 877 - calendar/gui/gncal-todo.h | 55 - calendar/gui/gncal-week-view.c | 255 - calendar/gui/gncal-week-view.h | 57 - calendar/gui/gncal.desktop | 37 - calendar/gui/gnome-cal.c | 616 - calendar/gui/gnome-cal.h | 82 - calendar/gui/gnome-cal.html | 44 - calendar/gui/gnome-calendar-conduit.png | Bin 3000 -> 0 bytes calendar/gui/gnome-month-item.c | 1246 -- calendar/gui/gnome-month-item.h | 165 - calendar/gui/gnomecal.gnorba | 11 - calendar/gui/goto.c | 323 - calendar/gui/icalendar-types | 39 - calendar/gui/layout.c | 288 - calendar/gui/layout.h | 37 - calendar/gui/main.c | 1044 -- calendar/gui/main.h | 101 - calendar/gui/mark.c | 269 - calendar/gui/mark.h | 58 - calendar/gui/month-view.c | 798 - calendar/gui/month-view.h | 72 - calendar/gui/popup-menu.c | 37 - calendar/gui/popup-menu.h | 25 - calendar/gui/prop.c | 927 - calendar/gui/quick-view.c | 274 - calendar/gui/quick-view.h | 59 - calendar/gui/recur.xpm | 83 - calendar/gui/test.vcf | 133 - calendar/gui/test2.vcf | 133 - calendar/gui/todo-conduit-control-applet.c | 287 - calendar/gui/todo-conduit-control-applet.desktop | 6 - calendar/gui/todo-conduit.c | 256 - calendar/gui/todo-conduit.h | 59 - calendar/gui/topic.dat | 2 - calendar/gui/view-utils.c | 201 - calendar/gui/view-utils.h | 28 - calendar/gui/week-view.c | 100 - calendar/gui/week-view.h | 63 - calendar/gui/year-view.c | 741 - calendar/gui/year-view.h | 77 - calendar/icalendar-types | 39 - calendar/icalendar.c | 658 - calendar/icalendar.h | 6 - calendar/idl/evolution-calendar.idl | 127 - calendar/job.c | 98 - calendar/job.h | 35 - calendar/layout.c | 288 - calendar/layout.h | 37 - calendar/main.c | 1044 -- calendar/main.h | 101 - calendar/mark.c | 269 - calendar/mark.h | 58 - calendar/month-view.c | 798 - calendar/month-view.h | 72 - calendar/pcs/cal-backend.c | 1083 -- calendar/pcs/cal-backend.h | 92 - calendar/pcs/cal-common.h | 41 - calendar/pcs/cal-factory.c | 681 - calendar/pcs/cal-factory.h | 70 - calendar/pcs/cal.c | 559 - calendar/pcs/cal.h | 70 - calendar/pcs/calobj.c | 1608 -- calendar/pcs/calobj.h | 263 - calendar/pcs/job.c | 98 - calendar/pcs/job.h | 35 - calendar/pcs/tlacuache.c | 135 - calendar/pcs/tlacuache.gnorba | 5 - calendar/popup-menu.c | 37 - calendar/popup-menu.h | 25 - calendar/prop.c | 927 - calendar/quick-view.c | 274 - calendar/quick-view.h | 59 - calendar/recur.xpm | 83 - calendar/test.vcf | 133 - calendar/test2.vcf | 133 - calendar/timeutil.c | 501 - calendar/timeutil.h | 81 - calendar/tl-test.c | 160 - calendar/tlacuache.c | 135 - calendar/tlacuache.gnorba | 5 - calendar/todo-conduit-control-applet.c | 287 - calendar/todo-conduit-control-applet.desktop | 6 - calendar/todo-conduit.c | 256 - calendar/todo-conduit.h | 59 - calendar/topic.dat | 2 - calendar/view-utils.c | 201 - calendar/view-utils.h | 28 - calendar/week-view.c | 100 - calendar/week-view.h | 63 - calendar/year-view.c | 741 - calendar/year-view.h | 77 - camel/.cvsignore | 7 - camel/CODING.STYLE | 19 - camel/ChangeLog | 383 - camel/Makefile.am | 129 - camel/README | 57 - camel/README.COPYRIGHT | 47 - camel/README.HACKING | 14 - camel/camel-arg-collector.c | 186 - camel/camel-data-wrapper.c | 348 - camel/camel-data-wrapper.h | 124 - camel/camel-exception-list.def | 32 - camel/camel-exception.c | 277 - camel/camel-exception.h | 89 - camel/camel-folder-pt-proxy.c | 823 - camel/camel-folder-pt-proxy.h | 92 - camel/camel-folder-summary.c | 162 - camel/camel-folder-summary.h | 112 - camel/camel-folder-utils.c | 101 - camel/camel-folder-utils.h | 44 - camel/camel-folder.c | 1405 -- camel/camel-folder.h | 313 - camel/camel-formatter.c | 1039 -- camel/camel-formatter.h | 77 - camel/camel-log.c | 45 - camel/camel-log.h | 78 - camel/camel-marshal-utils.c | 374 - camel/camel-marshal-utils.h | 102 - camel/camel-medium.c | 262 - camel/camel-medium.h | 93 - camel/camel-mime-body-part.c | 128 - camel/camel-mime-body-part.h | 84 - camel/camel-mime-message.c | 718 - camel/camel-mime-message.h | 166 - camel/camel-mime-part-utils.c | 192 - camel/camel-mime-part-utils.h | 54 - camel/camel-mime-part.c | 979 - camel/camel-mime-part.h | 154 - camel/camel-multipart.c | 574 - camel/camel-multipart.h | 113 - camel/camel-op-queue.c | 187 - camel/camel-op-queue.h | 64 - camel/camel-provider.c | 187 - camel/camel-provider.h | 67 - camel/camel-recipient.c | 279 - camel/camel-recipient.h | 87 - camel/camel-seekable-stream.c | 149 - camel/camel-seekable-stream.h | 92 - camel/camel-seekable-substream.c | 486 - camel/camel-seekable-substream.h | 94 - camel/camel-service.c | 365 - camel/camel-service.h | 101 - camel/camel-session.c | 322 - camel/camel-session.h | 98 - camel/camel-simple-data-wrapper-stream.c | 299 - camel/camel-simple-data-wrapper-stream.h | 69 - camel/camel-simple-data-wrapper.c | 247 - camel/camel-simple-data-wrapper.h | 79 - camel/camel-store.c | 145 - camel/camel-store.h | 80 - camel/camel-stream-b64.c | 331 - camel/camel-stream-b64.h | 116 - camel/camel-stream-buffered-fs.c | 265 - camel/camel-stream-buffered-fs.h | 91 - camel/camel-stream-data-wrapper.c | 209 - camel/camel-stream-data-wrapper.h | 71 - camel/camel-stream-fs.c | 550 - camel/camel-stream-fs.h | 113 - camel/camel-stream-mem.c | 288 - camel/camel-stream-mem.h | 90 - camel/camel-stream.c | 244 - camel/camel-stream.h | 108 - camel/camel-thread-proxy.c | 565 - camel/camel-thread-proxy.h | 90 - camel/camel-transport.c | 111 - camel/camel-transport.h | 87 - camel/camel-types.h | 58 - camel/camel.c | 43 - camel/camel.h | 72 - camel/data-wrapper-repository.c | 135 - camel/data-wrapper-repository.h | 55 - camel/gmime-base64.c | 106 - camel/gmime-base64.h | 16 - camel/gmime-content-field.c | 382 - camel/gmime-content-field.h | 67 - camel/gmime-rfc2047.c | 491 - camel/gmime-rfc2047.h | 52 - camel/gmime-utils.c | 293 - camel/gmime-utils.h | 70 - camel/gstring-util.c | 345 - camel/gstring-util.h | 77 - camel/hash-table-utils.c | 80 - camel/hash-table-utils.h | 46 - camel/md5-utils.c | 391 - camel/md5-utils.h | 54 - camel/providers/.cvsignore | 2 - camel/providers/MH/.cvsignore | 6 - camel/providers/MH/Makefile.am | 33 - camel/providers/MH/camel-mh-folder.c | 1022 -- camel/providers/MH/camel-mh-folder.h | 72 - camel/providers/MH/camel-mh-provider.c | 46 - camel/providers/MH/camel-mh-store.c | 153 - camel/providers/MH/camel-mh-store.h | 72 - camel/providers/MH/mh-summary.c | 290 - camel/providers/MH/mh-summary.h | 33 - camel/providers/MH/mh-uid.c | 220 - camel/providers/MH/mh-uid.h | 40 - camel/providers/MH/mh-utils.c | 50 - camel/providers/MH/mh-utils.h | 30 - camel/providers/Makefile.am | 5 - camel/providers/maildir/.cvsignore | 6 - camel/providers/maildir/Makefile.am | 23 - camel/providers/maildir/camel-maildir-folder.c | 803 - camel/providers/maildir/camel-maildir-folder.h | 66 - camel/providers/maildir/camel-maildir-provider.c | 46 - camel/providers/maildir/camel-maildir-store.c | 124 - camel/providers/maildir/camel-maildir-store.h | 69 - camel/providers/mbox/.cvsignore | 7 - camel/providers/mbox/Makefile.am | 41 - camel/providers/mbox/camel-mbox-folder.c | 1135 -- camel/providers/mbox/camel-mbox-folder.h | 83 - camel/providers/mbox/camel-mbox-parser.c | 901 - camel/providers/mbox/camel-mbox-parser.h | 66 - camel/providers/mbox/camel-mbox-provider.c | 53 - camel/providers/mbox/camel-mbox-search.c | 335 - camel/providers/mbox/camel-mbox-search.h | 10 - camel/providers/mbox/camel-mbox-store.c | 123 - camel/providers/mbox/camel-mbox-store.h | 69 - camel/providers/mbox/camel-mbox-summary.c | 307 - camel/providers/mbox/camel-mbox-summary.h | 81 - camel/providers/mbox/camel-mbox-utils.c | 387 - camel/providers/mbox/camel-mbox-utils.h | 69 - camel/providers/sendmail/.cvsignore | 7 - camel/providers/sendmail/Makefile.am | 25 - camel/providers/sendmail/camel-sendmail-provider.c | 51 - .../providers/sendmail/camel-sendmail-transport.c | 203 - .../providers/sendmail/camel-sendmail-transport.h | 64 - camel/string-utils.c | 313 - camel/string-utils.h | 78 - camel/url-util.c | 172 - camel/url-util.h | 62 - composer/.cvsignore | 7 - composer/ChangeLog | 25 - composer/Makefile.am | 49 - composer/e-msg-composer-address-dialog.c | 660 - composer/e-msg-composer-address-dialog.glade | 575 - composer/e-msg-composer-address-dialog.h | 75 - composer/e-msg-composer-address-entry.c | 175 - composer/e-msg-composer-address-entry.h | 63 - composer/e-msg-composer-attachment-bar.c | 665 - composer/e-msg-composer-attachment-bar.h | 75 - composer/e-msg-composer-attachment.c | 480 - composer/e-msg-composer-attachment.glade | 290 - composer/e-msg-composer-attachment.h | 72 - composer/e-msg-composer-hdrs.c | 355 - composer/e-msg-composer-hdrs.h | 80 - composer/e-msg-composer.c | 564 - composer/e-msg-composer.glade | 587 - composer/e-msg-composer.h | 87 - composer/main.c | 52 - configure.in | 258 - data/.cvsignore | 2 - data/Makefile.am | 2 - data/evolution.desktop | 8 - devel-docs/.cvsignore | 3 - devel-docs/Makefile.am | 3 - devel-docs/camel/.cvsignore | 12 - devel-docs/camel/Makefile.am | 101 - devel-docs/camel/README_AND_TODO.txt | 43 - devel-docs/camel/camel-docs.sgml | 28 - devel-docs/camel/camel-sections.txt | 154 - devel-docs/camel/camel.types | 9 - devel-docs/camel/tmpl/.cvsignore | 2 - devel-docs/camel/tmpl/camel-data-wrapper.sgml | 26 - devel-docs/camel/tmpl/camel-folder.sgml | 96 - devel-docs/camel/tmpl/camel-mime-message.sgml | 171 - devel-docs/camel/tmpl/camel-mime-part.sgml | 151 - devel-docs/camel/tmpl/camel-recipient.sgml | 88 - devel-docs/camel/tmpl/camel-service.sgml | 72 - devel-docs/camel/tmpl/camel-store.sgml | 45 - devel-docs/camel/tmpl/camel-stream.sgml | 101 - devel-docs/misc/ref_and_id_proposition.txt | 237 - devel-docs/query/virtual-folder-in-depth.sgml | 407 - devel-docs/query/virtual-folder-in-depth.txt | 309 - doc/.cvsignore | 2 - doc/Camel-Classes | 24 - doc/Design | 201 - e-util/.cvsignore | 3 - e-util/Makefile.am | 20 - e-util/e-canvas-utils.c | 36 - e-util/e-canvas-utils.h | 29 - e-util/e-canvas.c | 301 - e-util/e-canvas.h | 71 - e-util/e-cursors.c | 128 - e-util/e-cursors.h | 33 - e-util/e-gui-utils.c | 64 - e-util/e-gui-utils.h | 12 - e-util/e-setup.c | 51 - e-util/e-setup.h | 11 - e-util/e-text-event-processor-emacs-like.c | 357 - e-util/e-text-event-processor-emacs-like.h | 68 - e-util/e-text-event-processor-types.h | 136 - e-util/e-text-event-processor.c | 103 - e-util/e-text-event-processor.h | 74 - e-util/e-util.c | 41 - e-util/e-util.c-8611 | 41 - e-util/e-util.h | 35 - e-util/e-util.h-29002 | 35 - e-util/e-xml-utils.c | 46 - e-util/e-xml-utils.c-56826 | 46 - e-util/e-xml-utils.h | 31 - e-util/e-xml-utils.h-82548 | 31 - ebook/e-book.c | 195 - ebook/e-book.h | 60 - ebook/e-card-fields.h | 53 - ebook/e-card.h | 61 - ebook/e-commerce.h | 15 - filter/.cvsignore | 5 - filter/ChangeLog | 51 - filter/Makefile | 29 - filter/blank.xpm | 22 - filter/check.xpm | 22 - filter/filter-arg-types.c | 743 - filter/filter-arg-types.h | 101 - filter/filter-arg.c | 494 - filter/filter-arg.h | 86 - filter/filter-driver.c | 472 - filter/filter-druid.c | 721 - filter/filter-druid.h | 76 - filter/filter-editor.c | 345 - filter/filter-editor.h | 53 - filter/filter-format.c | 237 - filter/filter-format.h | 10 - filter/filter-sexp.c | 1090 -- filter/filter-sexp.h | 117 - filter/filter-xml.c | 553 - filter/filter-xml.h | 69 - help/.cvsignore | 2 - help/Camel-Classes | 24 - help/Design | 201 - libibex/.cvsignore | 9 - libibex/COPYING.LIB | 481 - libibex/ChangeLog | 46 - libibex/Makefile.am | 20 - libibex/TODO | 61 - libibex/file.c | 412 - libibex/find.c | 162 - libibex/ibex.h | 94 - libibex/ibex_internal.h | 39 - libibex/index.c | 153 - libibex/lookup.c | 83 - libibex/mkindex.c | 84 - libibex/words.c | 268 - libical/.cvsignore | 5 - libical/CHANGES | 230 - libical/MacOS/errno.h | 185 - libical/MacOS/libical.mcp | Bin 139917 -> 0 bytes libical/MacOS/libical.mcp.exp | 1 - libical/MacOS/libical_prefix.h | 5 - libical/MacOS/restrictions.make | 1 - libical/MacOS/restrictions.script | 1 - libical/MacOS/strdup.c | 17 - libical/MacOS/strdup.h | 3 - libical/Makefile.am | 8 - libical/README | 78 - libical/TEST | 4 - libical/TODO | 32 - libical/configure.scan | 30 - libical/design-data/components.txt | 20 - libical/design-data/param-c-types.txt | 23 - libical/design-data/params-in-prop.txt | 55 - libical/design-data/prop-to-value.txt | 50 - libical/design-data/property-tokens.txt | 65 - libical/design-data/restrictions.csv | 1348 -- libical/design-data/status-new.txt | 56 - libical/design-data/status.foo | 104 - libical/design-data/status.txt | 32 - libical/design-data/value-c-types.txt | 21 - libical/design-data/value-mem-semantics.txt | 19 - libical/doc/UsingLibical.lyx | 719 - libical/doc/UsingLibical.sgml | 318 - libical/doc/UsingLibical.txt | 302 - libical/install-sh | 119 - libical/scripts/mkderivedcomponents.pl | 143 - libical/scripts/mkderivedparameters.pl | 272 - libical/scripts/mkderivedproperties.pl | 286 - libical/scripts/mkderivedvalues.pl | 303 - libical/scripts/mkparameterrestrictions.pl | 85 - libical/scripts/mkrestrictionrecords.pl | 109 - libical/scripts/mkrestrictiontable.pl | 86 - libical/src/.cvsignore | 2 - libical/src/Makefile.am | 1 - libical/src/libical/.cvsignore | 7 - libical/src/libical/.gdb_history | 457 - libical/src/libical/.gdbinit | 3 - libical/src/libical/Makefile.am | 40 - libical/src/libical/base64.c | 323 - libical/src/libical/filelock.c | 143 - libical/src/libical/filelock.h | 57 - libical/src/libical/foo | 1578 -- libical/src/libical/ical.h | 43 - libical/src/libical/icalcomponent.c | 700 - libical/src/libical/icalcomponent.h | 115 - libical/src/libical/icalenums.c | 547 - libical/src/libical/icalenums.h | 459 - libical/src/libical/icalerror.c | 85 - libical/src/libical/icalerror.h | 139 - libical/src/libical/icalirip.h | 108 - libical/src/libical/icalitip.l | 283 - libical/src/libical/icalitip.output | 1698 -- libical/src/libical/icalitip.tab.c | 1663 -- libical/src/libical/icalitip.tab.h | 137 - libical/src/libical/icalitip.y | 434 - libical/src/libical/icalmemory.c | 239 - libical/src/libical/icalmemory.h | 76 - libical/src/libical/icalparameter.c | 1887 -- libical/src/libical/icalparameter.h | 174 - libical/src/libical/icalparser.c | 901 - libical/src/libical/icalparser.h | 79 - libical/src/libical/icalproperty.c | 3084 ---- libical/src/libical/icalproperty.h | 368 - libical/src/libical/icalrestriction.c | 1582 -- libical/src/libical/icalrestriction.h | 72 - libical/src/libical/icaltypes.c | 200 - libical/src/libical/icaltypes.h | 168 - libical/src/libical/icalvalue.c | 2043 --- libical/src/libical/icalvalue.h | 164 - libical/src/libical/icalvcal.h | 39 - libical/src/libical/locking.c | 143 - libical/src/libical/pvl.c | 764 - libical/src/libical/pvl.h | 104 - libical/src/libical/testlocks.c | 70 - libical/src/libicalss/.cvsignore | 6 - libical/src/libicalss/Makefile.am | 12 - libical/src/libicalss/icalcalendar.c | 263 - libical/src/libicalss/icalcalendar.h | 68 - libical/src/libicalss/icalcluster.c | 398 - libical/src/libicalss/icalcluster.h | 75 - libical/src/libicalss/icalcomponent.h | 115 - libical/src/libicalss/icalstore.c | 817 - libical/src/libicalss/icalstore.h | 78 - libical/src/pvl/Makefile | 0 libical/src/test/.cvsignore | 6 - libical/src/test/Makefile.in | 36 - libical/src/test/alice/booked/199706 | 317 - libical/src/test/alice/booked/199707 | 701 - libical/src/test/alice/booked/199708 | 45 - libical/src/test/alice/booked/199709 | 58 - libical/src/test/alice/booked/199803 | 241 - libical/src/test/alice/incoming.ics | 2164 --- libical/src/test/copycluster.c | 113 - libical/src/test/findobj.c | 71 - libical/src/test/icaltestparser.c | 110 - libical/src/test/regression.c | 1340 -- libical/src/test/test-component.icd | 23 - libical/src/test/usecases.c | 561 - libical/test-data/0 | 9 - libical/test-data/1 | 36 - libical/test-data/1.1 | 13 - libical/test-data/2 | 22 - libical/test-data/2445.vcd | 329 - libical/test-data/2446.vcd | 1007 -- libical/test-data/3 | 21 - libical/test-data/4 | 23 - libical/test-data/5 | 16 - libical/test-data/6 | 12 - libical/test-data/7 | 14 - libical/test-data/smallcluster.vcd | 18 - libversit/.cvsignore | 9 - libversit/Makefile.am | 15 - libversit/README.TXT | 951 - libversit/port.h | 88 - libversit/vcaltest.c | 118 - libversit/vcaltmp.c | 337 - libversit/vcaltmp.h | 128 - libversit/vcc.h | 80 - libversit/vcc.y | 1218 -- libversit/vctest.c | 95 - libversit/vobject.c | 1452 -- libversit/vobject.h | 366 - mail/.cvsignore | 10 - mail/ChangeLog | 86 - mail/Mail.idl | 30 - mail/Makefile.am | 57 - mail/evolution-mail.gnorba | 13 - mail/folder-browser-factory.c | 68 - mail/folder-browser.c | 201 - mail/folder-browser.h | 45 - mail/html-stream.c | 115 - mail/html-stream.h | 26 - mail/mail-component.c | 48 - mail/mail-display.c | 69 - mail/mail-display.h | 29 - mail/main.c | 59 - mail/main.h | 6 - mail/message-list.c | 545 - mail/message-list.h | 65 - mail/session.c | 110 - mail/session.h | 17 - mail/test-mail.c | 62 - po/.cvsignore | 11 - po/ChangeLog | 7 - po/POTFILES.in | 0 shell/.cvsignore | 13 - shell/Evolution.idl | 28 - shell/Makefile.am | 46 - shell/Shell.idl | 19 - shell/e-folder-mail.c | 36 - shell/e-folder-mail.h | 28 - shell/e-folder.c | 246 - shell/e-folder.h | 82 - shell/e-init.c | 34 - shell/e-init.h | 8 - shell/e-shell-shortcut.c | 318 - shell/e-shell-shortcut.h | 11 - shell/e-shell-view-menu.c | 227 - shell/e-shell-view-menu.h | 6 - shell/e-shell-view.c | 148 - shell/e-shell-view.h | 50 - shell/e-shell.c | 348 - shell/e-shell.h | 60 - shell/e-shortcut.c | 451 - shell/e-shortcut.h | 102 - shell/evolution.h | 7 - shell/main.c | 96 - stamp.h.in | 1 - tests/.cvsignore | 19 - tests/Makefile.am | 50 - tests/test-formatter.c | 91 - tests/test1.c | 119 - tests/test10.c | 132 - tests/test11.c | 103 - tests/test2.c | 53 - tests/test3.c | 29 - tests/test4.c | 68 - tests/test5.c | 60 - tests/test6.c | 50 - tests/test7.c | 24 - tests/test8.c | 78 - tests/test9.c | 85 - tests/ui-tests/.cvsignore | 7 - tests/ui-tests/Makefile.am | 28 - tests/ui-tests/message-browser.c | 596 - tests/ui-tests/store_listing.c | 424 - tests/ui-tests/store_listing.glade | 489 - tests/ui-tests/test-multipart-alt.msg | 17738 ------------------- tests/ui-tests/test-multipart-mixed.msg | 377 - widgets/.cvsignore | 9 - widgets/LICENSE | 1 - widgets/Makefile.am | 3 - widgets/e-minicard/.cvsignore | 9 - widgets/e-minicard/Makefile.am | 47 - widgets/e-minicard/e-minicard-label.c | 462 - widgets/e-minicard/e-minicard-label.h | 84 - widgets/e-minicard/e-minicard.c | 471 - widgets/e-minicard/e-minicard.h | 91 - widgets/e-minicard/e-reflow.c | 787 - widgets/e-minicard/e-reflow.h | 104 - widgets/e-minicard/test-minicard-label.c | 127 - widgets/e-minicard/test-minicard.c | 117 - widgets/e-minicard/test-reflow.c | 163 - widgets/e-reflow/e-reflow.c | 787 - widgets/e-reflow/e-reflow.h | 104 - widgets/e-table/.cvsignore | 7 - widgets/e-table/ChangeLog | 830 - widgets/e-table/LICENSE | 1 - widgets/e-table/Makefile.am | 71 - widgets/e-table/ROADMAP.e-table | 113 - widgets/e-table/TODO | 24 - widgets/e-table/add-col.xpm | 22 - widgets/e-table/check-empty.xpm | 21 - widgets/e-table/check-filled.xpm | 21 - widgets/e-table/clip.png | Bin 192 -> 0 bytes widgets/e-table/e-cell-checkbox.c | 44 - widgets/e-table/e-cell-checkbox.h | 24 - widgets/e-table/e-cell-string.c | 9 - widgets/e-table/e-cell-text.c | 1887 -- widgets/e-table/e-cell-text.h | 63 - widgets/e-table/e-cell-toggle.c | 298 - widgets/e-table/e-cell-toggle.h | 35 - widgets/e-table/e-cell.c | 176 - widgets/e-table/e-cell.h | 77 - widgets/e-table/e-table-col-dnd.h | 10 - widgets/e-table/e-table-col.c | 118 - widgets/e-table/e-table-col.h | 64 - widgets/e-table/e-table-column-item.c | 199 - widgets/e-table/e-table-column-item.h | 20 - widgets/e-table/e-table-column-model.h | 5 - widgets/e-table/e-table-column.c | 293 - widgets/e-table/e-table-group-container.c | 853 - widgets/e-table/e-table-group-container.h | 67 - widgets/e-table/e-table-group-leaf.c | 296 - widgets/e-table/e-table-group-leaf.h | 41 - widgets/e-table/e-table-group.c | 369 - widgets/e-table/e-table-group.h | 93 - widgets/e-table/e-table-header-item.c | 920 - widgets/e-table/e-table-header-item.h | 56 - widgets/e-table/e-table-header.c | 345 - widgets/e-table/e-table-header.h | 65 - widgets/e-table/e-table-item.c | 1368 -- widgets/e-table/e-table-item.h | 108 - widgets/e-table/e-table-model.c | 224 - widgets/e-table/e-table-model.h | 71 - widgets/e-table/e-table-render.c | 20 - widgets/e-table/e-table-render.h | 21 - widgets/e-table/e-table-simple.c | 146 - widgets/e-table/e-table-simple.h | 47 - widgets/e-table/e-table-sorted-variable.c | 148 - widgets/e-table/e-table-sorted-variable.h | 34 - widgets/e-table/e-table-sorted.c | 89 - widgets/e-table/e-table-sorted.h | 29 - widgets/e-table/e-table-subset-variable.c | 144 - widgets/e-table/e-table-subset-variable.h | 43 - widgets/e-table/e-table-subset.c | 220 - widgets/e-table/e-table-subset.h | 37 - widgets/e-table/e-table-tree.h | 19 - widgets/e-table/e-table.c | 723 - widgets/e-table/e-table.h | 63 - widgets/e-table/image1.png | Bin 1858 -> 0 bytes widgets/e-table/image2.png | Bin 1987 -> 0 bytes widgets/e-table/image3.png | Bin 2051 -> 0 bytes widgets/e-table/remove-col.xpm | 22 - widgets/e-table/sample.table | 11 - widgets/e-table/table-test.c | 45 - widgets/e-table/table-test.h | 4 - widgets/e-table/test-check.c | 179 - widgets/e-table/test-cols.c | 223 - widgets/e-table/test-table.c | 331 - widgets/e-table/test.c | 17 - widgets/e-text/.cvsignore | 6 - widgets/e-text/Makefile.am | 13 - widgets/e-text/e-text-event-processor-emacs-like.c | 357 - widgets/e-text/e-text-event-processor-emacs-like.h | 68 - widgets/e-text/e-text-event-processor-types.h | 136 - widgets/e-text/e-text-event-processor.c | 103 - widgets/e-text/e-text-event-processor.h | 74 - widgets/e-text/e-text-test.c | 104 - widgets/e-text/e-text.c | 2549 --- widgets/e-text/e-text.h | 196 - widgets/meeting-time-sel/.cvsignore | 7 - widgets/meeting-time-sel/LICENSE | 1 - widgets/meeting-time-sel/Makefile.am | 30 - widgets/meeting-time-sel/e-meeting-time-sel-item.c | 924 - widgets/meeting-time-sel/e-meeting-time-sel-item.h | 78 - .../e-meeting-time-sel-list-item.c | 303 - .../e-meeting-time-sel-list-item.h | 74 - .../meeting-time-sel/e-meeting-time-sel-mail.xpm | 135 - .../e-meeting-time-sel-no-mail.xpm | 123 - widgets/meeting-time-sel/e-meeting-time-sel.c | 3065 ---- widgets/meeting-time-sel/e-meeting-time-sel.h | 496 - widgets/meeting-time-sel/test-meeting-time-sel.c | 236 - widgets/misc/e-canvas-utils.c | 36 - widgets/misc/e-canvas-utils.h | 29 - widgets/misc/e-canvas.c | 301 - widgets/misc/e-canvas.h | 71 - widgets/misc/e-colors.c | 74 - widgets/misc/e-colors.h | 14 - widgets/misc/e-cursors.c | 38 - widgets/misc/e-cursors.h | 38 - widgets/misc/e-gui-utils.c | 64 - widgets/misc/e-gui-utils.h | 12 - widgets/misc/e-reflow.c | 787 - widgets/misc/e-reflow.h | 104 - widgets/misc/pixmaps/cursor_cross.xpm | 38 - widgets/misc/pixmaps/cursor_hand_closed.xpm | 38 - widgets/misc/pixmaps/cursor_hand_open.xpm | 38 - widgets/misc/pixmaps/cursor_zoom_in.xpm | 37 - widgets/misc/pixmaps/cursor_zoom_out.xpm | 37 - widgets/shortcut-bar/.cvsignore | 7 - widgets/shortcut-bar/LICENSE | 1 - widgets/shortcut-bar/Makefile.am | 33 - widgets/shortcut-bar/e-clipped-label.c | 361 - widgets/shortcut-bar/e-clipped-label.h | 90 - widgets/shortcut-bar/e-group-bar.c | 1496 -- widgets/shortcut-bar/e-group-bar.h | 171 - widgets/shortcut-bar/e-icon-bar-bg-item.c | 361 - widgets/shortcut-bar/e-icon-bar-bg-item.h | 72 - widgets/shortcut-bar/e-icon-bar-text-item.c | 1696 -- widgets/shortcut-bar/e-icon-bar-text-item.h | 158 - widgets/shortcut-bar/e-icon-bar.c | 1527 -- widgets/shortcut-bar/e-icon-bar.h | 240 - widgets/shortcut-bar/e-shortcut-bar.c | 562 - widgets/shortcut-bar/e-shortcut-bar.h | 114 - widgets/shortcut-bar/e-vscrolled-bar.c | 668 - widgets/shortcut-bar/e-vscrolled-bar.h | 97 - widgets/shortcut-bar/test-shortcut-bar.c | 459 - widgets/table/.cvsignore | 7 - widgets/table/add-col.xpm | 22 - widgets/table/check-empty.xpm | 21 - widgets/table/check-filled.xpm | 21 - widgets/table/clip.png | Bin 192 -> 0 bytes widgets/table/e-cell-checkbox.c | 44 - widgets/table/e-cell-checkbox.h | 24 - widgets/table/e-cell-string.c | 9 - widgets/table/e-cell-text.c | 1887 -- widgets/table/e-cell-text.h | 63 - widgets/table/e-cell-toggle.c | 298 - widgets/table/e-cell-toggle.h | 35 - widgets/table/e-cell.c | 176 - widgets/table/e-cell.h | 77 - widgets/table/e-table-col-dnd.h | 10 - widgets/table/e-table-col.c | 118 - widgets/table/e-table-col.h | 64 - widgets/table/e-table-column-item.c | 199 - widgets/table/e-table-column-item.h | 20 - widgets/table/e-table-column-model.h | 5 - widgets/table/e-table-column.c | 293 - widgets/table/e-table-group-container.c | 853 - widgets/table/e-table-group-container.h | 67 - widgets/table/e-table-group-leaf.c | 296 - widgets/table/e-table-group-leaf.h | 41 - widgets/table/e-table-group.c | 369 - widgets/table/e-table-group.h | 93 - widgets/table/e-table-header-item.c | 920 - widgets/table/e-table-header-item.h | 56 - widgets/table/e-table-header.c | 345 - widgets/table/e-table-header.h | 65 - widgets/table/e-table-item.c | 1368 -- widgets/table/e-table-item.h | 108 - widgets/table/e-table-model.c | 224 - widgets/table/e-table-model.h | 71 - widgets/table/e-table-render.c | 20 - widgets/table/e-table-render.h | 21 - widgets/table/e-table-simple.c | 146 - widgets/table/e-table-simple.h | 47 - widgets/table/e-table-sorted-variable.c | 148 - widgets/table/e-table-sorted-variable.h | 34 - widgets/table/e-table-sorted.c | 89 - widgets/table/e-table-sorted.h | 29 - widgets/table/e-table-subset-variable.c | 144 - widgets/table/e-table-subset-variable.h | 43 - widgets/table/e-table-subset.c | 220 - widgets/table/e-table-subset.h | 37 - widgets/table/e-table-tree.h | 19 - widgets/table/e-table.c | 723 - widgets/table/e-table.h | 63 - widgets/table/image1.png | Bin 1858 -> 0 bytes widgets/table/image2.png | Bin 1987 -> 0 bytes widgets/table/image3.png | Bin 2051 -> 0 bytes widgets/table/remove-col.xpm | 22 - widgets/table/sample.table | 11 - widgets/table/table-test.c | 45 - widgets/table/table-test.h | 4 - widgets/table/test-check.c | 179 - widgets/table/test-cols.c | 223 - widgets/table/test-table.c | 331 - widgets/table/test.c | 17 - widgets/text/.cvsignore | 6 - widgets/text/e-text-event-processor-emacs-like.c | 357 - widgets/text/e-text-event-processor-emacs-like.h | 68 - widgets/text/e-text-event-processor-types.h | 136 - widgets/text/e-text-event-processor.c | 103 - widgets/text/e-text-event-processor.h | 74 - widgets/text/e-text-test.c | 104 - widgets/text/e-text.c | 2549 --- widgets/text/e-text.h | 196 - 964 files changed, 245129 deletions(-) delete mode 100644 .cvsignore delete mode 100644 AUTHORS delete mode 100644 COPYING delete mode 100644 ChangeLog delete mode 100644 INSTALL delete mode 100644 MAINTAINERS delete mode 100644 Makefile.am delete mode 100644 NEWS delete mode 100644 README delete mode 100644 acconfig.h delete mode 100644 addressbook/.cvsignore delete mode 100644 addressbook/Makefile.am delete mode 100644 addressbook/backend/ebook/Makefile.am delete mode 100644 addressbook/backend/ebook/TODO delete mode 100644 addressbook/backend/ebook/e-book-listener.c delete mode 100644 addressbook/backend/ebook/e-book-listener.h delete mode 100644 addressbook/backend/ebook/e-book.c delete mode 100644 addressbook/backend/ebook/e-book.h delete mode 100644 addressbook/backend/ebook/e-card-cursor.h delete mode 100644 addressbook/backend/ebook/e-card-pairs.h delete mode 100644 addressbook/backend/ebook/e-card-types.h delete mode 100644 addressbook/backend/ebook/e-card.c delete mode 100644 addressbook/backend/ebook/e-card.h delete mode 100644 addressbook/backend/idl/Makefile.am delete mode 100644 addressbook/backend/idl/addressbook.idl delete mode 100644 addressbook/backend/pas/Makefile.am delete mode 100644 addressbook/backend/pas/TODO delete mode 100644 addressbook/backend/pas/pas-backend-file.c delete mode 100644 addressbook/backend/pas/pas-backend-file.h delete mode 100644 addressbook/backend/pas/pas-backend.c delete mode 100644 addressbook/backend/pas/pas-backend.h delete mode 100644 addressbook/backend/pas/pas-book-factory.c delete mode 100644 addressbook/backend/pas/pas-book-factory.h delete mode 100644 addressbook/backend/pas/pas-book.c delete mode 100644 addressbook/backend/pas/pas-book.h delete mode 100644 addressbook/backend/pas/pas.c delete mode 100644 addressbook/backend/pas/wombat.gnorba delete mode 100644 addressbook/contact-editor/.cvsignore delete mode 100644 addressbook/contact-editor/Makefile.am delete mode 100644 addressbook/contact-editor/arrow.png delete mode 100644 addressbook/contact-editor/briefcase.png delete mode 100644 addressbook/contact-editor/contact-editor.glade delete mode 100644 addressbook/contact-editor/e-contact-editor-strings.h delete mode 100644 addressbook/contact-editor/e-contact-editor.c delete mode 100644 addressbook/contact-editor/e-contact-editor.h delete mode 100644 addressbook/contact-editor/email.png delete mode 100644 addressbook/contact-editor/head.png delete mode 100644 addressbook/contact-editor/netfreebusy.png delete mode 100644 addressbook/contact-editor/netmeeting.png delete mode 100644 addressbook/contact-editor/phone.png delete mode 100644 addressbook/contact-editor/snailmail.png delete mode 100644 addressbook/contact-editor/test-editor.c delete mode 100644 addressbook/contact-editor/web.png delete mode 100644 addressbook/gui/contact-editor/.cvsignore delete mode 100644 addressbook/gui/contact-editor/Makefile.am delete mode 100644 addressbook/gui/contact-editor/arrow.png delete mode 100644 addressbook/gui/contact-editor/briefcase.png delete mode 100644 addressbook/gui/contact-editor/contact-editor.glade delete mode 100644 addressbook/gui/contact-editor/e-contact-editor-strings.h delete mode 100644 addressbook/gui/contact-editor/e-contact-editor.c delete mode 100644 addressbook/gui/contact-editor/e-contact-editor.h delete mode 100644 addressbook/gui/contact-editor/email.png delete mode 100644 addressbook/gui/contact-editor/head.png delete mode 100644 addressbook/gui/contact-editor/netfreebusy.png delete mode 100644 addressbook/gui/contact-editor/netmeeting.png delete mode 100644 addressbook/gui/contact-editor/phone.png delete mode 100644 addressbook/gui/contact-editor/snailmail.png delete mode 100644 addressbook/gui/contact-editor/test-editor.c delete mode 100644 addressbook/gui/contact-editor/web.png delete mode 100644 addressbook/gui/minicard/.cvsignore delete mode 100644 addressbook/gui/minicard/Makefile.am delete mode 100644 addressbook/gui/minicard/e-minicard-label.c delete mode 100644 addressbook/gui/minicard/e-minicard-label.h delete mode 100644 addressbook/gui/minicard/e-minicard.c delete mode 100644 addressbook/gui/minicard/e-minicard.h delete mode 100644 addressbook/gui/minicard/e-reflow.c delete mode 100644 addressbook/gui/minicard/e-reflow.h delete mode 100644 addressbook/gui/minicard/test-minicard-label.c delete mode 100644 addressbook/gui/minicard/test-minicard.c delete mode 100644 addressbook/gui/minicard/test-reflow.c delete mode 100644 addressbook/gui/widgets/Makefile.am delete mode 100644 addressbook/gui/widgets/e-minicard-label.c delete mode 100644 addressbook/gui/widgets/e-minicard-label.h delete mode 100644 addressbook/gui/widgets/e-minicard.c delete mode 100644 addressbook/gui/widgets/e-minicard.h delete mode 100644 addressbook/gui/widgets/test-minicard-label.c delete mode 100644 addressbook/gui/widgets/test-minicard.c delete mode 100644 addressbook/gui/widgets/test-reflow.c delete mode 100644 addressbook/printing/.cvsignore delete mode 100644 addressbook/printing/Makefile.am delete mode 100644 addressbook/printing/e-contact-print-style-editor.c delete mode 100644 addressbook/printing/e-contact-print-style-editor.h delete mode 100644 addressbook/printing/e-contact-print-types.h delete mode 100644 addressbook/printing/e-contact-print.c delete mode 100644 addressbook/printing/e-contact-print.glade delete mode 100644 addressbook/printing/e-contact-print.h delete mode 100644 addressbook/printing/medbook.ecps delete mode 100644 addressbook/printing/phonelist.ecps delete mode 100644 addressbook/printing/smallbook.ecps delete mode 100644 addressbook/printing/test-contact-print-style-editor.c delete mode 100644 addressbook/printing/test-print.c delete mode 100755 autogen.sh delete mode 100644 calendar/.cvsignore delete mode 100644 calendar/AUTHORS delete mode 100644 calendar/ChangeLog delete mode 100644 calendar/GnomeCal.idl delete mode 100644 calendar/Makefile.am delete mode 100644 calendar/TODO delete mode 100644 calendar/alarm.c delete mode 100644 calendar/alarm.h delete mode 100644 calendar/bell.xpm delete mode 100644 calendar/cal-backend.c delete mode 100644 calendar/cal-backend.h delete mode 100644 calendar/cal-client.c delete mode 100644 calendar/cal-client.h delete mode 100644 calendar/cal-client/cal-client.c delete mode 100644 calendar/cal-client/cal-client.h delete mode 100644 calendar/cal-client/cal-listener.c delete mode 100644 calendar/cal-client/cal-listener.h delete mode 100644 calendar/cal-client/cal-util.c delete mode 100644 calendar/cal-client/cal-util.h delete mode 100644 calendar/cal-client/client-test.c delete mode 100644 calendar/cal-common.h delete mode 100644 calendar/cal-factory.c delete mode 100644 calendar/cal-factory.h delete mode 100644 calendar/cal-listener.c delete mode 100644 calendar/cal-listener.h delete mode 100644 calendar/cal-util.c delete mode 100644 calendar/cal-util.h delete mode 100644 calendar/cal-util/calobj.c delete mode 100644 calendar/cal-util/calobj.h delete mode 100644 calendar/cal.c delete mode 100644 calendar/cal.h delete mode 100644 calendar/cal_struct.h delete mode 100644 calendar/calendar-conduit-control-applet.c delete mode 100644 calendar/calendar-conduit-control-applet.desktop delete mode 100644 calendar/calendar-conduit.c delete mode 100644 calendar/calendar-conduit.h delete mode 100644 calendar/calendar-pilot-sync.c delete mode 100644 calendar/calendar.c delete mode 100644 calendar/calendar.h delete mode 100644 calendar/calobj.c delete mode 100644 calendar/calobj.h delete mode 100644 calendar/conduits/calendar/calendar-conduit-control-applet.c delete mode 100644 calendar/conduits/calendar/calendar-conduit-control-applet.desktop delete mode 100644 calendar/conduits/calendar/calendar-conduit.c delete mode 100644 calendar/conduits/calendar/calendar-conduit.h delete mode 100644 calendar/conduits/todo/todo-conduit-control-applet.c delete mode 100644 calendar/conduits/todo/todo-conduit-control-applet.desktop delete mode 100644 calendar/conduits/todo/todo-conduit.c delete mode 100644 calendar/conduits/todo/todo-conduit.h delete mode 100644 calendar/corba-cal-factory.c delete mode 100644 calendar/corba-cal-factory.h delete mode 100644 calendar/corba-cal.c delete mode 100644 calendar/corba-cal.h delete mode 100644 calendar/doc/.cvsignore delete mode 100644 calendar/doc/C/.cvsignore delete mode 100644 calendar/doc/C/Makefile.am delete mode 100644 calendar/doc/C/gnomecal.sgml delete mode 100644 calendar/doc/C/images/cal-props.gif delete mode 100644 calendar/doc/C/images/calday.gif delete mode 100644 calendar/doc/C/images/calmonth.gif delete mode 100644 calendar/doc/C/images/calweek.gif delete mode 100644 calendar/doc/C/images/calyear.gif delete mode 100644 calendar/doc/C/topic.dat delete mode 100644 calendar/doc/Makefile.am delete mode 100644 calendar/eventedit.c delete mode 100644 calendar/eventedit.h delete mode 100644 calendar/evolution-calendar.idl delete mode 100644 calendar/getdate.y delete mode 100644 calendar/gncal-day-panel.c delete mode 100644 calendar/gncal-day-panel.h delete mode 100644 calendar/gncal-day-view.c delete mode 100644 calendar/gncal-day-view.h delete mode 100644 calendar/gncal-full-day.c delete mode 100644 calendar/gncal-full-day.h delete mode 100644 calendar/gncal-todo.c delete mode 100644 calendar/gncal-todo.h delete mode 100644 calendar/gncal-week-view.c delete mode 100644 calendar/gncal-week-view.h delete mode 100644 calendar/gncal.desktop delete mode 100644 calendar/gnome-cal.c delete mode 100644 calendar/gnome-cal.h delete mode 100644 calendar/gnome-cal.html delete mode 100644 calendar/gnome-calendar-conduit.png delete mode 100644 calendar/gnome-month-item.c delete mode 100644 calendar/gnome-month-item.h delete mode 100644 calendar/gnomecal.gnorba delete mode 100644 calendar/goto.c delete mode 100644 calendar/gui/GnomeCal.idl delete mode 100644 calendar/gui/Makefile.am delete mode 100644 calendar/gui/alarm-notify/alarm.c delete mode 100644 calendar/gui/alarm-notify/alarm.h delete mode 100644 calendar/gui/alarm.c delete mode 100644 calendar/gui/alarm.h delete mode 100644 calendar/gui/bell.xpm delete mode 100644 calendar/gui/cal_struct.h delete mode 100644 calendar/gui/calendar-conduit-control-applet.c delete mode 100644 calendar/gui/calendar-conduit-control-applet.desktop delete mode 100644 calendar/gui/calendar-conduit.c delete mode 100644 calendar/gui/calendar-conduit.h delete mode 100644 calendar/gui/calendar-pilot-sync.c delete mode 100644 calendar/gui/calendar.c delete mode 100644 calendar/gui/calendar.h delete mode 100644 calendar/gui/corba-cal-factory.c delete mode 100644 calendar/gui/corba-cal-factory.h delete mode 100644 calendar/gui/corba-cal.c delete mode 100644 calendar/gui/corba-cal.h delete mode 100644 calendar/gui/eventedit.c delete mode 100644 calendar/gui/eventedit.h delete mode 100644 calendar/gui/getdate.y delete mode 100644 calendar/gui/gncal-day-panel.c delete mode 100644 calendar/gui/gncal-day-panel.h delete mode 100644 calendar/gui/gncal-day-view.c delete mode 100644 calendar/gui/gncal-day-view.h delete mode 100644 calendar/gui/gncal-full-day.c delete mode 100644 calendar/gui/gncal-full-day.h delete mode 100644 calendar/gui/gncal-todo.c delete mode 100644 calendar/gui/gncal-todo.h delete mode 100644 calendar/gui/gncal-week-view.c delete mode 100644 calendar/gui/gncal-week-view.h delete mode 100644 calendar/gui/gncal.desktop delete mode 100644 calendar/gui/gnome-cal.c delete mode 100644 calendar/gui/gnome-cal.h delete mode 100644 calendar/gui/gnome-cal.html delete mode 100644 calendar/gui/gnome-calendar-conduit.png delete mode 100644 calendar/gui/gnome-month-item.c delete mode 100644 calendar/gui/gnome-month-item.h delete mode 100644 calendar/gui/gnomecal.gnorba delete mode 100644 calendar/gui/goto.c delete mode 100644 calendar/gui/icalendar-types delete mode 100644 calendar/gui/layout.c delete mode 100644 calendar/gui/layout.h delete mode 100644 calendar/gui/main.c delete mode 100644 calendar/gui/main.h delete mode 100644 calendar/gui/mark.c delete mode 100644 calendar/gui/mark.h delete mode 100644 calendar/gui/month-view.c delete mode 100644 calendar/gui/month-view.h delete mode 100644 calendar/gui/popup-menu.c delete mode 100644 calendar/gui/popup-menu.h delete mode 100644 calendar/gui/prop.c delete mode 100644 calendar/gui/quick-view.c delete mode 100644 calendar/gui/quick-view.h delete mode 100644 calendar/gui/recur.xpm delete mode 100644 calendar/gui/test.vcf delete mode 100644 calendar/gui/test2.vcf delete mode 100644 calendar/gui/todo-conduit-control-applet.c delete mode 100644 calendar/gui/todo-conduit-control-applet.desktop delete mode 100644 calendar/gui/todo-conduit.c delete mode 100644 calendar/gui/todo-conduit.h delete mode 100644 calendar/gui/topic.dat delete mode 100644 calendar/gui/view-utils.c delete mode 100644 calendar/gui/view-utils.h delete mode 100644 calendar/gui/week-view.c delete mode 100644 calendar/gui/week-view.h delete mode 100644 calendar/gui/year-view.c delete mode 100644 calendar/gui/year-view.h delete mode 100644 calendar/icalendar-types delete mode 100644 calendar/icalendar.c delete mode 100644 calendar/icalendar.h delete mode 100644 calendar/idl/evolution-calendar.idl delete mode 100644 calendar/job.c delete mode 100644 calendar/job.h delete mode 100644 calendar/layout.c delete mode 100644 calendar/layout.h delete mode 100644 calendar/main.c delete mode 100644 calendar/main.h delete mode 100644 calendar/mark.c delete mode 100644 calendar/mark.h delete mode 100644 calendar/month-view.c delete mode 100644 calendar/month-view.h delete mode 100644 calendar/pcs/cal-backend.c delete mode 100644 calendar/pcs/cal-backend.h delete mode 100644 calendar/pcs/cal-common.h delete mode 100644 calendar/pcs/cal-factory.c delete mode 100644 calendar/pcs/cal-factory.h delete mode 100644 calendar/pcs/cal.c delete mode 100644 calendar/pcs/cal.h delete mode 100644 calendar/pcs/calobj.c delete mode 100644 calendar/pcs/calobj.h delete mode 100644 calendar/pcs/job.c delete mode 100644 calendar/pcs/job.h delete mode 100644 calendar/pcs/tlacuache.c delete mode 100644 calendar/pcs/tlacuache.gnorba delete mode 100644 calendar/popup-menu.c delete mode 100644 calendar/popup-menu.h delete mode 100644 calendar/prop.c delete mode 100644 calendar/quick-view.c delete mode 100644 calendar/quick-view.h delete mode 100644 calendar/recur.xpm delete mode 100644 calendar/test.vcf delete mode 100644 calendar/test2.vcf delete mode 100644 calendar/timeutil.c delete mode 100644 calendar/timeutil.h delete mode 100644 calendar/tl-test.c delete mode 100644 calendar/tlacuache.c delete mode 100644 calendar/tlacuache.gnorba delete mode 100644 calendar/todo-conduit-control-applet.c delete mode 100644 calendar/todo-conduit-control-applet.desktop delete mode 100644 calendar/todo-conduit.c delete mode 100644 calendar/todo-conduit.h delete mode 100644 calendar/topic.dat delete mode 100644 calendar/view-utils.c delete mode 100644 calendar/view-utils.h delete mode 100644 calendar/week-view.c delete mode 100644 calendar/week-view.h delete mode 100644 calendar/year-view.c delete mode 100644 calendar/year-view.h delete mode 100644 camel/.cvsignore delete mode 100644 camel/CODING.STYLE delete mode 100644 camel/ChangeLog delete mode 100644 camel/Makefile.am delete mode 100644 camel/README delete mode 100644 camel/README.COPYRIGHT delete mode 100644 camel/README.HACKING delete mode 100644 camel/camel-arg-collector.c delete mode 100644 camel/camel-data-wrapper.c delete mode 100644 camel/camel-data-wrapper.h delete mode 100644 camel/camel-exception-list.def delete mode 100644 camel/camel-exception.c delete mode 100644 camel/camel-exception.h delete mode 100644 camel/camel-folder-pt-proxy.c delete mode 100644 camel/camel-folder-pt-proxy.h delete mode 100644 camel/camel-folder-summary.c delete mode 100644 camel/camel-folder-summary.h delete mode 100644 camel/camel-folder-utils.c delete mode 100644 camel/camel-folder-utils.h delete mode 100644 camel/camel-folder.c delete mode 100644 camel/camel-folder.h delete mode 100644 camel/camel-formatter.c delete mode 100644 camel/camel-formatter.h delete mode 100644 camel/camel-log.c delete mode 100644 camel/camel-log.h delete mode 100644 camel/camel-marshal-utils.c delete mode 100644 camel/camel-marshal-utils.h delete mode 100644 camel/camel-medium.c delete mode 100644 camel/camel-medium.h delete mode 100644 camel/camel-mime-body-part.c delete mode 100644 camel/camel-mime-body-part.h delete mode 100644 camel/camel-mime-message.c delete mode 100644 camel/camel-mime-message.h delete mode 100644 camel/camel-mime-part-utils.c delete mode 100644 camel/camel-mime-part-utils.h delete mode 100644 camel/camel-mime-part.c delete mode 100644 camel/camel-mime-part.h delete mode 100644 camel/camel-multipart.c delete mode 100644 camel/camel-multipart.h delete mode 100644 camel/camel-op-queue.c delete mode 100644 camel/camel-op-queue.h delete mode 100644 camel/camel-provider.c delete mode 100644 camel/camel-provider.h delete mode 100644 camel/camel-recipient.c delete mode 100644 camel/camel-recipient.h delete mode 100644 camel/camel-seekable-stream.c delete mode 100644 camel/camel-seekable-stream.h delete mode 100644 camel/camel-seekable-substream.c delete mode 100644 camel/camel-seekable-substream.h delete mode 100644 camel/camel-service.c delete mode 100644 camel/camel-service.h delete mode 100644 camel/camel-session.c delete mode 100644 camel/camel-session.h delete mode 100644 camel/camel-simple-data-wrapper-stream.c delete mode 100644 camel/camel-simple-data-wrapper-stream.h delete mode 100644 camel/camel-simple-data-wrapper.c delete mode 100644 camel/camel-simple-data-wrapper.h delete mode 100644 camel/camel-store.c delete mode 100644 camel/camel-store.h delete mode 100644 camel/camel-stream-b64.c delete mode 100644 camel/camel-stream-b64.h delete mode 100644 camel/camel-stream-buffered-fs.c delete mode 100644 camel/camel-stream-buffered-fs.h delete mode 100644 camel/camel-stream-data-wrapper.c delete mode 100644 camel/camel-stream-data-wrapper.h delete mode 100644 camel/camel-stream-fs.c delete mode 100644 camel/camel-stream-fs.h delete mode 100644 camel/camel-stream-mem.c delete mode 100644 camel/camel-stream-mem.h delete mode 100644 camel/camel-stream.c delete mode 100644 camel/camel-stream.h delete mode 100644 camel/camel-thread-proxy.c delete mode 100644 camel/camel-thread-proxy.h delete mode 100644 camel/camel-transport.c delete mode 100644 camel/camel-transport.h delete mode 100644 camel/camel-types.h delete mode 100644 camel/camel.c delete mode 100644 camel/camel.h delete mode 100644 camel/data-wrapper-repository.c delete mode 100644 camel/data-wrapper-repository.h delete mode 100644 camel/gmime-base64.c delete mode 100644 camel/gmime-base64.h delete mode 100644 camel/gmime-content-field.c delete mode 100644 camel/gmime-content-field.h delete mode 100644 camel/gmime-rfc2047.c delete mode 100644 camel/gmime-rfc2047.h delete mode 100644 camel/gmime-utils.c delete mode 100644 camel/gmime-utils.h delete mode 100644 camel/gstring-util.c delete mode 100644 camel/gstring-util.h delete mode 100644 camel/hash-table-utils.c delete mode 100644 camel/hash-table-utils.h delete mode 100644 camel/md5-utils.c delete mode 100644 camel/md5-utils.h delete mode 100644 camel/providers/.cvsignore delete mode 100644 camel/providers/MH/.cvsignore delete mode 100644 camel/providers/MH/Makefile.am delete mode 100644 camel/providers/MH/camel-mh-folder.c delete mode 100644 camel/providers/MH/camel-mh-folder.h delete mode 100644 camel/providers/MH/camel-mh-provider.c delete mode 100644 camel/providers/MH/camel-mh-store.c delete mode 100644 camel/providers/MH/camel-mh-store.h delete mode 100644 camel/providers/MH/mh-summary.c delete mode 100644 camel/providers/MH/mh-summary.h delete mode 100644 camel/providers/MH/mh-uid.c delete mode 100644 camel/providers/MH/mh-uid.h delete mode 100644 camel/providers/MH/mh-utils.c delete mode 100644 camel/providers/MH/mh-utils.h delete mode 100644 camel/providers/Makefile.am delete mode 100644 camel/providers/maildir/.cvsignore delete mode 100644 camel/providers/maildir/Makefile.am delete mode 100644 camel/providers/maildir/camel-maildir-folder.c delete mode 100644 camel/providers/maildir/camel-maildir-folder.h delete mode 100644 camel/providers/maildir/camel-maildir-provider.c delete mode 100644 camel/providers/maildir/camel-maildir-store.c delete mode 100644 camel/providers/maildir/camel-maildir-store.h delete mode 100644 camel/providers/mbox/.cvsignore delete mode 100644 camel/providers/mbox/Makefile.am delete mode 100644 camel/providers/mbox/camel-mbox-folder.c delete mode 100644 camel/providers/mbox/camel-mbox-folder.h delete mode 100644 camel/providers/mbox/camel-mbox-parser.c delete mode 100644 camel/providers/mbox/camel-mbox-parser.h delete mode 100644 camel/providers/mbox/camel-mbox-provider.c delete mode 100644 camel/providers/mbox/camel-mbox-search.c delete mode 100644 camel/providers/mbox/camel-mbox-search.h delete mode 100644 camel/providers/mbox/camel-mbox-store.c delete mode 100644 camel/providers/mbox/camel-mbox-store.h delete mode 100644 camel/providers/mbox/camel-mbox-summary.c delete mode 100644 camel/providers/mbox/camel-mbox-summary.h delete mode 100644 camel/providers/mbox/camel-mbox-utils.c delete mode 100644 camel/providers/mbox/camel-mbox-utils.h delete mode 100644 camel/providers/sendmail/.cvsignore delete mode 100644 camel/providers/sendmail/Makefile.am delete mode 100644 camel/providers/sendmail/camel-sendmail-provider.c delete mode 100644 camel/providers/sendmail/camel-sendmail-transport.c delete mode 100644 camel/providers/sendmail/camel-sendmail-transport.h delete mode 100644 camel/string-utils.c delete mode 100644 camel/string-utils.h delete mode 100644 camel/url-util.c delete mode 100644 camel/url-util.h delete mode 100644 composer/.cvsignore delete mode 100644 composer/ChangeLog delete mode 100644 composer/Makefile.am delete mode 100644 composer/e-msg-composer-address-dialog.c delete mode 100644 composer/e-msg-composer-address-dialog.glade delete mode 100644 composer/e-msg-composer-address-dialog.h delete mode 100644 composer/e-msg-composer-address-entry.c delete mode 100644 composer/e-msg-composer-address-entry.h delete mode 100644 composer/e-msg-composer-attachment-bar.c delete mode 100644 composer/e-msg-composer-attachment-bar.h delete mode 100644 composer/e-msg-composer-attachment.c delete mode 100644 composer/e-msg-composer-attachment.glade delete mode 100644 composer/e-msg-composer-attachment.h delete mode 100644 composer/e-msg-composer-hdrs.c delete mode 100644 composer/e-msg-composer-hdrs.h delete mode 100644 composer/e-msg-composer.c delete mode 100644 composer/e-msg-composer.glade delete mode 100644 composer/e-msg-composer.h delete mode 100644 composer/main.c delete mode 100644 configure.in delete mode 100644 data/.cvsignore delete mode 100644 data/Makefile.am delete mode 100644 data/evolution.desktop delete mode 100644 devel-docs/.cvsignore delete mode 100644 devel-docs/Makefile.am delete mode 100644 devel-docs/camel/.cvsignore delete mode 100644 devel-docs/camel/Makefile.am delete mode 100644 devel-docs/camel/README_AND_TODO.txt delete mode 100644 devel-docs/camel/camel-docs.sgml delete mode 100644 devel-docs/camel/camel-sections.txt delete mode 100644 devel-docs/camel/camel.types delete mode 100644 devel-docs/camel/tmpl/.cvsignore delete mode 100644 devel-docs/camel/tmpl/camel-data-wrapper.sgml delete mode 100644 devel-docs/camel/tmpl/camel-folder.sgml delete mode 100644 devel-docs/camel/tmpl/camel-mime-message.sgml delete mode 100644 devel-docs/camel/tmpl/camel-mime-part.sgml delete mode 100644 devel-docs/camel/tmpl/camel-recipient.sgml delete mode 100644 devel-docs/camel/tmpl/camel-service.sgml delete mode 100644 devel-docs/camel/tmpl/camel-store.sgml delete mode 100644 devel-docs/camel/tmpl/camel-stream.sgml delete mode 100644 devel-docs/misc/ref_and_id_proposition.txt delete mode 100644 devel-docs/query/virtual-folder-in-depth.sgml delete mode 100644 devel-docs/query/virtual-folder-in-depth.txt delete mode 100644 doc/.cvsignore delete mode 100644 doc/Camel-Classes delete mode 100644 doc/Design delete mode 100644 e-util/.cvsignore delete mode 100644 e-util/Makefile.am delete mode 100644 e-util/e-canvas-utils.c delete mode 100644 e-util/e-canvas-utils.h delete mode 100644 e-util/e-canvas.c delete mode 100644 e-util/e-canvas.h delete mode 100644 e-util/e-cursors.c delete mode 100644 e-util/e-cursors.h delete mode 100644 e-util/e-gui-utils.c delete mode 100644 e-util/e-gui-utils.h delete mode 100644 e-util/e-setup.c delete mode 100644 e-util/e-setup.h delete mode 100644 e-util/e-text-event-processor-emacs-like.c delete mode 100644 e-util/e-text-event-processor-emacs-like.h delete mode 100644 e-util/e-text-event-processor-types.h delete mode 100644 e-util/e-text-event-processor.c delete mode 100644 e-util/e-text-event-processor.h delete mode 100644 e-util/e-util.c delete mode 100644 e-util/e-util.c-8611 delete mode 100644 e-util/e-util.h delete mode 100644 e-util/e-util.h-29002 delete mode 100644 e-util/e-xml-utils.c delete mode 100644 e-util/e-xml-utils.c-56826 delete mode 100644 e-util/e-xml-utils.h delete mode 100644 e-util/e-xml-utils.h-82548 delete mode 100644 ebook/e-book.c delete mode 100644 ebook/e-book.h delete mode 100644 ebook/e-card-fields.h delete mode 100644 ebook/e-card.h delete mode 100644 ebook/e-commerce.h delete mode 100644 filter/.cvsignore delete mode 100644 filter/ChangeLog delete mode 100644 filter/Makefile delete mode 100755 filter/blank.xpm delete mode 100755 filter/check.xpm delete mode 100644 filter/filter-arg-types.c delete mode 100644 filter/filter-arg-types.h delete mode 100644 filter/filter-arg.c delete mode 100644 filter/filter-arg.h delete mode 100644 filter/filter-driver.c delete mode 100644 filter/filter-druid.c delete mode 100644 filter/filter-druid.h delete mode 100644 filter/filter-editor.c delete mode 100644 filter/filter-editor.h delete mode 100644 filter/filter-format.c delete mode 100644 filter/filter-format.h delete mode 100644 filter/filter-sexp.c delete mode 100644 filter/filter-sexp.h delete mode 100644 filter/filter-xml.c delete mode 100644 filter/filter-xml.h delete mode 100644 help/.cvsignore delete mode 100644 help/Camel-Classes delete mode 100644 help/Design delete mode 100644 libibex/.cvsignore delete mode 100644 libibex/COPYING.LIB delete mode 100644 libibex/ChangeLog delete mode 100644 libibex/Makefile.am delete mode 100644 libibex/TODO delete mode 100644 libibex/file.c delete mode 100644 libibex/find.c delete mode 100644 libibex/ibex.h delete mode 100644 libibex/ibex_internal.h delete mode 100644 libibex/index.c delete mode 100644 libibex/lookup.c delete mode 100644 libibex/mkindex.c delete mode 100644 libibex/words.c delete mode 100644 libical/.cvsignore delete mode 100644 libical/CHANGES delete mode 100644 libical/MacOS/errno.h delete mode 100644 libical/MacOS/libical.mcp delete mode 100644 libical/MacOS/libical.mcp.exp delete mode 100644 libical/MacOS/libical_prefix.h delete mode 100644 libical/MacOS/restrictions.make delete mode 100644 libical/MacOS/restrictions.script delete mode 100644 libical/MacOS/strdup.c delete mode 100644 libical/MacOS/strdup.h delete mode 100644 libical/Makefile.am delete mode 100644 libical/README delete mode 100644 libical/TEST delete mode 100644 libical/TODO delete mode 100644 libical/configure.scan delete mode 100644 libical/design-data/components.txt delete mode 100644 libical/design-data/param-c-types.txt delete mode 100644 libical/design-data/params-in-prop.txt delete mode 100644 libical/design-data/prop-to-value.txt delete mode 100644 libical/design-data/property-tokens.txt delete mode 100644 libical/design-data/restrictions.csv delete mode 100644 libical/design-data/status-new.txt delete mode 100644 libical/design-data/status.foo delete mode 100644 libical/design-data/status.txt delete mode 100644 libical/design-data/value-c-types.txt delete mode 100644 libical/design-data/value-mem-semantics.txt delete mode 100644 libical/doc/UsingLibical.lyx delete mode 100644 libical/doc/UsingLibical.sgml delete mode 100644 libical/doc/UsingLibical.txt delete mode 100755 libical/install-sh delete mode 100755 libical/scripts/mkderivedcomponents.pl delete mode 100755 libical/scripts/mkderivedparameters.pl delete mode 100755 libical/scripts/mkderivedproperties.pl delete mode 100755 libical/scripts/mkderivedvalues.pl delete mode 100755 libical/scripts/mkparameterrestrictions.pl delete mode 100755 libical/scripts/mkrestrictionrecords.pl delete mode 100755 libical/scripts/mkrestrictiontable.pl delete mode 100644 libical/src/.cvsignore delete mode 100644 libical/src/Makefile.am delete mode 100644 libical/src/libical/.cvsignore delete mode 100644 libical/src/libical/.gdb_history delete mode 100644 libical/src/libical/.gdbinit delete mode 100644 libical/src/libical/Makefile.am delete mode 100644 libical/src/libical/base64.c delete mode 100644 libical/src/libical/filelock.c delete mode 100644 libical/src/libical/filelock.h delete mode 100644 libical/src/libical/foo delete mode 100644 libical/src/libical/ical.h delete mode 100644 libical/src/libical/icalcomponent.c delete mode 100644 libical/src/libical/icalcomponent.h delete mode 100644 libical/src/libical/icalenums.c delete mode 100644 libical/src/libical/icalenums.h delete mode 100644 libical/src/libical/icalerror.c delete mode 100644 libical/src/libical/icalerror.h delete mode 100644 libical/src/libical/icalirip.h delete mode 100644 libical/src/libical/icalitip.l delete mode 100644 libical/src/libical/icalitip.output delete mode 100644 libical/src/libical/icalitip.tab.c delete mode 100644 libical/src/libical/icalitip.tab.h delete mode 100644 libical/src/libical/icalitip.y delete mode 100644 libical/src/libical/icalmemory.c delete mode 100644 libical/src/libical/icalmemory.h delete mode 100644 libical/src/libical/icalparameter.c delete mode 100644 libical/src/libical/icalparameter.h delete mode 100644 libical/src/libical/icalparser.c delete mode 100644 libical/src/libical/icalparser.h delete mode 100644 libical/src/libical/icalproperty.c delete mode 100644 libical/src/libical/icalproperty.h delete mode 100644 libical/src/libical/icalrestriction.c delete mode 100644 libical/src/libical/icalrestriction.h delete mode 100644 libical/src/libical/icaltypes.c delete mode 100644 libical/src/libical/icaltypes.h delete mode 100644 libical/src/libical/icalvalue.c delete mode 100644 libical/src/libical/icalvalue.h delete mode 100644 libical/src/libical/icalvcal.h delete mode 100644 libical/src/libical/locking.c delete mode 100644 libical/src/libical/pvl.c delete mode 100644 libical/src/libical/pvl.h delete mode 100644 libical/src/libical/testlocks.c delete mode 100644 libical/src/libicalss/.cvsignore delete mode 100644 libical/src/libicalss/Makefile.am delete mode 100644 libical/src/libicalss/icalcalendar.c delete mode 100644 libical/src/libicalss/icalcalendar.h delete mode 100644 libical/src/libicalss/icalcluster.c delete mode 100644 libical/src/libicalss/icalcluster.h delete mode 100644 libical/src/libicalss/icalcomponent.h delete mode 100644 libical/src/libicalss/icalstore.c delete mode 100644 libical/src/libicalss/icalstore.h delete mode 100644 libical/src/pvl/Makefile delete mode 100644 libical/src/test/.cvsignore delete mode 100644 libical/src/test/Makefile.in delete mode 100644 libical/src/test/alice/booked/199706 delete mode 100644 libical/src/test/alice/booked/199707 delete mode 100644 libical/src/test/alice/booked/199708 delete mode 100644 libical/src/test/alice/booked/199709 delete mode 100644 libical/src/test/alice/booked/199803 delete mode 100644 libical/src/test/alice/incoming.ics delete mode 100644 libical/src/test/copycluster.c delete mode 100644 libical/src/test/findobj.c delete mode 100644 libical/src/test/icaltestparser.c delete mode 100644 libical/src/test/regression.c delete mode 100644 libical/src/test/test-component.icd delete mode 100644 libical/src/test/usecases.c delete mode 100644 libical/test-data/0 delete mode 100644 libical/test-data/1 delete mode 100644 libical/test-data/1.1 delete mode 100644 libical/test-data/2 delete mode 100644 libical/test-data/2445.vcd delete mode 100644 libical/test-data/2446.vcd delete mode 100644 libical/test-data/3 delete mode 100644 libical/test-data/4 delete mode 100644 libical/test-data/5 delete mode 100644 libical/test-data/6 delete mode 100644 libical/test-data/7 delete mode 100644 libical/test-data/smallcluster.vcd delete mode 100644 libversit/.cvsignore delete mode 100644 libversit/Makefile.am delete mode 100644 libversit/README.TXT delete mode 100644 libversit/port.h delete mode 100644 libversit/vcaltest.c delete mode 100644 libversit/vcaltmp.c delete mode 100644 libversit/vcaltmp.h delete mode 100644 libversit/vcc.h delete mode 100644 libversit/vcc.y delete mode 100644 libversit/vctest.c delete mode 100644 libversit/vobject.c delete mode 100644 libversit/vobject.h delete mode 100644 mail/.cvsignore delete mode 100644 mail/ChangeLog delete mode 100644 mail/Mail.idl delete mode 100644 mail/Makefile.am delete mode 100644 mail/evolution-mail.gnorba delete mode 100644 mail/folder-browser-factory.c delete mode 100644 mail/folder-browser.c delete mode 100644 mail/folder-browser.h delete mode 100644 mail/html-stream.c delete mode 100644 mail/html-stream.h delete mode 100644 mail/mail-component.c delete mode 100644 mail/mail-display.c delete mode 100644 mail/mail-display.h delete mode 100644 mail/main.c delete mode 100644 mail/main.h delete mode 100644 mail/message-list.c delete mode 100644 mail/message-list.h delete mode 100644 mail/session.c delete mode 100644 mail/session.h delete mode 100644 mail/test-mail.c delete mode 100644 po/.cvsignore delete mode 100644 po/ChangeLog delete mode 100644 po/POTFILES.in delete mode 100644 shell/.cvsignore delete mode 100644 shell/Evolution.idl delete mode 100644 shell/Makefile.am delete mode 100644 shell/Shell.idl delete mode 100644 shell/e-folder-mail.c delete mode 100644 shell/e-folder-mail.h delete mode 100644 shell/e-folder.c delete mode 100644 shell/e-folder.h delete mode 100644 shell/e-init.c delete mode 100644 shell/e-init.h delete mode 100644 shell/e-shell-shortcut.c delete mode 100644 shell/e-shell-shortcut.h delete mode 100644 shell/e-shell-view-menu.c delete mode 100644 shell/e-shell-view-menu.h delete mode 100644 shell/e-shell-view.c delete mode 100644 shell/e-shell-view.h delete mode 100644 shell/e-shell.c delete mode 100644 shell/e-shell.h delete mode 100644 shell/e-shortcut.c delete mode 100644 shell/e-shortcut.h delete mode 100644 shell/evolution.h delete mode 100644 shell/main.c delete mode 100644 stamp.h.in delete mode 100644 tests/.cvsignore delete mode 100644 tests/Makefile.am delete mode 100644 tests/test-formatter.c delete mode 100644 tests/test1.c delete mode 100644 tests/test10.c delete mode 100644 tests/test11.c delete mode 100644 tests/test2.c delete mode 100644 tests/test3.c delete mode 100644 tests/test4.c delete mode 100644 tests/test5.c delete mode 100644 tests/test6.c delete mode 100644 tests/test7.c delete mode 100644 tests/test8.c delete mode 100644 tests/test9.c delete mode 100644 tests/ui-tests/.cvsignore delete mode 100644 tests/ui-tests/Makefile.am delete mode 100644 tests/ui-tests/message-browser.c delete mode 100644 tests/ui-tests/store_listing.c delete mode 100644 tests/ui-tests/store_listing.glade delete mode 100644 tests/ui-tests/test-multipart-alt.msg delete mode 100644 tests/ui-tests/test-multipart-mixed.msg delete mode 100644 widgets/.cvsignore delete mode 100644 widgets/LICENSE delete mode 100644 widgets/Makefile.am delete mode 100644 widgets/e-minicard/.cvsignore delete mode 100644 widgets/e-minicard/Makefile.am delete mode 100644 widgets/e-minicard/e-minicard-label.c delete mode 100644 widgets/e-minicard/e-minicard-label.h delete mode 100644 widgets/e-minicard/e-minicard.c delete mode 100644 widgets/e-minicard/e-minicard.h delete mode 100644 widgets/e-minicard/e-reflow.c delete mode 100644 widgets/e-minicard/e-reflow.h delete mode 100644 widgets/e-minicard/test-minicard-label.c delete mode 100644 widgets/e-minicard/test-minicard.c delete mode 100644 widgets/e-minicard/test-reflow.c delete mode 100644 widgets/e-reflow/e-reflow.c delete mode 100644 widgets/e-reflow/e-reflow.h delete mode 100644 widgets/e-table/.cvsignore delete mode 100644 widgets/e-table/ChangeLog delete mode 100644 widgets/e-table/LICENSE delete mode 100644 widgets/e-table/Makefile.am delete mode 100644 widgets/e-table/ROADMAP.e-table delete mode 100644 widgets/e-table/TODO delete mode 100644 widgets/e-table/add-col.xpm delete mode 100644 widgets/e-table/check-empty.xpm delete mode 100644 widgets/e-table/check-filled.xpm delete mode 100644 widgets/e-table/clip.png delete mode 100644 widgets/e-table/e-cell-checkbox.c delete mode 100644 widgets/e-table/e-cell-checkbox.h delete mode 100644 widgets/e-table/e-cell-string.c delete mode 100644 widgets/e-table/e-cell-text.c delete mode 100644 widgets/e-table/e-cell-text.h delete mode 100644 widgets/e-table/e-cell-toggle.c delete mode 100644 widgets/e-table/e-cell-toggle.h delete mode 100644 widgets/e-table/e-cell.c delete mode 100644 widgets/e-table/e-cell.h delete mode 100644 widgets/e-table/e-table-col-dnd.h delete mode 100644 widgets/e-table/e-table-col.c delete mode 100644 widgets/e-table/e-table-col.h delete mode 100644 widgets/e-table/e-table-column-item.c delete mode 100644 widgets/e-table/e-table-column-item.h delete mode 100644 widgets/e-table/e-table-column-model.h delete mode 100644 widgets/e-table/e-table-column.c delete mode 100644 widgets/e-table/e-table-group-container.c delete mode 100644 widgets/e-table/e-table-group-container.h delete mode 100644 widgets/e-table/e-table-group-leaf.c delete mode 100644 widgets/e-table/e-table-group-leaf.h delete mode 100644 widgets/e-table/e-table-group.c delete mode 100644 widgets/e-table/e-table-group.h delete mode 100644 widgets/e-table/e-table-header-item.c delete mode 100644 widgets/e-table/e-table-header-item.h delete mode 100644 widgets/e-table/e-table-header.c delete mode 100644 widgets/e-table/e-table-header.h delete mode 100644 widgets/e-table/e-table-item.c delete mode 100644 widgets/e-table/e-table-item.h delete mode 100644 widgets/e-table/e-table-model.c delete mode 100644 widgets/e-table/e-table-model.h delete mode 100644 widgets/e-table/e-table-render.c delete mode 100644 widgets/e-table/e-table-render.h delete mode 100644 widgets/e-table/e-table-simple.c delete mode 100644 widgets/e-table/e-table-simple.h delete mode 100644 widgets/e-table/e-table-sorted-variable.c delete mode 100644 widgets/e-table/e-table-sorted-variable.h delete mode 100644 widgets/e-table/e-table-sorted.c delete mode 100644 widgets/e-table/e-table-sorted.h delete mode 100644 widgets/e-table/e-table-subset-variable.c delete mode 100644 widgets/e-table/e-table-subset-variable.h delete mode 100644 widgets/e-table/e-table-subset.c delete mode 100644 widgets/e-table/e-table-subset.h delete mode 100644 widgets/e-table/e-table-tree.h delete mode 100644 widgets/e-table/e-table.c delete mode 100644 widgets/e-table/e-table.h delete mode 100644 widgets/e-table/image1.png delete mode 100644 widgets/e-table/image2.png delete mode 100644 widgets/e-table/image3.png delete mode 100644 widgets/e-table/remove-col.xpm delete mode 100644 widgets/e-table/sample.table delete mode 100644 widgets/e-table/table-test.c delete mode 100644 widgets/e-table/table-test.h delete mode 100644 widgets/e-table/test-check.c delete mode 100644 widgets/e-table/test-cols.c delete mode 100644 widgets/e-table/test-table.c delete mode 100644 widgets/e-table/test.c delete mode 100644 widgets/e-text/.cvsignore delete mode 100644 widgets/e-text/Makefile.am delete mode 100644 widgets/e-text/e-text-event-processor-emacs-like.c delete mode 100644 widgets/e-text/e-text-event-processor-emacs-like.h delete mode 100644 widgets/e-text/e-text-event-processor-types.h delete mode 100644 widgets/e-text/e-text-event-processor.c delete mode 100644 widgets/e-text/e-text-event-processor.h delete mode 100644 widgets/e-text/e-text-test.c delete mode 100644 widgets/e-text/e-text.c delete mode 100644 widgets/e-text/e-text.h delete mode 100644 widgets/meeting-time-sel/.cvsignore delete mode 100644 widgets/meeting-time-sel/LICENSE delete mode 100644 widgets/meeting-time-sel/Makefile.am delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel-item.c delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel-item.h delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel-list-item.c delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel-list-item.h delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel-mail.xpm delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel-no-mail.xpm delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel.c delete mode 100644 widgets/meeting-time-sel/e-meeting-time-sel.h delete mode 100644 widgets/meeting-time-sel/test-meeting-time-sel.c delete mode 100644 widgets/misc/e-canvas-utils.c delete mode 100644 widgets/misc/e-canvas-utils.h delete mode 100644 widgets/misc/e-canvas.c delete mode 100644 widgets/misc/e-canvas.h delete mode 100644 widgets/misc/e-colors.c delete mode 100644 widgets/misc/e-colors.h delete mode 100644 widgets/misc/e-cursors.c delete mode 100644 widgets/misc/e-cursors.h delete mode 100644 widgets/misc/e-gui-utils.c delete mode 100644 widgets/misc/e-gui-utils.h delete mode 100644 widgets/misc/e-reflow.c delete mode 100644 widgets/misc/e-reflow.h delete mode 100644 widgets/misc/pixmaps/cursor_cross.xpm delete mode 100644 widgets/misc/pixmaps/cursor_hand_closed.xpm delete mode 100644 widgets/misc/pixmaps/cursor_hand_open.xpm delete mode 100644 widgets/misc/pixmaps/cursor_zoom_in.xpm delete mode 100644 widgets/misc/pixmaps/cursor_zoom_out.xpm delete mode 100644 widgets/shortcut-bar/.cvsignore delete mode 100644 widgets/shortcut-bar/LICENSE delete mode 100644 widgets/shortcut-bar/Makefile.am delete mode 100644 widgets/shortcut-bar/e-clipped-label.c delete mode 100644 widgets/shortcut-bar/e-clipped-label.h delete mode 100644 widgets/shortcut-bar/e-group-bar.c delete mode 100644 widgets/shortcut-bar/e-group-bar.h delete mode 100644 widgets/shortcut-bar/e-icon-bar-bg-item.c delete mode 100644 widgets/shortcut-bar/e-icon-bar-bg-item.h delete mode 100644 widgets/shortcut-bar/e-icon-bar-text-item.c delete mode 100644 widgets/shortcut-bar/e-icon-bar-text-item.h delete mode 100644 widgets/shortcut-bar/e-icon-bar.c delete mode 100644 widgets/shortcut-bar/e-icon-bar.h delete mode 100644 widgets/shortcut-bar/e-shortcut-bar.c delete mode 100644 widgets/shortcut-bar/e-shortcut-bar.h delete mode 100644 widgets/shortcut-bar/e-vscrolled-bar.c delete mode 100644 widgets/shortcut-bar/e-vscrolled-bar.h delete mode 100644 widgets/shortcut-bar/test-shortcut-bar.c delete mode 100644 widgets/table/.cvsignore delete mode 100644 widgets/table/add-col.xpm delete mode 100644 widgets/table/check-empty.xpm delete mode 100644 widgets/table/check-filled.xpm delete mode 100644 widgets/table/clip.png delete mode 100644 widgets/table/e-cell-checkbox.c delete mode 100644 widgets/table/e-cell-checkbox.h delete mode 100644 widgets/table/e-cell-string.c delete mode 100644 widgets/table/e-cell-text.c delete mode 100644 widgets/table/e-cell-text.h delete mode 100644 widgets/table/e-cell-toggle.c delete mode 100644 widgets/table/e-cell-toggle.h delete mode 100644 widgets/table/e-cell.c delete mode 100644 widgets/table/e-cell.h delete mode 100644 widgets/table/e-table-col-dnd.h delete mode 100644 widgets/table/e-table-col.c delete mode 100644 widgets/table/e-table-col.h delete mode 100644 widgets/table/e-table-column-item.c delete mode 100644 widgets/table/e-table-column-item.h delete mode 100644 widgets/table/e-table-column-model.h delete mode 100644 widgets/table/e-table-column.c delete mode 100644 widgets/table/e-table-group-container.c delete mode 100644 widgets/table/e-table-group-container.h delete mode 100644 widgets/table/e-table-group-leaf.c delete mode 100644 widgets/table/e-table-group-leaf.h delete mode 100644 widgets/table/e-table-group.c delete mode 100644 widgets/table/e-table-group.h delete mode 100644 widgets/table/e-table-header-item.c delete mode 100644 widgets/table/e-table-header-item.h delete mode 100644 widgets/table/e-table-header.c delete mode 100644 widgets/table/e-table-header.h delete mode 100644 widgets/table/e-table-item.c delete mode 100644 widgets/table/e-table-item.h delete mode 100644 widgets/table/e-table-model.c delete mode 100644 widgets/table/e-table-model.h delete mode 100644 widgets/table/e-table-render.c delete mode 100644 widgets/table/e-table-render.h delete mode 100644 widgets/table/e-table-simple.c delete mode 100644 widgets/table/e-table-simple.h delete mode 100644 widgets/table/e-table-sorted-variable.c delete mode 100644 widgets/table/e-table-sorted-variable.h delete mode 100644 widgets/table/e-table-sorted.c delete mode 100644 widgets/table/e-table-sorted.h delete mode 100644 widgets/table/e-table-subset-variable.c delete mode 100644 widgets/table/e-table-subset-variable.h delete mode 100644 widgets/table/e-table-subset.c delete mode 100644 widgets/table/e-table-subset.h delete mode 100644 widgets/table/e-table-tree.h delete mode 100644 widgets/table/e-table.c delete mode 100644 widgets/table/e-table.h delete mode 100644 widgets/table/image1.png delete mode 100644 widgets/table/image2.png delete mode 100644 widgets/table/image3.png delete mode 100644 widgets/table/remove-col.xpm delete mode 100644 widgets/table/sample.table delete mode 100644 widgets/table/table-test.c delete mode 100644 widgets/table/table-test.h delete mode 100644 widgets/table/test-check.c delete mode 100644 widgets/table/test-cols.c delete mode 100644 widgets/table/test-table.c delete mode 100644 widgets/table/test.c delete mode 100644 widgets/text/.cvsignore delete mode 100644 widgets/text/e-text-event-processor-emacs-like.c delete mode 100644 widgets/text/e-text-event-processor-emacs-like.h delete mode 100644 widgets/text/e-text-event-processor-types.h delete mode 100644 widgets/text/e-text-event-processor.c delete mode 100644 widgets/text/e-text-event-processor.h delete mode 100644 widgets/text/e-text-test.c delete mode 100644 widgets/text/e-text.c delete mode 100644 widgets/text/e-text.h diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 2f7f5151f9..0000000000 --- a/.cvsignore +++ /dev/null @@ -1,21 +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 -ABOUT-NLS \ No newline at end of file diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 0e27a63de7..0000000000 --- a/AUTHORS +++ /dev/null @@ -1,32 +0,0 @@ -Evolution was written by: - -Bertrand Guiheneuf - Main author of Camel - -Chris Lahey (clahey@helixcode.com) - Mini-card display widget - Contact manager user interface - -Damon Chaplin - Meeting time selector widget - Shortcut Bar widget - -Ettore Perazzoli - Message composer - -Federico Mena - Gnome Calendar views, and engine - Gnome Calendar server - -Miguel de Icaza - Gnome Calendar engine - Base64 encoding in Camel - Evolution Shell - ETable widget - Toolbar - -Nat Friedman - EBook and Personal Address Book server. - -Robert Brady - 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. - - - Copyright (C) - - 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. - - , 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 787c042ea6..0000000000 --- a/ChangeLog +++ /dev/null @@ -1,3236 +0,0 @@ -2000-02-24 Christopher James Lahey - - * e-util/e-xml-utils.c, e-util/e-xml-utils.h: Added - e_xml_get_integer_prop_by_name. - - * e-util/Makefile.am: Added e-util.c. - - * e-util/e-util.h: Added e-util.c functions. - - * e-util/e-util.c: New file for compare functions - -2000-02-24 Dan Winship - - * acconfig.h: - * configure.in: define SENDMAIL_PATH with the path to sendmail. - -2000-02-24 Christopher James Lahey - - * widgets/e-text.c, widgets/e-text.h, e-text-event-processor.c, - e-text-event-processor.h, e-text-event-processor-emacs-like.c, - e-text-event-processor-emacs-like.h, - e-text-event-processor-types.h: This were moved to widgets/e-text/ - a while ago but never removed. They have now been removed. - - * widgets/e-text/e-text.c, widgets/e-text/e-text.h: Removed some - warnings from this file. Made tooltips disappear when you're - finished with them. - - * widgets/e-minicard/test-reflow.c, - widgets/e-minicard/test-minicard.c, - widgets/e-minicard/test-minicard-label.c: Commented out unused - about_callback functions. - - * widgets/e-minicard/e-reflow.c: Made e-reflow pass an EFocus to - its e-minicard children. - - * widgets/e-minicard/e-minicard.c: Made e-minicard take and return - an EFocus for its "has_focus" argument. This makes shift-tab work properly. - - * widgets/e-minicard/e-minicard-label.c: Made e-minicard-label take and return - an EFocus for its "has_focus" argument. Made the font that - e-minicard-label uses only be allocated once. - - * e-util/e-canvas-utils.h: Fixed the comment at the top and added - #ifndef __E_CANVAS_UTILS__. - - * e-util/Makefile.am: Added e-xml-utils.c and - e-xml-utils.h. - - * e-util/e-xml-utils.h, e-util/e-xml-utils.c: Added files for some - xml utilities. - - * e-util/e-util.h: Added type EFocus which describes which - direction the focus will be coming from. - -2000-02-23 Dan Winship - - * e-util/e-setup.c (e_setup_base_dir): Make ~/evolution mode 700 - rather than mode 600 (and use the symbolic name rather than the - number). - -2000-02-22 bertrand - - * shell/Makefile.am (evolution_LDADD): - add libetext.a. - -2000-02-21 Matt Loper - - * tests/ui-tests/message-browser.c (on_link_clicked): stop - sscanf() abuse. - - * tests/Makefile.am: changed references to libibex.a to - libibex.la. - - * libical/src/libical/.cvsignore: Added *.lo, *.la, and .libs. - * libical/src/libicalss/.cvsignore: same. - - * tests/.cvsignore: Added test11. - - * libical/Makefile.in: autogenerated file removed from cvs, and - added to .cvsignore. - * libical/src/Makefile.in: same. - * libical/src/libical/Makefile.in: same. - * libical/src/libicalss/Makefile.in: same. - -2000-02-22 bertrand - - * tests/ui-tests/message-browser.c (on_link_clicked): - uggly hack to test part saving and - b64 streams. - -2000-02-21 Dan Winship - - * tests/test10.c: - * tests/test11.c: update for camel changes - -2000-02-20 Matt Loper - - * tests/Makefile.am: Changed dependencies on libibex.la to - libibex.a. In test9_LDADD, placed libcamelmbox.la before - libibex.la, as the former requires the latter. - -2000-02-20 Damon Chaplin - - * widgets/shortcut-bar/Makefile.am: added libetext.a and libeutil.a - to test_shortcut_bar_LDADD, and got rid of e-icon-bar-text-item.[hc]. - I'll delete these soon. - - * widgets/shortcut-bar/e-icon-bar.c: changed to be a subclass of - ECanvas and to use EText instead of EIconBarTextItem. Also set - "width_set" & "height_set" of the GnomeCanvasPixbuf items so they - work in the "Small Icon" view. - - * widgets/shortcut-bar/e-vscrolled-bar.c: use map/unmap instead of - show/hide for the up & down buttons to avoid queueing resizes. - Otherwise the scrolling starts off a bit jerky. - - * widgets/shortcut-bar/test-shortcut-bar.c: output a message when the - main label is resized, just for info. - - * widgets/shortcut-bar/*.[hc]: updated my email address. - -2000-02-20 Iain Holmes - - * widgets/e-text/e-text.[ch] (_do_tooltip): Show the text of the item, - in a tooltip style. - (e_text_event): Add a timeout on the Enter and remove it on the Leave - events. - - * e-text-test.c: New file to test e-text items. - -2000-02-20 Matt Loper - - * .cvsignore: added ABOUT-NLS. - * ABOUT-NLS: removed. - -2000-02-19 Matt Loper - - * tests/ui-tests/message-browser.c (on_link_clicked): When a link - is clicked, indicate the link with a dialog. - - * libical/src/test/.cvsignore: Added Makefile. - - * libical/.cvsignore: Added Makefile, configure, config.status. - - * libical/src/.cvsignore: New file. - - * libical/Makefile: autogenerated file removed from cvs. - * libical/configure: same. - * libical/config.status: same. - * libical/src/Makefile: same. - * libical/src/test/Makefile: same. - - * widgets/e-minicard/.cvsignore: Added minicard-label-test, - minicard-test, and reflow-test. - - * shell/.cvsignore: added files autogenerated from Evolution.idl. - - * libversit/.cvsignore: Added .libs, vcc.c, vcc.lo, vobject.lo, - vcaltmp.lo, libversit.la - - * libical/src/test/.cvsignore: New file. - - * libical/src/libical/.cvsignore: New file. - - * libical/src/libicalss/.cvsignore: New file. - - * libical/.cvsignore: New file, with config.log in it. - - * tests/ui-tests/message-browser.c: minor cleanup. - - * tests/ui-tests/.cvsignore: added message-browser. - -2000-02-18 NotZed - - * tests/test11.c (main): Use a relative path to the mbox provider - module. - -2000-02-18 Matt Loper - - * tests/ui-tests/message-browser.c (filename_to_camel_msg): Call - camel_data_wrapper_set_input_stream, rather than - camel_data_wrapper_construct_from_stream. For the whole message, - allow someone to see the header ("to", "from", etc.). Clicking on - tree items to see their elements, now works also. - -2000-02-18 Miguel de Icaza - - * configure.in: Make gnomeui the last library on the command line, - as its path is the one most likely to hold other old libraries - (libxml) and we need newer versions. - - (BONOBO_VFS_GNOME_CFLAGS): Add libical to the - AC_CONFIG_SUBDIRS - - (BONOBO_HTML_GNOME_CFLAGS): VFS checking needs to - go before we rquery them. - - Use the new method for gnome-print - checking instead of the old crufty gtk+ based one that nobody can - debug. ever. - -2000-02-16 Matt Loper - - * tests/ui-tests/message-browser.c (tree_selection_changed): New - callback function, which will later change the main html window to - reflect the newly-selected tree item. - (get_gtk_html_contents_window): New function. Gets the content - part of a message. - (get_gtk_html_header_window): New function. Will get the header - part of a message, when applicable. - - * camel/camel-formatter.c (str_tolower): Now returns a new string, - rather than changing it in place. - (initialize_camel_formatter): New function; gives a root - CamelDataWrapper and a stream to a CamelFormatter. - (camel_formatter_wrapper_to_html): New function. Translates any - CamelDataWrapper into html. - (lookup_unique_id): Allows the root object to be a - CamelDataWrapper, which is more general than the previously - required CamelMimeMessage. - - -2000-02-14 NotZed - - * configure.in (EXTRA_GNOME_CFLAGS): Add libunicode to CFLAGS/LIBS. - -2000-02-13 NotZed - - * configure.in: Added check for libunicode. - - * Makefile.am (SUBDIRS): Added libibex. - - * tests/test11.c (main): New test, tests search api. - -2000-02-13 Matt Loper - - * tests/ui-tests/test-multipart-mixed.msg: New rfc822 file, which - crashes message-browser. - - * tests/ui-tests/message-browser.c (get_gtk_html_window): Takes a - CamelMimeMessage as a param, rather than a filename. - (main): Puts our windows in an hpane rather than a vbox. Also - opens a file dlg box if a filename wasn't given as a first param. - - * camel/camel-stream-fs.c (_init_with_name): Set stream_fs->fd to - -1 if we fail to load the file. - (camel_stream_fs_new_with_name): If stream_fs->fd is -1, return - NULL. These changes make it so that a CamelStreamFs won't be - created if you give it a bogus filename; they may be replaced once - exception handling is in place. - - * tests/ui-tests/message-browser.c (handle_tree_item): Expand tree - items. - (mime_message_to_html): New function; translates a - CamelMimeMessage into two strings (one for the header, and one for - the body). - (get_gtk_html_window): New function; fills out a window with - html. The html is taken from a processed rfc822 file, via a - CamelFormatter. - - * camel/camel-formatter.c: Added assertions. - (handle_text_html): Don't call text_to_html on something that's - already html. - (multipart_foreach): function deleted. - - * tests/ui-tests/message-browser.c: Added preliminary support for - the viewing of messages via gtkhtml. Lots of commenting. - -2000-02-11 Christopher James Lahey - - * addressbook/contact-editor/e-contact-editor.c: Fixed the - location the first time you see the drop down menus for changing - which phone, email, or snail mail address you see. - -2000-02-11 Christopher James Lahey - - * widgets/e-text/e-text.c (e_text_event): Made a click on a text - widget set the cursor properly. - -2000-02-11 Christopher James Lahey - - * widgets/e-text/e-text.h: Removed some arguments from the .h that - will never be implemented. - - -2000-02-10 bertrand - - * camel/data-wrapper-repository.c (data_wrapper_repository_init): - default the text/* mime types to CamelSimpleDataWrapper so - that Michael can use get_stream. - -2000-02-10 NotZed - - * camel/camel-simple-data-wrapper-stream.h: The superclass is - actually a seekable stream, not just a stream. - -2000-02-10 bertrand - - * tests/Makefile.am (THREAD_RELATED_TESTS): don't - build thread related tests if evolution has been - compiled with no thread support. - - * configure.in (have_pthread): allow user to enable/disable - thread support at configure time - (EXTRA_GNOME_CFLAGS): - (EXTRA_GNOME_LIBS): thread support is directly - included in this variable if enabled. No more - EXTRA_GNOME_CFLAGS_THREADS - Other special support should be added in - EXTRA_GNOME_LIBS and EXTRA_GNOME_CFLAGS - instead of redefining a new variable - each time we want to add a new lib. - (bonobo, ....) - - * camel/camel.c (camel_init): only try to initialize threads if - we enabled threads support. - - * tests/ui-tests/Makefile.am (message_browser_LDADD): use - EXTRA_GNOME_LIBS - - * configure.in (have_pthread): remove HAVE_PTHREADS - variable. Define ENABLE_THREADS instead. - - * camel/Makefile.am: use ENABLE_THREADS not HAVE_PTHREADS - to test if we build thread relateed code. - - * tests/Makefile.am: use EXTRA_GNOME_LIBS, - not EXTRA_GNOME_LIBS_THREADS - -2000-02-10 NotZed - - * camel/hash-table-utils.c (g_strcase_hash): Removed a bizarre - comparison construct for converting case. - -2000-02-09 NotZed - - * camel/data-wrapper-repository.c (data_wrapper_repository_init): - Uses case-insensitive compares. - - * camel/gmime-content-field.c (gmime_content_field_new): Uses - case-insensitive compares. - - * camel/data-wrapper-repository.c (data_wrapper_repository_init): - Use case-insensitive mime types. - - * camel/camel-simple-data-wrapper-stream.c (read): Increment the - copy source address to match the data read offset. - (seek): Actually implement the seek. - - * camel/camel-mime-part-utils.c - (camel_mime_part_store_stream_in_buffer): If we get a -1 read, - DONT update the total bytes, and try and truncate the array in - reverse. Eek. - - * camel/camel-mime-part.c (camel_mime_part_encoding_from_string): - This was DEFINETLEY not the right way to do it. strncmp!=strcmp - (camel_mime_part_encoding_to_string): Handle the default case. - : include string.h for strcmp() etc. - -2000-02-09 Matt Loper - - * tests/ui-tests/test-multipart-alt.msg: New test file; run - message-browser on it, and it will crash. - -2000-02-09 bertrand - - * tests/ui-tests/message-browser.c (handle_tree_item): - show the item. - (handle_tree_item): show the containers and the containees - (get_message_tree_ctrl): call handle_tree_item - on the message itself - - * camel/camel-mime-message.c (camel_mime_message_init): - set the mime type to "mime/message". - --- THIS IS NOT THE CONTENT TYPE --- - - * camel/camel-mime-body-part.c (camel_mime_body_part_init): - set the mime type to "body-part". - --- THIS IS NOT THE CONTENT TYPE --- - - * camel/camel-data-wrapper.c (camel_data_wrapper_set_mime_type): - mime_type is const. - (_set_input_stream): really set the input stream - (_set_output_stream): really set the output stream - various other typo fixes. - - * tests/ui-tests/message-browser.c: various typo - fixes in the ctree construction. - - * camel/string-utils.c (string_trim): fix braindead - trailing trim bug. - - * camel/gmime-content-field.c (gmime_content_field_construct_from_string): - strip the leading and trailing quotes when constructing the - content field. This should be done in a more generic - RFC822 approach, but this fixes a bug that prevent - matt from analysing some multipart messages. - - * camel/camel-data-wrapper.h: reorganize the - deprecated and new methods. - - * camel/providers/mbox/camel-mbox-folder.c - (_check_get_or_maybe_generate_summary_file): - Use "From " as the message separating string. - - * camel/providers/mbox/camel-mbox-folder.c (_append_message): - set the mode when creating the mbox file. - - * camel/providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev): - ditto - * camel/providers/mbox/camel-mbox-summary.c (camel_mbox_save_summary): - ditto - -2000-02-09 Matt Loper - - * tests/ui-tests/message-browser.c (print_usage_and_quit): Minor - cleanup. - -2000-02-09 NotZed - - * camel/camel-simple-data-wrapper-stream.c (class_init): Actually - initialise the class. It simple couldn't have worked before. - (camel_simple_data_wrapper_stream_construct): Commented out code - which crashes just to get something working, memory corruption?? - -2000-02-09 Christopher James Lahey - - * configure.in: Add new Makefiles to Makefile list. - - * e-util/Makefile.am: Add canvas utilities to libeutil. - - * widgets/e-text/Makefile.am: Build libetext. - - * widgets/e-minicard/Makefile.am: Build libeminicard and test - programs. - - * widgets/Makefile.am: Remove all e-text and e-minicard code and - add them to the SUBDIRS list. - -2000-02-08 Matt Loper - - * tests/ui-tests/message-browser.c: New file; shows a message in - tree format, where multipart's have multiple leaves. - - * camel/camel-formatter.c: Changed references from - 'multipart/alternate' to 'multipart/alternative'. - - * tests/test-formatter.c (convert_to_html_and_print): Use the - buffer length of the stream to create strings which are then - printed, rather than printing the stream (which might not have a - trailing \0) directly. - - * camel/camel-formatter.c (str_tolower): New function; makes a - string lowercase. - - * tests/test-formatter.c (convert_to_html_and_print): Fixed call - to 'camel_formatter_mime_message_to_html' to contain correct - params. - - * camel/camel-formatter.c: New member to 'CamelFormatterPrivate', - 'attachments', will be used to let the caller know which items - should be treated as attachments (as opposed to objects which are - inline to the body). - (text_to_html): name changed from 'encode_entities'. Also now - converts newlines to
tags. - (camel_formatter_mime_message_to_html): Now takes two output - streams -- one for the header, and one for the body. - (get_bonobo_tag_for_object): New function; tries to make a tag out - of (1) the leaf of a mime message and (2) a bonobo object that can - handle its mime type, but can return NULL if it fails to find the - mime type. - (handle_vcard): New function; will write out a vcard as html. - -2000-02-08 Iain Holmes - - * shell/Makefile.am: Changed the order of the compilation, so the CORBA - stuff was generated before it was needed. - -2000-02-07 Christopher James Lahey - - * widgets/e-text.h, widgets/e-text.c: Added line wrap and a max - number of lines (max number of lines is only obeyed if text is not - being edited). - -2000-02-07 Christopher James Lahey - - * addressbook/printing/e-contact-print.c: Removed an unneccessary - include of libhnj. All uses of libhnj are commented out. - -2000-02-07 Matt Loper - - * camel/camel-formatter.c (mime_part_to_html): function deleted. - - * tests/test-formatter.c (print_usage_and_quit): New function, - which gives usage information. - - * camel/camel-formatter.c: made the 'stream' a member of the - CamelFormatter class, so that streams don't have to be explicitly - sent as a param where a CamelFormatter is also sent.. - (handle_text_plain): Use 'encode_entities' to change '<' to - '>', etc. - -2000-02-07 Damon Chaplin - - * widgets/shortcut-bar/e-group-bar.c (e_group_bar_draw): finished. - - * widgets/shortcut-bar/e-icon-bar.c (e_icon_bar_item_released): - check that an item was pressed. - -2000-02-03 bertrand - - * camel/camel-formatter.c (find_preferred_displayable_body_part_in_multipart_alternative): - (mime_part_to_html): typo fix : - use find_preferred_displayable_body_part_in_multipart_alternative - instead of the other names. Allows camel to have no undefined symbols. - -2000-02-02 Matt Loper - - * tests/test-formatter.c: New file; intended to test the - CamelFormatter class. - - * camel/camel-formatter.c: Lots of cleanup, commenting, some new - functions, and a really basic skeleton for getting bonobo objects - into the html. - (encode_entities): New function, stolen from Daniel Velliard. - -2000-01-28 Christopher James Lahey - - * addressbook/printing/e-contact-print-style-editor.h, - addressbook/printing/e-contact-print-style-editor.c, - addressbook/printing/test-contact-print-style-editor.c: Files to - load the contact print style editor from the glade file. Doesn't - really do anything yet. - - * addressbook/printing/Makefile.am: Added style editor stuff. - - * addressbook/printing/e-contact-print.glade: Changed a bit. - Fixed an out of place widget. - - * addressbook/printing/.cvsignore: Added - contact-print-style-editor-test. - - * addressbook/printing/smallbook.ecps: Fixed up the values to - match the new types. - - * addressbook/printing/medbook.ecps, - addressbook/printing/phonelist.ecps: Added two new printing - styles. - - * addressbook/printing/e-contact-print.h: Fixed an incorrect - comment. - - * addressbook/printing/e-contact-print.c: Added columns and letter - tabs. Tweaked spacing all over the place. Fixed card height - function so that column wrapping is always done correctly. Added - pulling of style information from a file. Added line wrapping - within each text field. - - * addressbook/printing/e-contact-print-types.h: Added a type field - for different types of print styles. - - -2000-01-28 Christopher James Lahey - - * widgets/e-text.c (e_text_command): Handle the grab and ungrab - command instead of doing focus by hand. This fixes a problem - related to the scroll wheel. - (e_text_command): Reset the blink timer in many more command - situations so that the cursor blinks less when you're interacting - with it. - - * widgets/e-text-event-processor-emacs-like.c: Send the grab focus - command when starting a selection and the ungrab focus command - when ending it. - - * widgets/e-text-event-processor-types.h: Added grab command type - so that the event processor can tell the widget to grab the focus. - - * widgets/e-reflow.c: Redefined all sizes using #defines so that - they can be tweaked later. Added scroll wheel handling and set up - adjustment increments so that the scroll bars will work correctly. - - * widgets/e-minicard.h: Added minicard focus type enum. This - doesn't mean anything yet, but it will later be used to say which - direction the focus is coming from (below for shift-tab, above for - tab.) - -2000-01-28 Christopher James Lahey - - * widgets/e-minicard-label.c, widgets/e-minicard.c: Use - e_canvas_item_grab_focus so that it will work with old versions of - gnome-canvas. - - * widgets/e-canvas.c, widgets/e-canvas.h: Finished working around - focus bugs. - -2000-01-28 Christopher James Lahey - - * widgets/test-reflow.c: Set the minimum_width. - - * widgets/e-reflow.h, widgets/e-reflow.c: Added one more column - line so that the right edge of the reflow will have a line. Also - added a minimum_width so that even if the reflow is thinner than - the window, when you resize it larger all the lines are drawn. - -2000-01-27 Christopher James Lahey - - * widgets/e-reflow.h, widgets/e-reflow.c: Added an arrow cursor - for the draggable columns. Made the clickable column area - larger. - - * widgets/e-text.h, widgets/e-text.c: Added an I beam cursor for - the text item when it is editable. - - * widgets/e-minicard-label.c: Forward enter and leave - notifications to the contained editable text item. - -2000-01-26 Matt Loper - - * camel/camel-formatter.c: By looking up a mimetype in a - hashtable, we can now get a handler function for an arbitrary - mimetype. - -2000-01-26 bertrand - - * widgets/shortcut-bar/e-icon-bar.c (e_icon_bar_recalc_item_positions): - don't set the x_set and y_set - arguments as don't exist in gdk-pixbuf - anymore. - -2000-01-25 Mathieu Lacage - - * .cvsignore s: cvs shutup. - -2000-01-25 Christopher James Lahey - - * widgets/e-reflow.c, widgets/e-minicard.c: Handle shift-tab - properly now. - - * widgets/e-minicard-label.c: Reindented some areas. - - * widgets/test-reflow.c: Use e-canvas. Set the back pixmap to - NULL for the canvas so that scrolling won't flash grey. - - * widgets/e-canvas.c, widgets/e-canvas.h: These subclass - GnomeCanvas to work around a few bugs so that evolution will work - well with old versions of gnome-libs. - - * widgets/Makefile.am: Added e-canvas.c and e-canvas.h. - - * addressbook/contact-editor/contact-editor.glade: Not much - change. Mostly internal reorganization by glade itself. - -2000-01-25 Christopher James Lahey - - * addressbook/printing/smallbook.ecps: Example contact printing - style. Not used yet. - - * addressbook/printing/e-contact-print.glade: A glade file for - editing contact printing styles. Not used yet. - - * addressbook/printing/test-print.c: Test file for printing. - - * addressbook/printing/e-contact-print.c, - addressbook/printing/e-contact-print.h, - addressbook/printing/e-contact-print-types.h, - addressbook/printing/Makefile.am, addressbook/printing/.cvsignore: - New files for contact printing support. - - * addressbook/Makefile.am (SUBDIRS): Add printing. - - * configure.in: Check for gnome-print. Build the - addressbook/printing Makefile. - -2000-01-24 bertrand - - * camel/camel-data-wrapper.h: - * camel/camel-data-wrapper.c - (_set_input_stream): - (_get_input_stream): - (_set_output_stream): - (_get_output_stream): - The CamelDataWrapper can now be provided with input and - output streams, so that nothing has to be kept in memory. - - * camel/camel-stream.c (camel_stream_class_init): - added the "data_available" signal. - - -2000-01-24 Federico Mena Quintero - - * configure.in: Added the gnome-pilot and capplet checks; they - will likely be reworked for the Evolution framework, but for now - the calendar/ directory needs them. - - * configure.in: Added checks for gnome-vfs. - -2000-01-24 bertrand - - * camel/camel-seekable-stream.c: - * camel/camel-seekable-stream.h: - new files. - - * camel/camel-simple-data-wrapper-stream.h: parent class is now - CamelSeekableStream - * camel/camel-stream-buffered-fs.h: idem - * camel/camel-stream-buffered-fs.c: idem - * camel/camel-stream-mem.h: idem - * camel/camel-stream-mem.c: idem - (_seek): change declaration - * camel/camel-stream-fs.c: parent class is now - CamelSeekableStream - (_seek): change declaration - - * camel/camel-stream-fs.h: parent class is now - CamelSeekableStream - - * camel/camel-stream-fs.[ch]: converted all - gint64 variables into guint32. - - - * camel/camel-stream-fs.c (_read): fix stupid bug. - (_write): ditto. - - * camel/camel-exception.c (camel_exception_new): don't - forget to clean the exception when creating it. - - * camel/camel-recipient.c (camel_recipient_table_add_list): - add recipient_list to the recipients, not recipients_list. - I don't know what that variable was doing here. - - -2000-01-24 Matt Loper - - * camel/camel-formatter.c (write_header_info_to_stream): new - function, broken out from 'camel_formatter_make_html'. - (write_mimepart_to_stream): same. - (find_text_body_part_in_multipart_related): new function. - (camel_formatter_make_html): Now tries to deal with - multipart/related, multipart/alternate, and text/(plain|html). - - -2000-01-23 bertrand - - * camel/camel-store.c (camel_store_get_session): - added a public get_session method. - - * camel/providers/mbox/camel-mbox-summary.c (camel_mbox_save_summary): - (camel_mbox_load_summary): load/save message sizes in the summary file - - * camel/providers/mbox/camel-mbox-summary.h: - added a size field to the message information - structure. - - * camel/providers/mbox/camel-mbox-utils.c (parsed_information_to_mbox_summary): - copy message size to the mbox summary information too. - - * camel/camel-stream-fs.c (_seek): updated to - work with bounded fs streams. - (_write): ditto. - (_read): ditto. - - * camel/camel-stream-fs.h (struct ): - added the cur_pos, inf_bound and sup_bound - members to allow for bounded fs stream. - - * camel/camel-stream-fs.c (_set_bounds): new func. - (_init_with_fd_and_bounds): idem. - (_init_with_name_and_bounds): idem. - New functions to allow the usage of bounded fs streams. - - The bounded fs stream allow, for example, to make a stream - from a message stored in an mbox file. - - -2000-01-22 bertrand - - * camel/providers/mbox/camel-mbox-folder.c (_check_get_or_maybe_generate_summary_file): - use the real summary file path instead of a - stupid hardcoded one. Fixes yet another bug. - - * camel/providers/mbox/camel-mbox-utils.c (parsed_information_to_mbox_summary): - don't forget to copy the date too. Fix a very annoying bug. - - * camel/providers/mbox/camel-mbox-folder.c (_append_message): - implemented. A lot of fixes too. Works now. - (_get_uid_list): implemented. - -2000-01-21 bertrand - - * tests/test10.c: - test the mbox provider. - - * camel/camel-folder.c (_set_name): - if camel_folder_get_mode returns an - exception, return it instead of - overriding it with a new one. - (camel_folder_is_open): make the is_open - method public. - (_set_name): use the is_open instead of - get_mode. - (_set_name): set the fullname even in the case - where the folder has no parent. - (_set_name): use %c, not %d to add the - separator char into the full path. - - * camel/camel-store.c: add exception handling everywhere in - the store related functions arguments. - * camel/providers/mbox/camel-mbox-folder.c: idem - * camel/providers/mbox/camel-mbox-folder.h: idem - * camel/providers/mbox/camel-mbox-store.h: idem - - * camel/providers/mbox/Makefile.am (libcamelmbox_la_SOURCES): - added camel-mbox-provider.c to the mbox provider - sources. - - * camel/providers/mbox/camel-mbox-provider.c: - provider registration code. - - * camel/providers/mbox/camel-mbox-folder.c (_get_message_count): implemented - (_append_message): implemented - - * camel/providers/mbox/camel-mbox-parser.c (initialize_buffer): - use \0 to mark the end of the buffer. - (read_next_buffer_chunk): ditto. - (read_header): test the presence of a \0 instead of - reading the eof field - (read_message_begining): idem. - (camel_mbox_parse_file): idem. - Remove the eof field from the parser - structure. - (read_next_buffer_chunk): removed some nasty bugs - again. - - -2000-01-21 Federico Mena Quintero - - * libversit/vcc.y: Removed the VFS crap; my mistake, it should not - go here. - - * configure.in: Added yacc requirements for libversit. - -2000-01-21 Matt Loper - - * camel/camel-formatter.c (camel_formatter_make_html): added a - CamelMimeMessage as a param to this function, and removed it as a - member of the object. - -2000-01-21 Federico Mena Quintero - - * configure.in (AC_OUTPUT): Added libversit/Makefile and - calendar/Makefile. - - * Makefile.am (SUBDIRS): Added libversit and calendar. - -2000-01-20 bertrand - - * camel/providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): - compute and return the file size. - - -2000-01-20 Matt Loper - - * camel/camel-formatter.c, camel/camel-formatter.h: New - files. You'll be able to use a CamelFormatter to get - html-formatted versions of a CamelMimeMessage. - -2000-01-20 Christopher James Lahey - - * widgets/e-text-event-processor-types.h: Changed some line - spacing. - - * widgets/test-reflow.c: Connected to the resize signal of the - reflow. - - * widgets/e-minicard.c: Made width argument set function only - update if width is different. - - * widgets/e-reflow.h, widgets/e-reflow.c: Added draggable column dividers. - - * addressbook/contact-editor/test-editor.c: Open two dialogs for - more interesting testing. - - * addressbook/contact-editor/e-contact-editor.h, - addressbook/contact-editor/e-contact-editor.c: Modified to use - glade. Added menus to change which phone/address/email entries to - view. Added images to the dialog. - - * addressbook/contact-editor/e-contact-editor-strings.h, - addressbook/contact-editor/contact-editor.glade: Glade files for - the contact editor dialog. - - * addressbook/contact-editor/Makefile.am: Added images and added - glade stuff. - - * addressbook/contact-editor/arrow.png, - addressbook/contact-editor/briefcase.png, - addressbook/contact-editor/netfreebusy.png, - addressbook/contact-editor/netmeeting.png: Image files for the - contact editor dialog. - -2000-01-19 bertrand - - * camel/providers/mbox/camel-mbox-folder.c (_get_message_count): - implemented. - - * camel/providers/mbox/camel-mbox-summary.c (camel_mbox_save_summary): - (camel_mbox_load_summary): save/load the next uid. - - * camel/providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): - Compute the next available uid. - * camel/providers/mbox/camel-mbox-folder.c (_create): - (_check_get_or_maybe_generate_summary_file): - Set and use the next_uid field properly. - * camel/providers/mbox/camel-mbox-summary.h: added - an extra field to store the next available uid. - - * camel/providers/mbox/camel-mbox-folder.c - (_check_get_or_maybe_generate_summary_file): - routine called when the folder is opened. - Reads or creates the summary file. - (_create): initialize the internal summary - structure. - (_close): save the summary file on closing. - (_init_with_store): initialize mbox specific - folder members. - -2000-01-18 bertrand - - * tests/test9.c: - tests for summary and parsing process of mbox files. - - * camel/providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): do - not use case insensitive comp to detect message separators. Kill - some nasty bugs in netscape file parsing, - - * camel/providers/mbox/camel-mbox-utils.c (parsed_information_to_mbox_summary): - don't use g_array_append but write directly inside the - array data instead. Better performance and bug fix. - - * camel/providers/mbox/camel-mbox-summary.c (camel_mbox_load_summary): - fix the name and bugs. - - * camel/camel-folder-summary.h: update the class - method definition to match the public defs. - - * camel/providers/mbox/camel-mbox-summary.c (camel_mbox_save_summary): - (mbox_load_summary): summary file read/write routines. - - * camel/providers/mbox/camel-mbox-utils.c (parsed_information_to_mbox_summary): - routine to construct the summary after the mbox - file has been parsed and the x-evolution fields - inserted. - -2000-01-17 bertrand - - * camel/providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev): - dont use the x_evolution field but rather the uid to - determine the presence of "X-Evolution" in the mail. - - * camel/providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): - parse the status and uid values if the x-evolution - has been found. - - * camel/providers/mbox/camel-mbox-utils.c (camel_mbox_xev_parse_header_content): - return the parsed status field correctly. - - * camel/providers/mbox/camel-mbox-utils.h: - fixed bad prototype. - - * camel/providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): - parse and store the "To:" header. - - * camel/providers/mbox/camel-mbox-parser.h: - added a "to" field - - * camel/camel-folder-summary.c: - create the arrays here. - - * camel/camel-folder-summary.h: the list of - summary information is no longer a GList but - rather a GArray. - -2000-01-17 Chrsitopher James Lahey - - * head.png, phone.png, email.png, web.png, snailmail.png: Images - for e-contact-editor.c. - - * addressbook/contact-editor/text-editor.c: Test program - for contact editor widget. - - * addressbook/contact-editor/e-contact-editor.c, - addressbook/contact-editor/e-contact-editor.h: Contact editor - widget files. - - * addressbook/contact-editor/.cvsignore, - addressbook/contact-editor/Makefile.am: New directory for contact - editor files. - - * addressbook/.cvsignore, addressbook/Makefile.am: New directory - for addressbook files. - - * widgets/.cvsignore: Added reflow-test. - - * Makefile.am (SUBDIRS): Added addressbook subdirectory. - - * configure.in, widgets/Makefile.am: Removed widgets/toolbar from - SUBDIRS since the lack of content was preventing it from - compiling. - - * widgets/shortcut-bar/Makefile.am: Added gnomecanvaspixbuf to the - list of libraries used. - - * widgets/e-text.c, widgets/e-text.h: Fixed a crashing bug. - -2000-01-17 bertrand - - * tests/test9.c (main): test for the mbox utils. - -2000-01-17 Federico Mena Quintero - - * configure.in: Add the gnomecanvaspixbuf argument to gnome-config - invocations. - -2000-01-17 bertrand - - * camel/providers/mbox/camel-mbox-utils.c (camel_mbox_write_xev): - (copy_file_chunk): - (camel_mbox_xev_write_header_content): - (string_to_flag): - (flag_to_string): - (string_to_uid): - (uid_to_string): - A bunch of new funcs to handle x-evolution - private header field. - (copy_file_chunk): fixed a nasty bug. - (camel_mbox_write_xev): create the copy file descriptor - with the proper arguments. Exceptions implememnted. - (camel_mbox_write_xev): changed the way bytes are counted. - No more uses the message size cause it did not take into - account the message separators characters. - (camel_mbox_write_xev): hopefully fixed the last bugs. - works ok now. - - -2000-01-15 bertrand - - * camel/providers/mbox/camel-mbox-parser.c - (camel_mbox_parse_file): - store the end of headers position. - - * camel/providers/mbox/camel-mbox-parser.h: - added the end_of_header_position to locate the - begining of the mail body. - - - * camel/providers/mbox/camel-mbox-utils.c (uid_to_string): - (string_to_uid): - (flag_to_string): - (string_to_flag): - new functions to handle uids and - flags in the X-Evolution header. - (camel_mbox_xev_parse_header_content): - new function to parse an X-Evolution - header. - (camel_mbox_xev_write_header_content): - new function to write the X-Evolution - header. - -2000-01-13 bertrand - - * camel/providers/mbox/camel-mbox-parser.c (read_next_buffer_chunk): - eof is true when no more chars are available, not - when we've read the entire file. - (initialize_buffer): ditto. - (read_message_begining): documented. - (read_header): ditto. - (new_message_detected): ditto. - (advance_n_chars): ditto. - (goto_next_char): ditto. - (read_next_buffer_chunk): ditto. - (initialize_buffer): ditto. - (parser_free): ditto. - (new_parser): ditto. - -2000-01-15 Miguel de Icaza - - * shell/e-shell.c: Construct the default folders - - * shell/e-shell-view.c (e_shell_view_new): Setup the main GnomeApp - application, load the shortcut, internal api. - - * shell/e-folder.c (e_folder_get_type_name): Return description - here; Change of policy; We now know about all of the possible - types that can be displayed on Evolution. - -2000-01-15 Miguel de Icaza - - * shell/e-folder.c: Renamed signal. - - * widgets/shortcut-bar/e-shortcut-bar.c (e_shortcut_bar_add_item): - Use e_bar_set_item_data. - - Drop item_url; Require image argument; Require user data - argument. - -2000-01-09 Miguel de Icaza - - * widgets/shortcut-bar/e-icon-bar.c (e_icon_bar_init): Turn on anti-aliasing. - -2000-01-08 Miguel de Icaza - - * widgets/shortcut-bar/e-icon-bar.c (e_icon_bar_add_item): Use - GdkPixbuf here. - (e_icon_bar_get_item_image): ditto and initialize image. - - * widgets/shortcut-bar/e-shortcut-bar.c (e_shortcut_bar_add_item): - Use gdk-pixbuf. - -2000-01-14 Christopher James Lahey - - * widgets/shortcut-bar/e-shortcut-bar.c (e_shortcut_bar_add_item): - Use e_bar_set_item_data. - - Drop item_url; Require image argument; Require user data - argument. - -2000-01-09 Miguel de Icaza - - * widgets/shortcut-bar/e-icon-bar.c (e_icon_bar_init): Turn on anti-aliasing. - -2000-01-08 Miguel de Icaza - - * widgets/shortcut-bar/e-icon-bar.c (e_icon_bar_add_item): Use - GdkPixbuf here. - (e_icon_bar_get_item_image): ditto and initialize image. - - * widgets/shortcut-bar/e-shortcut-bar.c (e_shortcut_bar_add_item): - Use gdk-pixbuf. - -2000-01-12 - - * widgets/e-text-event-processor-types.h, - widgets/e-text-event-processor-emacs-like.c, widgets/e-text.c, - widgets/e-text.h: Added selection and clipboard support. Added up - and down arrow keys. Fixed choice of font colors for the - selection to be based on the current style. - - * widgets/e-minicard.c: Caused a click to grab the focus. Changed - the fake information added. - - * widgets/e-minicard-label.c: Forward mouse events to the field - EText item. - -2000-01-13 Christopher James Lahey - - * widgets/e-canvas-utils.c, widgets/e-canvas-utils.h: - e_canvas_item_move_absolute is just a helper function not supplied - by the gnome_canvas.[ch] I put it here so that multiple items can - use it. - - * widgets/e-reflow.c, widgets/e-reflow.h: This item contains a - number of other items and places them into multiple columns. The - items contained must support a number of arguments and signals to - allow the reflow to interact with them. - - * widgets/test-reflow.c: This is a test program for e-reflow. - - * widgets/e-text.c, widgets/e-text.h: Added properly drawn - selected text. Added some preliminary code for X selection - handling and cut & paste. - - * widgets/e-minicard.c, widgets/e-minicard.h: Added ARG_HAS_FOCUS - handling. Made label display random for more interesting tests of - multiple cards. Tweaked sizing information for better display. - - * widgets/e-minicard-label.c, widgets/e-minicard-label.h: Added - ARG_HAS_FOCUS handling. - - * widgets/Makefile.am: Added the reflow test and reflow files. - -2000-01-12 bertrand - - * camel/providers/mbox/camel-mbox-parser.h (camel_mbox_parse_file): - Added the prototype of camel_mbox_parse_file. - - * camel/providers/mbox/camel-mbox-parser.c (camel_mbox_parse_file): - updated in-line documentation. - - * tests/Makefile.am (noinst_PROGRAMS): - remove non updated tests from the build - process. - - * corrected a bunch of bugs - - * camel/providers/mbox/camel-mbox-parser.c - (camel_mbox_parse_file): - parser the subject and date. - - - * camel/providers/mbox/camel-mbox-parser.c - (camel_mbox_parse_file): added the ability to - follow the parsing progression. - - * camel/providers/mbox/camel-mbox-parser.h: - parse the x-evolution field. - - * camel/Makefile.am (libcamel_la_SOURCES): - disabled gmime-rfc2047 as it depends on libunicode - and is not used for the moment. - -2000-01-12 Christopher James Lahey - - * widgets/e-minicard.c, widgets/e-minicard.h: Added a resize - signal for when the card changes height. Made it so that when you - press tab inside of a field, it goes to the next field. - - * widgets/e-minicard-label.c, widgets/e-minicard-label.h: Added a - resize signal for when the label changes height. - - * widgets/e-text.c, widgets/e-text.h: Added a resize signal for - multiple lines. Added scrolling based on cursor position. - - * widgets/Makefile.am: Removed an extraneous build target. - -2000-01-11 Christopher James Lahey - - * widgets/e-text-event-processor-emacs-like.c: Blocked the tab key - from getting inserted into the buffer since the renderer doesn't - know what a tab is. - - * widgets/e-text.c, widgets/e-text.h: Fixed a memory leak. Added - a blinking cursor and scrolling for the text item. - -2000-01-11 Christopher James Lahey - - * widgets/test-minicard.c: Removed some code which got in the way - of testing properly. - - * widgets/e-minicard-label.c (e_minicard_label_realize): Made the - field text item editable. - - * widgets/Makefile.am: Added e-text-event-process*.[ch]. - - * widgets/e-text.c, widgets/e-text.h: Changed these to support - editing. - - * widgets/e-text-event-processor.c, - widgets/e-text-event-processor.h, - widgets/e-text-event-processor-types.h, - widgets/e-text-event-processor-emacs-like.c, - widgets/e-text-event-processor-emacs-like.h: These are a new pair - of classes which handle all events from the text item and convert - them into commands. - - -2000-01-10 Christopher James Lahey - - * widgets/Makefile.am: Added minicard and text stuff. - - * widgets/e-minicard.c, widgets/e-minicard.h, - widgets/e-minicard-label.c, widgets/e-minicard-label.h: Added - canvas items for the minicard view in the contact manager. - - * widgets/test-minicard.c, widgets/test-minicard-label.c: Tests - for the minicard items. - - * widgets/e-text.h, widgets/e-text.c: New canvas item. Based on - GnomeCanvasText. Adds ellipsis capabilities. Used in - e-minicard*.[ch]. - - * widgets/.cvsignore: Added minicard-test and minicard-label-test. - -2000-01-06 Miguel de Icaza - - * configure.in: Add Bonobo detection, Bonobo flags for compilation - for the components and the shell. - -2000-01-06 Elliot Lee - * composer/Makefile.am, widgets/e-table/Makefile.am: Work with - builddir != srcdir - -2000-01-05 Miguel de Icaza - - * shell/Makefile.am: New file. - - * configure.in (EXTRA_GNOME_CFLAGS_THREADS, - EXTRA_GNOME_LIBS_THREADS): New variables that hold the thread - version of the compile/link lines. - -1999-11-20 Miguel de Icaza - - * configure.in (PACKAGE): Raise warning level. - -2000-01-04 bertrand - - * camel/providers/mbox/camel-mbox-folder.c (_list_subfolders): - in the io_error label does not return before the - list has been freed. - -2000-01-03 bertrand - - * camel/providers/mbox/camel-mbox-folder.c (_list_subfolders): - detects netscape ".sdb" folders as well as simple - non-suffixed folders (as the ones used in pine). - - - * camel/string-utils.c (string_prefix): - finished implementation. - (string_prefix): added a boolean flag to indicate if the - suffix has been found. When the suffix does not match, - return NULL. - -1999-12-26 bertrand - - * camel/camel-exception.c (camel_exception_setv): - new function. Allow printf-like description - string constructions. - - * camel/camel-exception.h: cosmetic changes. - - * camel/providers/mbox/camel-mbox-store.h: - * camel/providers/mbox/camel-mbox-store.c: - * camel/providers/mbox/camel-mbox-folder.h: - * camel/providers/mbox/camel-mbox-folder.c: - More work on the mbox provider. - - -1999-12-22 bertrand - - * 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 - - * 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 - - * configure.in (AC_OUTPUT): added widgets/meeting-time-sel/Makefile - -1999-12-19 bertrand - - * camel/camel-folder-utils.c: include camel-log.h - to avoid unresolved symbols. - -1999-12-18 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 . - * camel/data-wrapper-repository.h: Likewise. - -1999-11-05 Ettore Perazzoli - - * tests/Makefile.am (INCLUDES): Add `-I$(top_srcdir)'. - -1999-10-13 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - - * 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 - - * 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 - - * 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 - - * 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 - - * camel/providers/maildir: Added (experimental) maildir - provider written by Jukka Zitting - - * camel/providers/Makefile.am (SUBDIRS): build maildir - provider. - - * camel/camel-provider.c (camel_provider_get_for_protocol): - bug fix. patch from Jukka Zitting - - * 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 - - * 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 - - * 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 - - * MAINTAINERS: updated my e-mail address. - -1999-08-28 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * camel/gmime-rfc2047.c: more work on encoder. - -1999-08-17 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * devel-docs/misc/ref_and_id_proposition.txt: - new file. Document message UID and vfolder - implementation. - -1999-08-08 Robert Brady - - * camel/gmime-rfc2047.c: more advanced RFC2047 encoder started. - -1999-08-08 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * tests/test5.c: test for RFC2047 decoder. - - * camel/gmime-rfc2047.c: Improved RFC2047 decoder. - -1999-08-06 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * camel/gmime-utils.c (gmime_read_line_from_stream): - Don't return crlf at end of line. - -1999-07-30 bertrand - - * 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 - - * 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 - - - * 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 - - * camel/camel-multipart.c (_write_to_stream): - implemented output of multipart. - - * tests/test1.c (main): testing content objects operations. - -1999-07-25 bertrand - - * 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 - - * camel/gmime-content-field.c (gmime_content_field_get_parameter): - New function. Returns the value associated to a - mime parameter. - - -1999-07-22 bertrand - - * 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 - - * 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 - - * 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 - - * camel/gmime-content-field.c (gmime_content_field_construct_from_string): - GString -> gchar - use const to indicate copied parameter. - -1999-07-15 bertrand - - * camel/camel-simple-data-wrapper.c: - * camel/camel-simple-data-wrapper.h: - Gstring -> gchar - -1999-07-15 bertrand - - * 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 - - * 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 - - * 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 - - * camel/camel-data-wrapper.h: - s/content_type/mime_type/ - -1999-06-24 bertrand - - * 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 - - * camel/camel-mime-message.c (_write_one_recipient_to_stream): - includes gmime-utils header. - patch from Ulrich Drepper - set separator string in write_header_with_glist_to_stream() - - * camel/camel-log.c (camel_log): - patch from Ulrich Drepper - Do not use stderr in initialization of logfile descriptor. - - * camel/camel-stream-fs.c (camel_stream_fs_new_with_name): - patch from Ulrich Drepper - initialize mode field in open(). - -1999-06-22 bertrand - - * 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 - - * 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 - - * devel-docs/query/virtual-folder-in-depth.sgml: - sgmlized Giao's doc about virtual folders. - -1999-05-31 bertrand - - * 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 - - * 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 - - * camel/camel-mime-part.c - (_parse_header_pair): - (_init_header_name_table): - More header parsing code. - - -1999-05-27 bertrand - - * 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 - - * 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 - - * camel/camel-mime-message.c (_write_to_file): - recipient list printing - - * tests/test1.c (main): more tests. - -1999-05-19 bertrand - - * 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 - - * 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 - - * camel/camel-mime-message.c (*_flag): - flags handling methods - -1999-05-14 bertrand - - * camel/camel-mime-message.c (camel_mime_message_class_init): - added recipient handling class funcs. - -1999-05-13 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * camel/camel-folder.c (camel_folder_create): - new public function. - -1999-04-25 bertrand - - * 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 - - * 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 - - * 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 - - * 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 - - * camel/url-util.[ch]: - Utility functions to parse URLs. - Stolen shamelessly from gzilla (www.gzilla.com) - written by Raph Levien - - * 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 - - * camel/providers/MH/camel-mh-store.c: - more test implementation. - - * camel/camel-store.c (camel_store_get_type): typo fix - - -1999-04-21 bertrand - - * camel/providers/MH/camel-mh-folder.c (camel_mh_folder_get_type): - start test provider. - -1999-04-20 bertrand - - * 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 - - * camel/README: added some (few) explanations. - -1999-04-18 bertrand - - * 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 - - * 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 - - * 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 - - * autogen.sh (PKG_NAME): groomf -> gnome-mailer - diff --git a/INSTALL b/INSTALL deleted file mode 100644 index b42a17ac46..0000000000 --- a/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index 7a42d1eee8..0000000000 --- a/MAINTAINERS +++ /dev/null @@ -1 +0,0 @@ -Email: miguel@kernel.org diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index b8896a9a72..0000000000 --- a/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -changelogs = \ - ChangeLog - -EXTRA_DIST = \ - AUTHORS \ - $(changelogs) \ - README \ - HACKING \ - MAINTAINERS \ - NEWS - -SUBDIRS = \ - intl \ - po \ - macros \ - data \ - libibex \ - filter \ - camel \ - e-util \ - widgets \ - composer \ - mail \ - tests \ - addressbook \ - shell \ - libical \ - libversit \ - calendar - -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 b82df79654..0000000000 --- a/README +++ /dev/null @@ -1,6 +0,0 @@ - -Evolution is the integrated mail, calendar and address book -distributed suite from Helix Code, Inc. - -http://www.helixcode.com for more information. - diff --git a/acconfig.h b/acconfig.h deleted file mode 100644 index 46f03b62ef..0000000000 --- a/acconfig.h +++ /dev/null @@ -1,16 +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 -#undef ENABLE_THREADS -#undef SENDMAIL_PATH - -/* Define this if you want to build against the development gtk */ -#undef HAVE_DEVGTK - diff --git a/addressbook/.cvsignore b/addressbook/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/addressbook/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/Makefile.am b/addressbook/Makefile.am deleted file mode 100644 index 2b588a0738..0000000000 --- a/addressbook/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -SUBDIRS = \ - contact-editor printing diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am deleted file mode 100644 index 35cf59d537..0000000000 --- a/addressbook/backend/ebook/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -bin_PROGRAMS = test-card test-client - -corbadir = $(sysconfdir)/CORBA/servers - -CORBA_SOURCE = \ - addressbook.h \ - addressbook-common.c \ - addressbook-stubs.c \ - addressbook-skels.c - -idls = \ - ../idl/addressbook.idl - -idl_flags = `$(GNOME_CONFIG) --cflags idl` - -$(CORBA_SOURCE): $(idls) - $(ORBIT_IDL) ../idl/addressbook.idl $(idl_flags) - -INCLUDES = \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DG_LOG_DOMAIN=\"EBook\" \ - -I$(srcdir) -I$(top_srcdir) \ - -I. \ - -I.. \ - -I$(top_builddir) \ - -I$(includedir) \ - $(GNOME_INCLUDEDIR) - -gnome_libs = \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) - -ebook_libs = \ - libebook.la \ - $(gnome_libs) - -lib_LTLIBRARIES = libebook.la - -libebook_la_SOURCES = \ - $(CORBA_SOURCE) \ - e-book-listener.c \ - e-book.c \ - e-card.c - -libebookincludedir = $(includedir)/backend - -libebookinclude_HEADERS = \ - e-book.h \ - e-book-listener.h \ - e-card.h - -test_client_SOURCES = \ - test-client.c - -test_client_LDADD = \ - $(GTK_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) \ - -lbonobo \ - $(ebook_libs) \ - ../libversit/libversit.la - -test_card_SOURCES = \ - test-card.c - -test_card_LDADD = \ - $(GTK_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) \ - -lbonobo \ - $(ebook_libs) \ - ../libversit/libversit.la - -BUILT_SOURCES = $(CORBA_SOURCE) -CLEANFILES += $(BUILT_SOURCES) diff --git a/addressbook/backend/ebook/TODO b/addressbook/backend/ebook/TODO deleted file mode 100644 index a69703cd92..0000000000 --- a/addressbook/backend/ebook/TODO +++ /dev/null @@ -1,2 +0,0 @@ -* Make sure open_book_progress does not use the EBook op queue; make - sure it works. diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c deleted file mode 100644 index e1182981fe..0000000000 --- a/addressbook/backend/ebook/e-book-listener.c +++ /dev/null @@ -1,511 +0,0 @@ -/* - * Exports the BookListener interface. Maintains a queue of messages - * which come in on the interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include - #include - -static EBookStatus e_book_listener_convert_status (Evolution_BookListener_CallStatus status); - -enum { - RESPONSES_QUEUED, - LAST_SIGNAL -}; - -static guint e_book_listener_signals [LAST_SIGNAL]; - -static GnomeObjectClass *e_book_listener_parent_class; -POA_Evolution_BookListener__vepv e_book_listener_vepv; - -struct _EBookListenerPrivate { - EBook *book; - GList *response_queue; - gint idle_id; -}; - -static gboolean -e_book_listener_check_queue (EBookListener *listener) -{ - if (listener->priv->response_queue != NULL) { - gtk_signal_emit (GTK_OBJECT (listener), - e_book_listener_signals [RESPONSES_QUEUED]); - } - - if (listener->priv->response_queue == NULL) { - listener->priv->idle_id = 0; - return FALSE; - } - - return TRUE; -} - -static void -e_book_listener_queue_response (EBookListener *listener, - EBookListenerResponse *response) -{ - listener->priv->response_queue = - g_list_append (listener->priv->response_queue, - response); - - if (listener->priv->idle_id == 0) { - listener->priv->idle_id = g_idle_add ( - (GSourceFunc) e_book_listener_check_queue, listener); - } -} - -/* Add, Remove, Modify */ -static void -e_book_listener_queue_generic_response (EBookListener *listener, - EBookListenerOperation op, - EBookStatus status) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = op; - resp->status = status; - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_open_response (EBookListener *listener, - EBookStatus status, - Evolution_Book book) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = OpenBookResponse; - resp->status = status; - resp->book = book; - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_open_progress (EBookListener *listener, - const char *msg, - short percent) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = OpenProgressEvent; - resp->msg = g_strdup (msg); - resp->percent = percent; - - e_book_listener_queue_response (listener, resp); -} - - -static void -e_book_listener_queue_link_status (EBookListener *listener, - gboolean connected) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = LinkStatusEvent; - resp->connected = connected; - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_generic_event (EBookListener *listener, - EBookStatus status, - const char *id) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = LinkStatusEvent; - resp->status = status; - resp->id = g_strdup (id); - - e_book_listener_queue_response (listener, resp); -} - -static void -impl_BookListener_respond_create_card (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_generic_response ( - listener, CreateCardResponse, - e_book_listener_convert_status (status)); -} - -static void -impl_BookListener_respond_remove_card (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_generic_response ( - listener, RemoveCardResponse, - e_book_listener_convert_status (status)); -} - -static void -impl_BookListener_respond_modify_card (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_generic_response ( - listener, ModifyCardResponse, - e_book_listener_convert_status (status)); -} - -static void -impl_BookListener_respond_open_book (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - const Evolution_Book book, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - Evolution_Book book_copy; - - book_copy = CORBA_Object_duplicate (book, ev); - - if (ev->_major != CORBA_NO_EXCEPTION) { - g_warning ("EBookListener: Exception while duplicating Book!\n"); - return; - } - - e_book_listener_queue_open_response ( - listener, - e_book_listener_convert_status (status), - book_copy); -} - -static void -impl_BookListener_report_open_book_progress (PortableServer_Servant servant, - const CORBA_char *status_message, - const CORBA_short percent, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_open_progress ( - listener, status_message, percent); -} - -static void -impl_BookListener_report_connection_status (PortableServer_Servant servant, - const CORBA_boolean connected, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_link_status ( - listener, connected); -} - -static void -impl_BookListener_signal_card_added (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_generic_event ( - listener, CardAddedEvent, (const char *) id); -} - -static void -impl_BookListener_signal_card_removed (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_generic_event ( - listener, CardRemovedEvent, (const char *) id); -} - -static void -impl_BookListener_signal_card_changed (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (gnome_object_from_servant (servant)); - - e_book_listener_queue_generic_event ( - listener, CardModifiedEvent, (const char *) id); -} - -/** - * e_book_listener_get_book: - */ -EBook * -e_book_listener_get_book (EBookListener *listener) -{ - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK_LISTENER (listener), NULL); - - return listener->priv->book; -} - -/** - * e_book_listener_check_pending: - */ -int -e_book_listener_check_pending (EBookListener *listener) -{ - g_return_val_if_fail (listener != NULL, -1); - g_return_val_if_fail (E_IS_BOOK_LISTENER (listener), -1); - - return g_list_length (listener->priv->response_queue); -} - -/** - * e_book_listener_pop_response: - */ -EBookListenerResponse * -e_book_listener_pop_response (EBookListener *listener) -{ - EBookListenerResponse *resp; - GList *popped; - - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK_LISTENER (listener), NULL); - - if (listener->priv->response_queue == NULL) - return NULL; - - resp = listener->priv->response_queue->data; - - popped = listener->priv->response_queue; - listener->priv->response_queue = - g_list_remove_link (listener->priv->response_queue, - listener->priv->response_queue); - g_list_free_1 (popped); - - return resp; -} - -static EBookStatus -e_book_listener_convert_status (const Evolution_BookListener_CallStatus status) -{ - switch (status) { - case Evolution_BookListener_Success: - return E_BOOK_STATUS_SUCCESS; - case Evolution_BookListener_RepositoryOffline: - return E_BOOK_STATUS_REPOSITORY_OFFLINE; - case Evolution_BookListener_PermissionDenied: - return E_BOOK_STATUS_PERMISSION_DENIED; - case Evolution_BookListener_CardNotFound: - return E_BOOK_STATUS_CARD_NOT_FOUND; - default: - g_warning ("e_book_listener_convert_status: Unknown status " - "from card server: %d\n", (int) status); - return E_BOOK_STATUS_UNKNOWN; - - } -} - -static EBookListener * -e_book_listener_construct (EBookListener *listener, EBook *book) -{ - POA_Evolution_BookListener *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (listener != NULL); - g_assert (E_IS_BOOK_LISTENER (listener)); - g_assert (book != NULL); - g_assert (E_IS_BOOK (book)); - - listener->priv->book = book; - - servant = (POA_Evolution_BookListener *) g_new0 (GnomeObjectServant, 1); - servant->vepv = &e_book_listener_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_BookListener__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return NULL; - } - - CORBA_exception_free (&ev); - - obj = gnome_object_activate_servant (GNOME_OBJECT (listener), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return NULL; - } - - gnome_object_construct (GNOME_OBJECT (listener), obj); - - return listener; -} - -/** - * e_book_listener_new: - */ -EBookListener * -e_book_listener_new (EBook *book) -{ - EBookListener *listener; - EBookListener *retval; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK (book), NULL); - - listener = gtk_type_new (E_BOOK_LISTENER_TYPE); - - retval = e_book_listener_construct (listener, book); - - if (retval == NULL) { - g_warning ("e_book_listener_new: Error constructing " - "EBookListener!\n"); - gtk_object_unref (GTK_OBJECT (listener)); - return NULL; - } - - return retval; -} - -static void -e_book_listener_init (EBookListener *listener) -{ - listener->priv = g_new0 (EBookListenerPrivate, 1); -} - -static void -e_book_listener_destroy (GtkObject *object) -{ - EBookListener *listener = E_BOOK_LISTENER (object); - GList *l; - - for (l = listener->priv->response_queue; l != NULL; l = l->next) { - EBookListenerResponse *resp = l->data; - - g_free (resp->msg); - g_free (resp->id); - - if (resp->book != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_Object_release (resp->book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_listener_destroy: " - "Exception destroying book " - "in response queue!\n"); - } - - CORBA_exception_free (&ev); - } - - g_free (resp); - } - g_list_free (listener->priv->response_queue); - - g_free (listener->priv); - - GTK_OBJECT_CLASS (e_book_listener_parent_class)->destroy (object); -} - -POA_Evolution_BookListener__epv * -e_book_listener_get_epv (void) -{ - POA_Evolution_BookListener__epv *epv; - - epv = g_new0 (POA_Evolution_BookListener__epv, 1); - - epv->report_open_book_progress = impl_BookListener_report_open_book_progress; - epv->respond_open_book = impl_BookListener_respond_open_book; - - epv->respond_create_card = impl_BookListener_respond_create_card; - epv->respond_remove_card = impl_BookListener_respond_remove_card; - epv->respond_modify_card = impl_BookListener_respond_modify_card; - - epv->report_connection_status = impl_BookListener_report_connection_status; - - epv->signal_card_changed = impl_BookListener_signal_card_changed; - epv->signal_card_removed = impl_BookListener_signal_card_removed; - epv->signal_card_added = impl_BookListener_signal_card_added; - - return epv; -} - -static void -e_book_listener_corba_class_init (void) -{ - e_book_listener_vepv.GNOME_Unknown_epv = gnome_object_get_epv (); - e_book_listener_vepv.Evolution_BookListener_epv = e_book_listener_get_epv (); -} - -static void -e_book_listener_class_init (EBookListenerClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - e_book_listener_parent_class = gtk_type_class (gnome_object_get_type ()); - - e_book_listener_signals [RESPONSES_QUEUED] = - gtk_signal_new ("responses_queued", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookListenerClass, responses_queued), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_book_listener_signals, LAST_SIGNAL); - - object_class->destroy = e_book_listener_destroy; - - e_book_listener_corba_class_init (); -} - -/** - * e_book_listener_get_type: - */ -GtkType -e_book_listener_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "EBookListener", - sizeof (EBookListener), - sizeof (EBookListenerClass), - (GtkClassInitFunc) e_book_listener_class_init, - (GtkObjectInitFunc) e_book_listener_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gnome_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h deleted file mode 100644 index 9873edc58c..0000000000 --- a/addressbook/backend/ebook/e-book-listener.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * A client-side GtkObject which exposes the - * Evolution:BookListener interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __E_BOOK_LISTENER_H__ -#define __E_BOOK_LISTENER_H__ - -#include -#include -#include -#include - -BEGIN_GNOME_DECLS - -typedef struct _EBookListenerPrivate EBookListenerPrivate; - -typedef struct { - GnomeObject parent; - EBookListenerPrivate *priv; -} EBookListener; - -typedef struct { - GnomeObjectClass parent; - - /* - * Signals - */ - void (*responses_queued) (void); -} EBookListenerClass; - -typedef enum { - /* Async responses */ - OpenBookResponse, - CreateCardResponse, - RemoveCardResponse, - ModifyCardResponse, - - /* Async events */ - CardAddedEvent, - CardRemovedEvent, - CardModifiedEvent, - LinkStatusEvent, - OpenProgressEvent, -} EBookListenerOperation; - -typedef struct { - EBookListenerOperation op; - - /* For most Response notifications */ - EBookStatus status; - - /* For OpenBookResponse */ - Evolution_Book book; - - /* For OpenProgressEvent */ - char *msg; - short percent; - - /* For LinkStatusEvent */ - gboolean connected; - - /* For Card[Added|Removed|Modified]Event */ - char *id; -} EBookListenerResponse; - -EBookListener *e_book_listener_new (EBook *book); -EBook *e_book_listener_get_book (EBookListener *listener); -int e_book_listener_check_pending (EBookListener *listener); -EBookListenerResponse *e_book_listener_pop_response (EBookListener *listener); -GtkType e_book_listener_get_type (void); - -POA_Evolution_BookListener__epv *e_book_listener_get_epv (void); - -#define E_BOOK_LISTENER_TYPE (e_book_listener_get_type ()) -#define E_BOOK_LISTENER(o) (GTK_CHECK_CAST ((o), E_BOOK_LISTENER_TYPE, EBookListener)) -#define E_BOOK_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_LISTENER_TYPE, EBookListenerClass)) -#define E_IS_BOOK_LISTENER(o) (GTK_CHECK_TYPE ((o), E_BOOK_LISTENER_TYPE)) -#define E_IS_BOOK_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_LISTENER_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_BOOK_LISTENER_H__ */ diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c deleted file mode 100644 index 460f73b56e..0000000000 --- a/addressbook/backend/ebook/e-book.c +++ /dev/null @@ -1,871 +0,0 @@ -/* - * The Evolution addressbook client object. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#include -#include -#include -#include -#include -#include -#include - -GtkObjectClass *e_book_parent_class; - -#define CARDSERVER_GOAD_ID "evolution:card-server" - -typedef enum { - URINotLoaded, - URILoading, - URILoaded -} EBookLoadState; - -struct _EBookPrivate { - Evolution_BookFactory book_factory; - EBookListener *listener; - - Evolution_Book corba_book; - - EBookLoadState load_state; - - /* - * The operation queue. New operations are appended to the - * end of the queue. When responses come back from the PAS, - * the op structures are popped off the front of the queue. - */ - GList *pending_ops; -}; - -enum { - OPEN_PROGRESS, - CARD_CHANGED, - CARD_REMOVED, - CARD_ADDED, - LINK_STATUS, - LAST_SIGNAL -}; - -static guint e_book_signals [LAST_SIGNAL]; - -typedef struct { - gpointer cb; - gpointer closure; -} EBookOp; - -/* - * Local response queue management. - */ -static void -e_book_queue_op (EBook *book, - gpointer cb, - gpointer closure) -{ - EBookOp *op; - - op = g_new0 (EBookOp, 1); - op->cb = cb; - op->closure = closure; - - book->priv->pending_ops = - g_list_append (book->priv->pending_ops, op); -} - -static EBookOp * -e_book_pop_op (EBook *book) -{ - GList *popped; - EBookOp *op; - - if (book->priv->pending_ops == NULL) - return NULL; - - op = book->priv->pending_ops->data; - - popped = book->priv->pending_ops; - book->priv->pending_ops = - g_list_remove_link (book->priv->pending_ops, (gpointer) op); - - g_list_free_1 (popped); - - return op; -} - -static void -e_book_do_response_generic (EBook *book, - EBookListenerResponse *resp) -{ - EBookOp *op; - - op = e_book_pop_op (book); - - if (op == NULL) { - g_warning ("e_book_do_response_generic: Cannot find operation " - "in local op queue!\n"); - } - - ((EBookCallback) op->cb) (book, resp->status, op->closure); - - g_free (op); -} - -static void -e_book_do_response_open (EBook *book, - EBookListenerResponse *resp) -{ - EBookOp *op; - - if (resp->status == E_BOOK_STATUS_SUCCESS) { - book->priv->corba_book = resp->book; - book->priv->load_state = URILoaded; - } - - op = e_book_pop_op (book); - - if (op == NULL) { - g_warning ("e_book_do_response_open: Cannot find operation " - "in local op queue!\n"); - return; - } - - ((EBookCallback) op->cb) (book, resp->status, op->closure); - g_free (op); -} - -static void -e_book_do_progress_event (EBook *book, - EBookListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book), e_book_signals [OPEN_PROGRESS], - resp->msg, resp->percent); - - g_free (resp->msg); -} - -static void -e_book_do_link_event (EBook *book, - EBookListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book), e_book_signals [LINK_STATUS], - resp->connected); -} - -static void -e_book_do_added_event (EBook *book, - EBookListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book), e_book_signals [CARD_ADDED], - resp->id); - - g_free (resp->id); -} - -static void -e_book_do_modified_event (EBook *book, - EBookListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book), e_book_signals [CARD_CHANGED], - resp->id); - - g_free (resp->id); -} - -static void -e_book_do_removed_event (EBook *book, - EBookListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book), e_book_signals [CARD_REMOVED], - resp->id); - - g_free (resp->id); -} - - -/* - * Reading notices out of the EBookListener's queue. - */ -static void -e_book_check_listener_queue (EBookListener *listener) -{ - EBook *book; - EBookListenerResponse *resp; - - book = e_book_listener_get_book (listener); - g_assert (book != NULL); - - resp = e_book_listener_pop_response (listener); - - if (resp == NULL) - return; - - switch (resp->op) { - case CreateCardResponse: - case RemoveCardResponse: - case ModifyCardResponse: - e_book_do_response_generic (book, resp); - break; - case OpenBookResponse: - e_book_do_response_open (book, resp); - break; - - case OpenProgressEvent: - e_book_do_progress_event (book, resp); - break; - case LinkStatusEvent: - e_book_do_link_event (book, resp); - break; - case CardAddedEvent: - e_book_do_added_event (book, resp); - break; - case CardModifiedEvent: - e_book_do_modified_event (book, resp); - break; - case CardRemovedEvent: - e_book_do_removed_event (book, resp); - break; - default: - g_error ("EBook: Unknown operation %d in listener queue!\n", - resp->op); - } - - g_free (resp); -} - -/** - * e_book_load_uri: - */ -gboolean -e_book_load_uri (EBook *book, - const char *uri, - EBookCallback open_response, - gpointer closure) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (uri != NULL, FALSE); - g_return_val_if_fail (open_response != NULL, FALSE); - - if (book->priv->load_state != URINotLoaded) { - g_warning ("e_book_load_uri: Attempted to load a URI " - "on a book which already has a URI loaded!\n"); - return FALSE; - } - - /* - * Load the addressbook into the PAS. - */ - CORBA_exception_init (&ev); - - Evolution_BookFactory_open_book ( - book->priv->book_factory, uri, - gnome_object_corba_objref (GNOME_OBJECT (book->priv->listener)), - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_load_uri: CORBA exception while opening addressbook!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - book->priv->load_state = URILoading; - - e_book_queue_op (book, open_response, closure); - - /* Now we play the waiting game. */ - - return TRUE; -} - -/** - * e_book_unload_uri: - */ -void -e_book_unload_uri (EBook *book) -{ - CORBA_Environment ev; - - g_return_if_fail (book != NULL); - g_return_if_fail (E_IS_BOOK (book)); - - /* - * FIXME: Make sure this works if the URI is still being - * loaded. - */ - if (book->priv->load_state == URINotLoaded) { - g_warning ("e_book_unload_uri: No URI is loaded!\n"); - return; - } - - /* - * Release the remote Evolution_Book in the PAS. - */ - CORBA_exception_init (&ev); - - GNOME_Unknown_unref (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_unload_uri: Exception unref'ing " - "remote Evolution_Book interface!\n"); - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - CORBA_Object_release (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_unload_uri: Exception releasing " - "remote book interface!\n"); - } - - CORBA_exception_free (&ev); - - gtk_object_unref (GTK_OBJECT (book->priv->listener)); - - book->priv->listener = NULL; - book->priv->load_state = URINotLoaded; -} - -static gboolean -e_book_construct (EBook *book) -{ - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - - /* - * Connect to the Personal Addressbook Server. - */ - book->priv->book_factory = (Evolution_BookFactory) - goad_server_activate_with_id (NULL, CARDSERVER_GOAD_ID, 0, NULL); - - if (book->priv->book_factory == CORBA_OBJECT_NIL) { - g_warning ("e_book_construct: Could not obtain a handle " - "to the Personal Addressbook Server!\n"); - return FALSE; - } - - /* - * Create our local BookListener interface. - */ - book->priv->listener = e_book_listener_new (book); - if (book->priv->listener == NULL) { - g_warning ("e_book_construct: Could not create EBookListener!\n"); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (book->priv->listener), "responses_queued", - e_book_check_listener_queue, NULL); - - return TRUE; -} - -/** - * e_book_new: - */ -EBook * -e_book_new (void) -{ - EBook *book; - - book = gtk_type_new (E_BOOK_TYPE); - - if (! e_book_construct (book)) { - gtk_object_unref (GTK_OBJECT (book)); - return NULL; - } - - return book; -} - -/* Fetching cards */ - -/** - * e_book_get_card: - */ -ECard * -e_book_get_card (EBook *book, - const char *id) -{ - char *vcard; - ECard *card; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK (book), NULL); - - if (! book->priv->load_state != URILoaded) { - g_warning ("e_book_get_card: No URI loaded!\n"); - return NULL; - } - - vcard = e_book_get_vcard (book, id); - - if (vcard == NULL) { - g_warning ("e_book_get_card: Got bogus VCard from PAS!\n"); - return NULL; - } - - card = e_card_new (vcard); - g_strdup (vcard); - - return card; -} - -/** - * e_book_get_vcard: - */ -char * -e_book_get_vcard (EBook *book, - const char *id) -{ - CORBA_Environment ev; - char *retval; - char *vcard; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK (book), NULL); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_get_vcard: No URI loaded!\n"); - return NULL; - } - - CORBA_exception_init (&ev); - - vcard = Evolution_Book_get_vcard (book->priv->corba_book, - (Evolution_CardId) id, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_get_vcard: Exception getting VCard from PAS!\n"); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - if (vcard == NULL || strlen (vcard) == 0) { - g_warning ("e_book_get_vcard: Got NULL VCard from PAS!\n"); - return NULL; - } - - retval = g_strdup (vcard); - CORBA_free (vcard); - - return retval; -} - -/* Deleting cards. */ - -/** - * e_book_remove_card: - */ -gboolean -e_book_remove_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure) -{ - const char *id; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (card != NULL, FALSE); - g_return_val_if_fail (E_IS_CARD (card), FALSE); - g_return_val_if_fail (cb != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_remove_card: No URI loaded!\n"); - return FALSE; - } - - id = e_card_get_id (card); - g_assert (id != NULL); - - return e_book_remove_card_by_id (book, id, cb, closure); -} - -/** - * e_book_remove_card_by_id: - */ -gboolean -e_book_remove_card_by_id (EBook *book, - const char *id, - EBookCallback cb, - gpointer closure) - -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (id != NULL, FALSE); - g_return_val_if_fail (cb != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_remove_card_by_id: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_remove_card ( - book->priv->corba_book, (const Evolution_CardId) id, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_remove_card_by_id: CORBA exception " - "talking to PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, cb, closure); - - return TRUE; -} - -/* Adding cards. */ - -/** - * e_book_add_card: - */ -gboolean -e_book_add_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure) - -{ - char *vcard; - gboolean retval; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (card != NULL, FALSE); - g_return_val_if_fail (E_IS_CARD (card), FALSE); - g_return_val_if_fail (cb != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_add_card: No URI loaded!\n"); - return FALSE; - } - - vcard = e_card_get_vcard (card); - - if (vcard == NULL) { - g_warning ("e_book_add_card: Cannot convert card to VCard string!\n"); - return FALSE; - } - - retval = e_book_add_vcard (book, vcard, cb, closure); - - g_free (vcard); - - return retval; -} - -/** - * e_book_add_vcard: - */ -gboolean -e_book_add_vcard (EBook *book, - const char *vcard, - EBookCallback cb, - gpointer closure) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (vcard != NULL, FALSE); - g_return_val_if_fail (cb != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_add_vcard: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_create_card ( - book->priv->corba_book, vcard, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_add_vcard: Exception adding card to PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, cb, closure); - - return TRUE; -} - -/* Modifying cards. */ - -/** - * e_book_commit_card: - */ -gboolean -e_book_commit_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure) -{ - char *vcard; - gboolean retval; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (card != NULL, FALSE); - g_return_val_if_fail (E_IS_CARD (card), FALSE); - g_return_val_if_fail (cb != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_commit_card: No URI loaded!\n"); - return FALSE; - } - - vcard = e_card_get_vcard (card); - - if (vcard == NULL) { - g_warning ("e_book_commit_card: Error " - "getting VCard for card!\n"); - return FALSE; - } - - retval = e_book_commit_vcard (book, vcard, cb, closure); - - g_free (vcard); - - return retval; -} - -/** - * e_book_commit_vcard: - */ -gboolean -e_book_commit_vcard (EBook *book, - const char *vcard, - EBookCallback cb, - gpointer closure) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (vcard != NULL, FALSE); - g_return_val_if_fail (cb != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_commit_vcard: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_modify_card ( - book->priv->corba_book, vcard, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_commit_vcard: Exception " - "modifying card in PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, cb, closure); - - return TRUE; -} - -/** - * e_book_check_connection: - */ -gboolean -e_book_check_connection (EBook *book) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_check_connection: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_check_connection (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_check_connection: Exception " - "querying the PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - return TRUE; -} - -/** - * e_book_get_name: - */ -char * -e_book_get_name (EBook *book) -{ - CORBA_Environment ev; - char *retval; - char *name; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK (book), NULL); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_get_name: No URI loaded!\n"); - return NULL; - } - - CORBA_exception_init (&ev); - - name = Evolution_Book_get_name (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_get_name: Exception getting name from PAS!\n"); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - if (name == NULL) { - g_warning ("e_book_get_name: Got NULL name from PAS!\n"); - return NULL; - } - - retval = g_strdup (name); - CORBA_free (name); - - return retval; -} - -static void -e_book_init (EBook *book) -{ - book->priv = g_new0 (EBookPrivate, 1); - book->priv->load_state = URINotLoaded; -} - -static void -e_book_destroy (GtkObject *object) -{ - EBook *book = E_BOOK (object); - CORBA_Environment ev; - - if (book->priv->load_state != URINotLoaded) - e_book_unload_uri (book); - - CORBA_exception_init (&ev); - - CORBA_Object_release (book->priv->book_factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("EBook: Exception while releasing BookFactory\n"); - - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - g_free (book->priv); - - GTK_OBJECT_CLASS (e_book_parent_class)->destroy (object); -} - -static void -e_book_class_init (EBookClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - e_book_parent_class = gtk_type_class (gtk_object_get_type ()); - - e_book_signals [CARD_CHANGED] = - gtk_signal_new ("card_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookClass, card_changed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - e_book_signals [CARD_ADDED] = - gtk_signal_new ("card_added", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookClass, card_added), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - e_book_signals [CARD_REMOVED] = - gtk_signal_new ("card_removed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookClass, card_removed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - e_book_signals [LINK_STATUS] = - gtk_signal_new ("link_status", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookClass, link_status), - gtk_marshal_NONE__BOOL, - GTK_TYPE_NONE, 1, - GTK_TYPE_BOOL); - - gtk_object_class_add_signals (object_class, e_book_signals, - LAST_SIGNAL); - - object_class->destroy = e_book_destroy; -} - -/** - * e_book_get_type: - */ -GtkType -e_book_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "EBook", - sizeof (EBook), - sizeof (EBookClass), - (GtkClassInitFunc) e_book_class_init, - (GtkObjectInitFunc) e_book_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h deleted file mode 100644 index 8a3fb311c1..0000000000 --- a/addressbook/backend/ebook/e-book.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * The Evolution addressbook client object. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#ifndef __E_BOOK_H__ -#define __E_BOOK_H__ - -#include - -#include - -BEGIN_GNOME_DECLS - -typedef enum { - E_BOOK_STATUS_SUCCESS, - E_BOOK_STATUS_UNKNOWN, - E_BOOK_STATUS_REPOSITORY_OFFLINE, - E_BOOK_STATUS_PERMISSION_DENIED, - E_BOOK_STATUS_CARD_NOT_FOUND -} EBookStatus; - -typedef struct _EBookPrivate EBookPrivate; - -typedef struct { - GtkObject parent; - EBookPrivate *priv; -} EBook; - -typedef struct { - GtkObjectClass parent; - - /* - * Signals. - */ - void (* open_progress) (const char *msg, short percent); - void (* link_status) (gboolean connected); - void (* card_changed) (const char *id); - void (* card_removed) (const char *id); - void (* card_added) (const char *id); -} EBookClass; - -/* Callbacks for asynchronous functions. */ -typedef void (*EBookCallback) (EBook *book, EBookStatus status, gpointer closure); -typedef void (*EBookOpenProgressCallback) (EBook *book, - const char *status_message, - short percent, - gpointer closure); - - -/* Creating a new addressbook. */ -EBook *e_book_new (void); -gboolean e_book_load_uri (EBook *book, - const char *uri, - EBookCallback open_response, - gpointer closure); -void e_book_unload_uri (EBook *book); - -/* Fetching cards. */ -ECard *e_book_get_card (EBook *book, - const char *id); -char *e_book_get_vcard (EBook *book, - const char *id); - -/* Deleting cards. */ -gboolean e_book_remove_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure); -gboolean e_book_remove_card_by_id (EBook *book, - const char *id, - EBookCallback cb, - gpointer closure); - -/* Adding cards. */ -gboolean e_book_add_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure); -gboolean e_book_add_vcard (EBook *book, - const char *vcard, - EBookCallback cb, - gpointer closure); - -/* Modifying cards. */ -gboolean e_book_commit_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure); -gboolean e_book_commit_vcard (EBook *book, - const char *vcard, - EBookCallback cb, - gpointer closure); - -/* Checking to see if we're connected to the card repository. */ -gboolean e_book_check_connection (EBook *book); - -/* Getting the name of the repository. */ -char *e_book_get_name (EBook *book); - -GtkType e_book_get_type (void); - -#define E_BOOK_TYPE (e_book_get_type ()) -#define E_BOOK(o) (GTK_CHECK_CAST ((o), E_BOOK_TYPE, EBook)) -#define E_BOOK_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_TYPE, EBookClass)) -#define E_IS_BOOK(o) (GTK_CHECK_TYPE ((o), E_BOOK_TYPE)) -#define E_IS_BOOK_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_BOOK_H__ */ diff --git a/addressbook/backend/ebook/e-card-cursor.h b/addressbook/backend/ebook/e-card-cursor.h deleted file mode 100644 index 5477a4f615..0000000000 --- a/addressbook/backend/ebook/e-card-cursor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include -#include - -#include - -#ifndef __E_CARD_CURSOR_H__ -#define __E_CARD_CURSOR_H__ - -BEGIN_GNOME_DECLS - -typedef struct _ECardCursorPrivate ECardCursorPrivate; - -typedef struct { - GtkObject parent; - ECardCursorPrivate *priv; -} ECardCursor; - -typedef struct { - GtkObjectClass parent; -} ECardCursorClass; - -/* Creating a new addressbook. */ -ECardCursor *e_card_cursor_new (EBook *book, - Evolution_CardCursor corba_cursor); -GtkType e_card_cursor_get_type (void); - -/* Fetching cards. */ -int e_card_cursor_get_length (ECardCursor *cursor); -ECard *e_card_cursor_get_nth (ECardCursor *cursor, - int nth); -#define E_CARD_CURSOR_TYPE (e_card_cursor_get_type ()) -#define E_CARD_CURSOR(o) (GTK_CHECK_CAST ((o), E_CARD_CURSOR_TYPE, ECardCursor)) -#define E_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CARD_CURSOR_TYPE, ECardCursorClass)) -#define E_IS_CARD_CURSOR(o) (GTK_CHECK_TYPE ((o), E_CARD_CURSOR_TYPE)) -#define E_IS_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CARD_CURSOR_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_CARD_CURSOR_H__ */ diff --git a/addressbook/backend/ebook/e-card-pairs.h b/addressbook/backend/ebook/e-card-pairs.h deleted file mode 100644 index d79d1171c6..0000000000 --- a/addressbook/backend/ebook/e-card-pairs.h +++ /dev/null @@ -1,139 +0,0 @@ -/* GnomeCard - a graphical contact manager. - * - * pairs.h: This file is part of GnomeCard. - * - * Copyright (C) 1999 The Free Software Foundation - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __E_CARD_PAIRS_H__ -#define __E_CARD_PAIRS_H__ - -#include "../libversit/vcc.h" -#include - -struct pair -{ - char *str; - enum PropertyType id; -}; - -struct pair prop_lookup[] = { - { VCFullNameProp, PROP_FNAME }, - { VCNameProp, PROP_NAME }, - { VCPhotoProp, PROP_PHOTO }, - { VCBirthDateProp, PROP_BDAY }, - { VCAdrProp, PROP_DELADDR }, - { VCDeliveryLabelProp, PROP_DELLABEL }, - { VCTelephoneProp, PROP_PHONE }, - { VCEmailAddressProp, PROP_EMAIL }, - { VCMailerProp, PROP_MAILER }, - { VCTimeZoneProp, PROP_TIMEZN }, - { VCGeoProp, PROP_GEOPOS }, - { VCTitleProp, PROP_TITLE }, - { VCBusinessRoleProp, PROP_ROLE }, - { VCLogoProp, PROP_LOGO }, - { VCAgentProp, PROP_AGENT }, - { VCOrgProp, PROP_ORG }, - { VCCategoriesProp, PROP_CATEGORIES }, - { VCCommentProp, PROP_COMMENT }, - { VCLastRevisedProp, PROP_REV }, - { VCPronunciationProp, PROP_SOUND }, - { VCURLProp, PROP_URL }, - { VCUniqueStringProp, PROP_UID }, - { VCVersionProp, PROP_VERSION }, - { VCPublicKeyProp, PROP_KEY }, - { VCValueProp, PROP_VALUE }, - { VCEncodingProp, PROP_ENCODING }, - { VCQuotedPrintableProp, PROP_QUOTED_PRINTABLE }, - { VC8bitProp, PROP_8BIT }, - { VCBase64Prop, PROP_BASE64 }, - { VCLanguageProp, PROP_LANG }, - { VCCharSetProp, PROP_CHARSET }, - { NULL, PROP_NONE} }; - -struct pair addr_pairs[] = { - { VCDomesticProp, ADDR_DOM }, - { VCInternationalProp, ADDR_INTL }, - { VCPostalProp, ADDR_POSTAL }, - { VCParcelProp, ADDR_PARCEL }, - { VCHomeProp, ADDR_HOME }, - { VCWorkProp, ADDR_WORK }, - { NULL, 0} }; - -struct pair photo_pairs[] = { - { VCGIFProp, PHOTO_GIF }, - { VCCGMProp, PHOTO_CGM }, - { VCWMFProp, PHOTO_WMF }, - { VCBMPProp, PHOTO_BMP }, - { VCMETProp, PHOTO_MET }, - { VCPMBProp, PHOTO_PMB }, - { VCDIBProp, PHOTO_DIB }, - { VCPICTProp, PHOTO_PICT }, - { VCTIFFProp, PHOTO_TIFF }, - { VCPDFProp, PHOTO_PDF }, - { VCPSProp, PHOTO_PS }, - { VCJPEGProp, PHOTO_JPEG }, - { VCMPEGProp, PHOTO_MPEG }, - { VCMPEG2Prop, PHOTO_MPEG2 }, - { VCAVIProp, PHOTO_AVI }, - { VCQuickTimeProp, PHOTO_QTIME }, - { NULL, 0 } }; - -struct pair phone_pairs[] = { - { VCPreferredProp, PHONE_PREF }, - { VCWorkProp, PHONE_WORK }, - { VCHomeProp, PHONE_HOME }, - { VCVoiceProp, PHONE_VOICE }, - { VCFaxProp, PHONE_FAX }, - { VCMessageProp, PHONE_MSG }, - { VCCellularProp, PHONE_CELL }, - { VCPagerProp, PHONE_PAGER }, - { VCBBSProp, PHONE_BBS }, - { VCModemProp, PHONE_MODEM }, - { VCCarProp, PHONE_CAR }, - { VCISDNProp, PHONE_ISDN }, - { VCVideoProp, PHONE_VIDEO }, - { NULL, 0 } }; - -struct pair email_pairs[] = { - { VCAOLProp, EMAIL_AOL }, - { VCAppleLinkProp, EMAIL_APPLE_LINK }, - { VCATTMailProp, EMAIL_ATT }, - { VCCISProp, EMAIL_CIS }, - { VCEWorldProp, EMAIL_EWORLD }, - { VCInternetProp, EMAIL_INET }, - { VCIBMMailProp, EMAIL_IBM }, - { VCMCIMailProp, EMAIL_MCI }, - { VCPowerShareProp, EMAIL_POWERSHARE }, - { VCProdigyProp, EMAIL_PRODIGY }, - { VCTLXProp, EMAIL_TLX }, - { VCX400Prop, EMAIL_X400 }, - { NULL, 0 } }; - -struct pair sound_pairs[] = { - { VCAIFFProp, SOUND_AIFF }, - { VCPCMProp, SOUND_PCM }, - { VCWAVEProp, SOUND_WAVE }, - { NULL, 0 } }; - -struct pair key_pairs[] = { - { VCX509Prop, KEY_X509 }, - { VCPGPProp, KEY_PGP }, - { NULL, 0 } }; - - -#endif /* ! __E_CARD_PAIRS_H__ */ diff --git a/addressbook/backend/ebook/e-card-types.h b/addressbook/backend/ebook/e-card-types.h deleted file mode 100644 index c148423b21..0000000000 --- a/addressbook/backend/ebook/e-card-types.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Authors: - * Arturo Espinosa - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_TYPES_H__ -#define __E_CARD_TYPES_H__ - -typedef enum -{ - PROP_NONE = 0, /* Must always be the first, with value = 0. */ - PROP_CARD = 1, - PROP_FNAME = 2, - PROP_NAME = 3, - PROP_PHOTO = 4, - PROP_BDAY = 5, - PROP_DELADDR_LIST = 6, - PROP_DELADDR = 7, - PROP_DELLABEL_LIST = 8, - PROP_DELLABEL = 9, - PROP_PHONE_LIST = 10, - PROP_PHONE = 11, - PROP_EMAIL_LIST = 12, - PROP_EMAIL = 13, - PROP_MAILER = 14, - PROP_TIMEZN = 15, - PROP_GEOPOS = 16, - PROP_TITLE = 17, - PROP_ROLE = 18, - PROP_LOGO = 19, - PROP_AGENT = 20, - PROP_ORG = 21, - PROP_COMMENT = 22, - PROP_REV = 23, - PROP_SOUND = 24, - PROP_URL = 25, - PROP_UID = 26, - PROP_VERSION = 27, - PROP_KEY = 28, - PROP_CATEGORIES = 29, - PROP_XTENSION_LIST = 30, - PROP_VALUE = 31, - PROP_ENCODING = 32, - PROP_QUOTED_PRINTABLE = 33, - PROP_8BIT = 34, - PROP_BASE64 = 35, - PROP_LANG = 36, - PROP_CHARSET = 37, - PROP_LAST = 38 /* Must always be the last, with the gratest value. */ -} ECardPropertyType; - -typedef enum -{ - ENC_NONE = 0, - ENC_BASE64 = 1, - ENC_QUOTED_PRINTABLE = 2, - ENC_8BIT = 3, - ENC_7BIT = 4, - ENC_LAST = 5 -} ECardEncodeType; - -typedef enum -{ - VAL_NONE = 0, - VAL_INLINE = 1, - VAL_CID = 2, - VAL_URL = 3, - VAL_LAST = 4 -} ECardValueType; - -typedef struct { - gboolean used; - ECardPropertyType type; - ECardEncodeType encode; - ECardValueType value; - char *charset; - char *lang; - GList *xtension; - - void *user_data; -} CardProperty; - -typedef struct { - char *name; - char *data; -} CardXAttribute; - -typedef struct { - CardProperty prop; - - char *name; - char *data; -} ECardXProperty; - -typedef struct { - CardProperty prop; - - GList *l; -} ECardList; - -/* IDENTIFICATION PROPERTIES */ - - -typedef struct { - char *prefix; /* Mr. */ - char *given; /* John */ - char *additional; /* Quinlan */ - char *family; /* Public */ - char *suffix; /* Esq. */ -} ECardName; - -typedef struct { - CardProperty prop; - - enum ECardPhotoType type; - guint size; - char *data; - -} ECardPhoto; - -typedef struct { - int year; - int month; - int day; -} ECardDate; - - -/* TELECOMMUNICATIONS ADDRESSING PROPERTIES */ - -typedef enum { - PHONE_PREF = 1 << 0, - PHONE_WORK = 1 << 1, - PHONE_HOME = 1 << 2, - PHONE_VOICE = 1 << 3, - PHONE_FAX = 1 << 4, - PHONE_MSG = 1 << 5, - PHONE_CELL = 1 << 6, - PHONE_PAGER = 1 << 7, - PHONE_BBS = 1 << 8, - PHONE_MODEM = 1 << 9, - PHONE_CAR = 1 << 10, - PHONE_ISDN = 1 << 11, - PHONE_VIDEO = 1 << 12 -} ECardPhoneFlags; - -typedef struct { - ECardPhoneFlags flags; - char *data; -} ECardPhone; - -typedef struct { - int sign; /* 1 or -1 */ - int hours; /* Mexico General is at -6:00 UTC */ - int mins; /* sign -1, hours 6, mins 0 */ -} ECardTimeZone; - -typedef struct { - CardProperty prop; - - float lon; - float lat; -} ECardGeoPos; - - -typedef enum { - PHOTO_GIF, PHOTO_CGM, PHOTO_WMF, PHOTO_BMP, PHOTO_MET, PHOTO_PMB, - PHOTO_DIB, PHOTO_PICT, PHOTO_TIFF, PHOTO_PS, PHOTO_PDF, PHOTO_JPEG, - PHOTO_MPEG, PHOTO_MPEG2, PHOTO_AVI, PHOTO_QTIME -} ECardPhotoType; - -/* DELIVERY ADDRESSING PROPERTIES */ - -typedef enum { - ADDR_HOME = 1 << 0, - ADDR_WORK = 1 << 1, - ADDR_POSTAL = 1 << 2, - ADDR_PARCEL = 1 << 3, - ADDR_DOM = 1 << 4, - ADDR_INTL = 1 << 5 -} ECardAddrFlags; - -typedef struct { - ECardAddrFlags flags; - - char *pobox; - char *ext; - char *street; - char *city; - char *region; - char *code; - char *country; -} ECardAddr; - - -typedef struct -{ - ECardAddrFlags flags; - char *data; -} ECardAddrLabel; - -/* ORGANIZATIONAL PROPERTIES */ - -typedef struct { - char *name; - char *unit1; - char *unit2; - char *unit3; - char *unit4; -} ECardOrg; - -typedef enum { - SOUND_AIFF, - SOUND_PCM, - SOUND_WAVE, - SOUND_PHONETIC -} ECardSoundType; - -typedef enum { - KEY_X509, - KEY_PGP -} ECardKeyType; - -typedef struct { - int utc; - struct tm tm; -} ECardRev; - - -typedef struct { - enum SoundType type; - unsigned int size; - char *data; -} ECardSound; - -typedef struct { - CardProperty prop; - - enum KeyType type; - char *data; -} ECardKey; - -#endif /* __E_CARD_TYPES_H__ */ diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c deleted file mode 100644 index bc5b13deae..0000000000 --- a/addressbook/backend/ebook/e-card.c +++ /dev/null @@ -1,1856 +0,0 @@ -/* - * Authors: - * Arturo Espinosa (arturo@nuclecu.unam.mx) - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#include -#include -#include -#include -#include - -#include "../libversit/vcc.h" -#include -#include - -#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop) -#define str_val(obj) the_str = (vObjectValueType (obj))? fakeCString (vObjectUStringZValue (obj)) : calloc (1, 1) -#define has(obj,prop) (vo = isAPropertyOf (obj, prop)) - -static VObject *card_convert_to_vobject (Card *crd); - -/* - * ECard lifecycle management and vCard loading/saving. - */ - -/** - * e_card_new: - */ -ECard * -e_card_new (void) -{ - ECard *c; - - c = g_new0 (ECard, 1); - - c->fname = - c->mailer = - c->title = - c->role = - c->comment = - c->categories = - c->url = - c->uid = e_card_prop_str_empty (); - - c->photo.type = PHOTO_JPEG; - c->logo.type = PHOTO_JPEG; - c->rev.utc = -1; - c->sound.type = SOUND_PHONETIC; - c->key.type = KEY_PGP; - - c->categories.prop.encod = ENC_QUOTED_PRINTABLE; - c->comment.prop.encod = ENC_QUOTED_PRINTABLE; - - c->name.prop = c->photo.prop = c->bday.prop = c->timezn.prop = - c->geopos.prop = c->logo.prop = c->org.prop = c->rev.prop = - c->sound.prop = c->key.prop = c->deladdr.prop = c->dellabel.prop = - c->phone.prop = c->email.prop = c->xtension.prop = c->prop = e_card_prop_empty (); - - c->prop.type = PROP_CARD; - c->fname.prop.type = PROP_FNAME; - c->name.prop.type = PROP_NAME; - c->photo.prop.type = PROP_PHOTO; - c->bday.prop.type = PROP_BDAY; - - c->deladdr.prop.type = PROP_DELADDR_LIST; - c->dellabel.prop.type = PROP_DELLABEL_LIST; - c->phone.prop.type = PROP_PHONE_LIST; - c->email.prop.type = PROP_EMAIL_LIST; - c->xtension.prop.type = PROP_XTENSION_LIST; - c->mailer.prop.type = PROP_MAILER; - c->timezn.prop.type = PROP_TIMEZN; - c->geopos.prop.type = PROP_GEOPOS; - c->title.prop.type = PROP_TITLE; - c->role.prop.type = PROP_ROLE; - c->logo.prop.type = PROP_LOGO; - c->org.prop.type = PROP_ORG; - c->categories.prop.type = PROP_CATEGORIES; - c->comment.prop.type = PROP_COMMENT; - c->rev.prop.type = PROP_REV; - c->sound.prop.type = PROP_SOUND; - c->url.prop.type = PROP_URL; - c->uid.prop.type = PROP_UID; - c->key.prop.type = PROP_KEY; - - return c; -} - -static void -e_card_str_free (CardStrProperty *sp) -{ - g_free (sp->str); - - e_card_prop_free (sp->prop); -} - -static void -e_card_name_free (CardName *name) -{ - g_free (name->family); - g_free (name->given); - g_free (name->additional); - g_free (name->prefix); - g_free (name->suffix); - - e_card_prop_free (name->prop); -} - -static void -e_card_photo_free (CardPhoto *photo) -{ - g_free (photo->data); - - e_card_prop_free (photo->prop); -} - -/** - * e_card_free: - */ -void -e_card_free (ECard *card) -{ - GList *l; - - g_return_if_fail (card != NULL); - - e_card_name_free (& card->name); - e_card_str_free (& card->fname); - - e_card_photo_free (card->photo); - - e_card_logo_free (card->logo); - e_card_org_free (card->org); - e_card_key_free (card->key); - e_card_sound_free (card->sound); - - e_card_prop_str_free (& card->mailer); - e_card_prop_str_free (& card->title); - e_card_prop_str_free (& card->role); - e_card_prop_str_free (& card->categories); - e_card_prop_str_free (& card->comment); - e_card_prop_str_free (& card->url); - e_card_prop_str_free (& card->uid); - - /* address is a little more complicated */ - card_prop_free (card->deladdr.prop); - while ((l = card->deladdr.l)) { - - e_card_deladdr_free ((CardDelAddr *) l->data); - - card->deladdr.l = g_list_remove_link (card->deladdr.l, l); - g_list_free (l); - } - - g_free (card); -} - -typedef struct -{ - char c; - int id; - - GList *sons; -} tree; - -extern CardProperty -e_card_prop_empty (void) -{ - CardProperty prop; - - prop.used = FALSE; - - prop.type = PROP_NONE; - prop.encod = ENC_7BIT; - prop.value = VAL_INLINE; - prop.charset = NULL; - prop.lang = NULL; - prop.grp = NULL; - prop.xtension = NULL; - - prop.user_data = NULL; - - return prop; -} - -static CardStrProperty -e_card_prop_str_empty (void) -{ - CardStrProperty strprop; - - strprop.prop = card_prop_empty (); - strprop.str = NULL; - - return strprop; -} - -/* Intended to check asserts. */ -extern int card_check_prop (CardProperty prop) -{ - if (((prop.used == FALSE) || (prop.used == TRUE)) && - ((prop.type >= PROP_NONE) && (prop.type <= PROP_LAST)) && - ((prop.encod >= ENC_NONE) && (prop.encod <= ENC_LAST)) && - ((prop.value >= VAL_NONE) && (prop.value <= VAL_LAST))) - return TRUE; - - return FALSE; -} - -extern void -card_prop_free (CardProperty prop) -{ - GList *l; - - g_free (prop.charset); - g_free (prop.lang); - - for (l = prop.xtension; l; l = l->next) { - CardXAttribute *xa = (CardXAttribute *) l->data; - g_free (xa->name); - g_free (xa->data); - } - - g_list_free (l); - - prop.used = FALSE; -} - -e_card_deladdr_free (ECardDelAddr *c) -{ - card_prop_free (c->prop); - - g_free (p->pobox); - g_free (p->ext); - g_free (p->street); - g_free (p->city); - g_free (p->region); - g_free (p->code); - g_free (p->country); -} - -void -card_free (Card *crd) -{ -} - -static tree * -new_tree (char c, int id) -{ - tree *t; - - t = malloc (sizeof (tree)); - t->c = c; - t->id = id; - t->sons = NULL; - - return t; -} - -static void -add_branch (tree *t, char *str, int id) -{ - tree *tmp; - char *end; - - end = str + strlen (str) + 1; - - while (str != end) { - tmp = new_tree (*str, id); - t->sons = g_list_append (t->sons, (gpointer) tmp); - t = tmp; - - str ++; - } -} - -static tree * -add_to_tree (tree *t, struct pair p) -{ - GList *node; - char *c, *end; - tree *tmp; - - c = p.str; - end = c + strlen (c) + 1; - tmp = t; - - while (c != end) { - for (node = tmp->sons; node; node = node->next) - if (((tree *) node->data)->c == *c) { - break; - } - - if (node) { - tmp = (tree *) node->data; - tmp->id = 0; - c++; - } - else { - add_branch (tmp, c, p.id); - break; - } - } - - return t; -} - -static tree * -create_search_tree (void) -{ - tree *t; - int i; - - t = new_tree (0, 0); - for (i = 0; prop_lookup[i].str; i++) - t = add_to_tree (t, prop_lookup[i]); - - return t; -} - -static int -card_lookup_name (const char *c) -{ - static tree *search_tree = NULL; - GList *node; - tree *tmp; - const char *end; - - if (!search_tree) - search_tree = create_search_tree (); - - tmp = search_tree; - end = c + strlen (c) + 1; - - while (tmp->id == 0 && c != end) { - for (node = tmp->sons; node; node = node->next) - if (((tree *) node->data)->c == *c) { - break; - } - - if (node) { - tmp = (tree *) node->data; - c++; - } - else - return 0; - } - - return tmp->id; -} - -static enum PhotoType -get_photo_type (VObject *o) -{ - VObject *vo; - int i; - - for (i = 0; photo_pairs[i].str; i++) - if (has (o, photo_pairs[i].str)) - return photo_pairs[i].id; - - g_warning ("? < No PhotoType for Photo property. Falling back to JPEG."); - return PHOTO_JPEG; -} - -static int -get_addr_type (VObject *o) -{ - VObject *vo; - int ret = 0; - int i; - - for (i = 0; addr_pairs[i].str; i++) - if (has (o, addr_pairs[i].str)) - ret |= addr_pairs[i].id; - - return ret; -} - -static int -get_phone_type (VObject *o) -{ - VObject *vo; - int ret = 0; - int i; - - for (i = 0; phone_pairs[i].str; i++) - if (has (o, phone_pairs[i].str)) - ret |= phone_pairs[i].id; - - return ret; -} - -static enum EMailType -get_email_type (VObject *o) -{ - VObject *vo; - int i; - - for (i = 0; email_pairs[i].str; i++) - if (has (o, email_pairs[i].str)) - return email_pairs[i].id; - - g_warning ("? < No EMailType for EMail property. Falling back to INET."); - return EMAIL_INET; -} - -static CardProperty -get_CardProperty (VObject *o) -{ - VObjectIterator i; - CardProperty prop; - - prop = card_prop_empty (); - prop.used = TRUE; - - initPropIterator (&i, o); - while (moreIteration (&i)) { - VObject *vo = nextVObject (&i); - const char *n = vObjectName (vo); - int propid; - - propid = card_lookup_name (n); - - switch (propid) { - - case PROP_VALUE: - - if (has (vo, VCContentIDProp)) - prop.value = VAL_CID; - else if (has (vo, VCURLValueProp)) - prop.value = VAL_URL; - break; - - case PROP_ENCODING: - if (has (vo, VCQuotedPrintableProp)) - prop.encod = ENC_QUOTED_PRINTABLE; - else if (has (vo, VC8bitProp)) - prop.encod = ENC_8BIT; - else if (has (vo, VCBase64Prop)) - prop.encod = ENC_BASE64; - break; - - case PROP_QUOTED_PRINTABLE: - prop.encod = ENC_QUOTED_PRINTABLE; - break; - - case PROP_8BIT: - prop.encod = ENC_8BIT; - break; - - case PROP_BASE64: - prop.encod = ENC_BASE64; - break; - - case PROP_LANG: - if (vObjectValueType (vo)) { - prop.lang = - g_strdup (vObjectStringZValue (vo)); - } else - g_warning ("? < No value for LANG attribute."); - break; - - case PROP_CHARSET: - if (vObjectValueType (vo)) { - prop.charset = - g_strdup (vObjectStringZValue (vo)); - g_warning (prop.charset); - } else - g_warning ("? < No value for CHARSET attribute."); - break; - default: - { - CardXAttribute *c; - - c = malloc (sizeof (CardXAttribute)); - c->name = g_strdup (n); - - if (vObjectValueType (vo)) - c->data = - g_strdup (vObjectStringZValue (vo)); - else - c->data = NULL; - - prop.xtension = - g_list_append (prop.xtension, c); - } - } - } - - return prop; -} - -static gboolean -e_card_prop_has (VObject *o, - const char *id) -{ - g_assert (o != NULL); - g_assert (id != NULL); - - if (isAPropertyOf (o, id) == NULL) - return FALSE; - - return TRUE; -} - -static const char * -e_card_prop_get_str (VObject *o, - const char *id) -{ - VObject *strobj; - - g_assert (o != NULL); - g_assert (id != NULL); - - strobj = isAPropertyOf (o, id); - - if (strobj == NULL) - return g_strdup (""); - - if (vObjectValueType (strobj) != NULL) { - char *str; - char *g_str; - - str = fakeCString (vObjectStringZValue (strobj)); - g_str = g_strdup (str); - free (str); - - return g_str; - } - - return g_strdup (""); -} - -static ECardName * -e_card_get_name (VObject *o) -{ - CardName *name; - VObject *vo; - char *the_str; - - name = g_new0 (ECardName, 1); - - name->family = e_card_prop_get_substr (o, VCFamilyNameProp); - name->given = e_card_prop_get_substr (o, VCGivenNameProp); - name->additional = e_card_prop_get_substr (o, VCAdditionalNamesProp); - name->prefix = e_card_prop_get_substr (o, VCNamePrefixesProp); - name->suffix = e_card_prop_get_substr (o, VCNameSuffixesProp); - - return name; -} - -static CardBDay -strtoCardBDay (char *str) -{ - char *s; - int i; - CardBDay bday; - - bday.year = 0; - bday.month = 0; - bday.day = 0; - - if (strchr (str, '-')) { - for (s = strtok (str, "-"), i = 0; s; - s = strtok (NULL, "-"), i++) - switch (i) { - case 0: - bday.year = atoi (s); - break; - case 1: - bday.month = atoi (s); - break; - case 2: - bday.day = atoi (s); - break; - default: - g_warning ("? < Too many values for BDay property."); - } - - if (i < 2) - g_warning ("? < Too few values for BDay property."); - } else { - if (strlen (str) >= 8) { - bday.day = atoi (str + 6); - str[6] = 0; - bday.month = atoi (str + 4); - str[4] = 0; - bday.year = atoi (str); - } else - g_warning ("? < Bad format for BDay property."); - } - - return bday; -} - -static ECardDelAddr * -e_card_get_del_addr (VObject *o) -{ - ECardDelAddr *addr; - - addr = g_new0 (ECardDelAddr, 1); - - addr->type = get_addr_type (o); - addr->po = e_card_prop_get_substr (o, VCPostalBoxProp); - addr->ext = e_card_prop_get_substr (o, VCExtAddressProp); - addr->street = e_card_prop_get_substr (o, VCStreetAddressProp); - addr->city = e_card_prop_get_substr (o, VCCityProp); - addr->region = e_card_prop_get_substr (o, VCRegionProp); - addr->code = e_card_prop_get_substr (o, VCPostalBoxProp); - addr->country = e_card_prop_get_substr (o, VCCountryNameProp); - - return addr; -} - -static CardDelLabel * -get_CardDelLabel (VObject *o) -{ - CardDelLabel *dellabel; - char *the_str; - - dellabel = malloc (sizeof (CardDelLabel)); - - dellabel->type = get_addr_type (o); - dellabel->data = g_strdup (str_val (o)); - - free (the_str); - return dellabel; -} - -static CardPhone * -get_CardPhone (VObject *o) -{ - CardPhone *ret; - char *the_str; - - ret = malloc (sizeof (CardPhone)); - ret->type = get_phone_type (o); - ret->data = g_strdup (str_val (o)); - - free (the_str); - - return ret; -} - -static CardEMail * -get_CardEMail (VObject *o) -{ - CardEMail *ret; - char *the_str; - - ret = malloc (sizeof (CardEMail)); - ret->type = get_email_type (o); - ret->data = g_strdup (str_val (o)); - - free (the_str); - - return ret; -} - -static CardTimeZone -strtoCardTimeZone (char *str) -{ - char s[3]; - CardTimeZone tz; - - if (*str == '-') { - tz.sign = -1; - str++; - } else - tz.sign = 1; - - tz.hours = 0; - tz.mins = 0; - - s[2] = 0; - if (strlen (str) > 2) { - s[0] = str[0]; - s[1] = str[1]; - tz.hours = atoi (s); - } else { - g_warning ("? < TimeZone value is too short."); - return tz; - } - - str += 2; - if (*str == ':') - str++; - - if (strlen (str) >= 2) { - s[0] = str[0]; - s[1] = str[1]; - tz.mins = atoi (s); - } else { - g_warning ("? < TimeZone value is too short."); - return tz; - } - - if (strlen (str) > 3) - g_warning ("? < TimeZone value is too long."); - - return tz; -} - -static CardGeoPos -strtoCardGeoPos (char *str) -{ - CardGeoPos gp; - char *s; - - gp.lon = 0; - gp.lat = 0; - - s = strchr (str, ','); - - if (! s) { - g_warning ("? < Bad format for GeoPos property."); - return gp; - } - - *s = 0; - s++; - - gp.lon = atof (str); - gp.lat = atof (s); - - return gp; -} - -static CardOrg * -e_card_vobject_to_org (VObject *o) -{ - VObject *vo; - char *the_str; - CardOrg *org; - - org = g_new0 (CardOrg, 1); - - if (has (o, VCOrgNameProp)) { - org.name = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnitProp)) { - org.unit1 = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnit2Prop)) { - org.unit2 = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnit3Prop)) { - org.unit3 = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnit4Prop)) { - org.unit4 = g_strdup (str_val (vo)); - free (the_str); - } - - return org; -} - -static CardXProperty * -get_XProp (VObject *o) -{ - char *the_str; - CardXProperty *ret; - - ret = malloc (sizeof (CardXProperty)); - ret->name = g_strdup (vObjectName (o)); - ret->data = g_strdup (str_val (o)); - free (the_str); - - return ret; -} - -static CardRev -strtoCardRev (char *str) -{ - char s[3], *t, *ss; - int len, i; - CardRev rev; - - rev.utc = 0; - len = strlen (str); - - if (str[len] == 'Z') { /* Is it UTC? */ - rev.utc = 1; - str[len] = 0; - } - - s[2] = 0; - t = strchr (str, 'T'); - if (t) { /* Take the Time */ - *t = 0; - t++; - if (strlen (t) > 2) { - s[0] = t[0]; - s[1] = t[1]; - rev.tm.tm_hour = atoi (s); - } else { - g_warning ("? < Rev value is too short."); - return rev; - } - - t += 2; - if (*t == ':') /* Ignore ':' separator */ - t++; - - if (strlen (t) > 2) { - s[0] = t[0]; - s[1] = t[1]; - rev.tm.tm_min = atoi (s); - } else { - g_warning ("? < Rev value is too short."); - return rev; - } - - t += 2; - if (*t == ':') - t++; - - if (strlen (t) > 2) { - s[0] = t[0]; - s[1] = t[1]; - rev.tm.tm_sec = atoi (s); - } else { - g_warning ("? < Rev value is too short."); - return rev; - } - - if (strlen (str) > 3) - g_warning ("? < Rev value is too long."); - - } else { - g_warning ("? < No time value for Rev property."); - } - - /* Now the date (the part before the T) */ - - if (strchr (str, '-')) { /* extended iso 8601 */ - for (ss = strtok (str, "-"), i = 0; ss; - ss = strtok (NULL, "-"), i++) - switch (i) { - case 0: - rev.tm.tm_year = atoi (ss); - break; - case 1: - rev.tm.tm_mon = atoi (ss); - break; - case 2: - rev.tm.tm_mday = atoi (ss); - break; - default: - g_warning ("? < Too many values for Rev property."); - } - - if (i < 2) - g_warning ("? < Too few values for Rev property."); - } else { - if (strlen (str) >= 8) { /* short representation */ - rev.tm.tm_mday = atoi (str + 6); - str[6] = 0; - rev.tm.tm_mon = atoi (str + 4); - str[4] = 0; - rev.tm.tm_year = atoi (str); - } else - g_warning ("? < Bad format for Rev property."); - } - - return rev; -} - -static enum KeyType -get_key_type (VObject *o) -{ - VObject *vo; - int i; - - for (i = 0; key_pairs[i].str; i++) - if (has (o, key_pairs[i].str)) - return key_pairs[i].id; - - g_warning ("? < No KeyType for Key property. Falling back to PGP."); - return KEY_PGP; -} - -static CardPhoto -get_CardPhoto (VObject *o) -{ - VObject *vo; - char *the_str; - CardPhoto photo; - - photo.type = get_photo_type (o); - - if (has (o, VCDataSizeProp)) { - photo.size = vObjectIntegerValue (vo); - photo.data = malloc (photo.size); - memcpy (photo.data, vObjectAnyValue (o), photo.size); - } else { - photo.size = strlen (str_val (o)) + 1; - photo.data = g_strdup (the_str); - free (the_str); - } - - return photo; -} - -static enum SoundType -get_sound_type (VObject *o) -{ - VObject *vo; - int i; - - for (i = 0; sound_pairs[i].str; i++) - if (has (o, sound_pairs[i].str)) - return sound_pairs[i].id; - - return SOUND_PHONETIC; -} - -static CardSound -get_CardSound (VObject *o) -{ - VObject *vo; - char *the_str; - CardSound sound; - - sound.type = get_sound_type (o); - - if (has (o, VCDataSizeProp)) { - sound.size = vObjectIntegerValue (vo); - sound.data = malloc (sound.size); - memcpy (sound.data, vObjectAnyValue (o), sound.size); - } else { - sound.size = strlen (str_val (o)); - sound.data = g_strdup (the_str); - free (the_str); - } - - return sound; -} - -/* Loads our card contents from a VObject */ -static ECard * -e_card_construct_from_vobject (ECard *card, - VObject *vcrd) -{ - VObjectIterator i; - Card *crd; - char *the_str; - - initPropIterator (&i, vcrd); - crd = card_new (); - - while (moreIteration (&i)) { - VObject *o = nextVObject (&i); - const char *n = vObjectName (o); - int propid; - CardProperty *prop = NULL; - - propid = card_lookup_name (n); - - switch (propid) { - case PROP_FNAME: - prop = &crd->fname.prop; - crd->fname.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_NAME: - prop = &crd->name.prop; - crd->name = e_card_get_name (o); - break; - case PROP_PHOTO: - prop = &crd->photo.prop; - crd->photo = get_CardPhoto (o); - break; - case PROP_BDAY: - prop = &crd->bday.prop; - crd->bday = strtoCardBDay (str_val (o)); - free (the_str); - break; - case PROP_DELADDR: - { - CardDelAddr *c; - c = get_CardDelAddr (o); - prop = &c->prop; - crd->deladdr.l = g_list_append (crd->deladdr.l, c); - } - break; - case PROP_DELLABEL: - { - CardDelLabel *c; - c = get_CardDelLabel (o); - prop = &c->prop; - crd->dellabel.l = g_list_append (crd->dellabel.l, c); - } - break; - case PROP_PHONE: - { - CardPhone *c; - - c = get_CardPhone (o); - prop = &c->prop; - crd->phone.l = g_list_append (crd->phone.l, c); - } - break; - case PROP_EMAIL: - { - CardEMail *c; - - c = get_CardEMail (o); - prop = &c->prop; - crd->email.l = g_list_append (crd->email.l, c); - } - break; - case PROP_MAILER: - prop = &crd->mailer.prop; - crd->mailer.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_TIMEZN: - prop = &crd->timezn.prop; - crd->timezn = strtoCardTimeZone (str_val (o)); - free (the_str); - break; - case PROP_GEOPOS: - prop = &crd->geopos.prop; - crd->geopos = strtoCardGeoPos (str_val (o)); - break; - case PROP_TITLE: - prop = &crd->title.prop; - crd->title.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_ROLE: - prop = &crd->role.prop; - crd->role.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_LOGO: - prop = &crd->logo.prop; - crd->logo = get_CardPhoto (o); - break; - case PROP_AGENT: - crd->agent = card_create_from_vobject (o); - break; - case PROP_ORG: - prop = &crd->org.prop; - crd->org = get_CardOrg (o); - break; - case PROP_CATEGORIES: - prop = &crd->categories.prop; - crd->categories.str = g_strdup (str_val (o)); - crd->categories.prop.encod = ENC_QUOTED_PRINTABLE; - free (the_str); - break; - case PROP_COMMENT: - prop = &crd->comment.prop; - crd->comment.str = g_strdup (str_val (o)); - crd->comment.prop.encod = ENC_QUOTED_PRINTABLE; - free (the_str); - break; - case PROP_REV: - prop = &crd->rev.prop; - crd->rev = strtoCardRev (str_val (o)); - free (the_str); - break; - case PROP_SOUND: - prop = &crd->sound.prop; - crd->sound = get_CardSound (o); - break; - case PROP_URL: - prop = &crd->url.prop; - crd->url.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_UID: - prop = &crd->uid.prop; - crd->uid.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_VERSION: - { - char *str; - str = str_val (o); - if (strcmp (str, "2.1")) - g_warning ("? < Version doesn't match."); - free (the_str); - } - break; - case PROP_KEY: - prop = &crd->key.prop; - crd->key.type = get_key_type (o); - crd->key.data = g_strdup (str_val (o)); - free (the_str); - break; - default: - { - CardXProperty *c; - - c = get_XProp (o); - prop = &c->prop; - crd->xtension.l = g_list_append (crd->xtension.l, c); - } - break; - } - - if (prop) { - *prop = get_CardProperty (o); - prop->type = propid; - } - } - - return crd; -} - -/* Loads a card from a file */ -GList * -card_load (GList *crdlist, char *fname) -{ - VObject *vobj, *tmp; - - vobj = Parse_MIME_FromFileName (fname); - if (!vobj) { - g_warning ("Could not load the cardfile"); - return NULL; - } - - while (vobj) { - const char *n = vObjectName (vobj); - - if (strcmp (n, VCCardProp) == 0) { - crdlist = g_list_append (crdlist, (gpointer) - card_create_from_vobject (vobj)); - } - tmp = vobj; - vobj = nextVObjectInList (vobj); - cleanVObject (tmp); - } - - cleanVObject (vobj); - cleanStrTbl (); - return crdlist; -} - -static VObject * -add_strProp (VObject *o, const char *id, char *val) -{ - VObject *vo = NULL; - - if (val) - vo = addPropValue (o, id, val); - - return vo; -} - -static VObject * -add_CardProperty (VObject *o, CardProperty *prop) -{ - GList *node; - - switch (prop->encod) { - case ENC_BASE64: - addProp (o, VCBase64Prop); - break; - case ENC_QUOTED_PRINTABLE: - addProp (o, VCQuotedPrintableProp); - break; - case ENC_8BIT: - addProp (o, VC8bitProp); - break; - case ENC_7BIT: - /* Do nothing: 7BIT is the default. Avoids file clutter. */ - break; - default: - g_warning ("? < Card had invalid encoding type."); - } - - switch (prop->value) { - case VAL_CID: - addProp (o, VCContentIDProp); - break; - case VAL_URL: - addProp (o, VCURLValueProp); - break; - case VAL_INLINE: - /* Do nothing: INLINE is the default. Avoids file clutter. */ - break; - default: - g_warning ("? < Card had invalid value type."); - } - - for (node = prop->xtension; node; node = node->next) { - CardXAttribute *xa = (CardXAttribute *) node->data; - if (xa->data) - addPropValue (o, xa->name, xa->data); - else - addProp (o, xa->name); - } - - add_strProp (o, VCCharSetProp, prop->charset); - add_strProp (o, VCLanguageProp, prop->lang); - - return o; -} - -static VObject * -add_CardStrProperty (VObject *vobj, const char *id, CardStrProperty *strprop) -{ - VObject *vprop; - - if (strprop->prop.used) { - vprop = add_strProp (vobj, id, strprop->str); - add_CardProperty (vprop, &strprop->prop); - } - - return vobj; -} - -static VObject * -add_PhotoType (VObject *o, enum PhotoType photo_type) -{ - int i; - - for (i = 0; photo_pairs[i].str; i++) - if (photo_type == photo_pairs[i].id) { - addProp (o, photo_pairs[i].str); - return o; - } - - g_warning ("? > No PhotoType for Photo property. Falling back to JPEG."); - addProp (o, VCJPEGProp); - - return o; -} - -static VObject * -add_AddrType (VObject *o, int addr_type) -{ - int i; - - for (i = 0; addr_pairs[i].str; i++) - if (addr_type & addr_pairs[i].id) - addProp (o, addr_pairs[i].str); - - return o; -} - -static void -add_strAddrType (GString *string, int addr_type) -{ - int i, first = 1; - char *str; - - if (addr_type) { - g_string_append (string, " ("); - - for (i = 0; addr_pairs[i].str; i++) - if (addr_type & addr_pairs[i].id) { - if (!first) - g_string_append (string, ", "); - first = 0; - str = my_cap (addr_pairs[i].str); - g_string_append (string, str); - g_free (str); - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_PhoneType (VObject *o, int phone_type) -{ - int i; - - for (i = 0; phone_pairs[i].str; i++) - if (phone_type & phone_pairs[i].id) - addProp (o, phone_pairs[i].str); - - return o; -} - -static void -add_strPhoneType (GString *string, int phone_type) -{ - int i, first = 1; - char *str; - - if (phone_type) { - g_string_append (string, " ("); - - for (i = 0; phone_pairs[i].str; i++) - if (phone_type & phone_pairs[i].id) { - if (!first) - g_string_append (string, ", "); - first = 0; - str = my_cap (phone_pairs[i].str); - g_string_append (string, str); - g_free (str); - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_EMailType (VObject *o, enum EMailType email_type) -{ - int i; - - for (i = 0; email_pairs[i].str; i++) - if (email_type == email_pairs[i].id) { - addProp (o, email_pairs[i].str); - return o; - } - - g_warning ("? > No EMailType for EMail property. Falling back to INET."); - addProp (o, VCInternetProp); - - return o; -} - -static void -add_strEMailType (GString *string, int email_type) -{ - int i; - char *str; - - if (email_type) { - g_string_append (string, " ("); - - for (i = 0; email_pairs[i].str; i++) - if (email_type == email_pairs[i].id) { - str = my_cap (email_pairs[i].str); - g_string_append (string, str); - g_free (str); - break; - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_KeyType (VObject *o, enum KeyType key_type) -{ - int i; - - for (i = 0; key_pairs[i].str; i++) - if (key_type == key_pairs[i].id) { - addProp (o, key_pairs[i].str); - return o; - } - - g_warning ("? > No KeyType for Key property. Falling back to PGP."); - addProp (o, VCPGPProp); - - return o; -} - -static void -add_strKeyType (GString *string, int key_type) -{ - int i; - char *str; - - if (key_type) { - g_string_append (string, " ("); - - for (i = 0; key_pairs[i].str; i++) - if (key_type == key_pairs[i].id) { - str = my_cap (key_pairs[i].str); - g_string_append (string, str); - g_free (str); - break; - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_SoundType (VObject *o, enum SoundType sound_type) -{ - int i; - - for (i = 0; sound_pairs[i].str; i++) - if (sound_type == sound_pairs[i].id) { - addProp (o, sound_pairs[i].str); - return o; - } - - return o; -} - -char *card_bday_str (CardBDay bday) -{ - char *str; - - str = malloc (12); - snprintf (str, 12, "%04d-%02d-%02d", bday.year, bday.month, bday.day); - - return str; -} - -char *card_timezn_str (CardTimeZone timezn) -{ - char *str; - - str = malloc (7); - snprintf (str, 7, (timezn.sign == -1)? "-%02d:%02d" : "%02d:%02d", - timezn.hours, timezn.mins); - return str; -} - -char *card_geopos_str (CardGeoPos geopos) -{ - char *str; - - str = malloc (15); - snprintf (str, 15, "%03.02f,%03.02f", geopos.lon, geopos.lat); - return str; -} - - -static VObject * -card_convert_to_vobject (Card *crd) -{ - VObject *vobj, *vprop; - - vobj = newVObject (VCCardProp); - - add_CardStrProperty (vobj, VCFullNameProp, &crd->fname); - if (crd->name.prop.used) { - vprop = addProp (vobj, VCNameProp); - add_strProp (vprop, VCFamilyNameProp, crd->name.family); - add_strProp (vprop, VCGivenNameProp, crd->name.given); - add_strProp (vprop, VCAdditionalNamesProp, crd->name.additional); - add_strProp (vprop, VCNamePrefixesProp, crd->name.prefix); - add_strProp (vprop, VCNameSuffixesProp, crd->name.suffix); - add_CardProperty (vprop, &crd->name.prop); - } - - if (crd->photo.prop.used) { - vprop = addPropSizedValue (vobj, VCPhotoProp, - crd->photo.data, crd->photo.size); - add_PhotoType (vprop, crd->photo.type); - add_CardProperty (vprop, &crd->photo.prop); - } - - if (crd->bday.prop.used) { - char *date_str; - - date_str = card_bday_str (crd->bday); - vprop = addPropValue (vobj, VCBirthDateProp, date_str); - free (date_str); - add_CardProperty (vprop, &crd->bday.prop); - } - - if (crd->xtension.l) { - GList *node; - - for (node = crd->xtension.l; node; node = node->next) { - CardXProperty *xp = (CardXProperty *) node->data; - addPropValue (vobj, xp->name, xp->data); - add_CardProperty (vobj, &xp->prop); - } - } - - - if (crd->deladdr.l) { - GList *node; - - for (node = crd->deladdr.l; node; node = node->next) { - CardDelAddr *deladdr = (CardDelAddr *) node->data; - - if (deladdr->prop.used) { - vprop = addProp (vobj, VCAdrProp); - add_AddrType (vprop, deladdr->type); - add_strProp (vprop, VCPostalBoxProp, deladdr->po); - add_strProp (vprop, VCExtAddressProp,deladdr->ext); - add_strProp (vprop, VCStreetAddressProp,deladdr->street); - add_strProp (vprop, VCCityProp, deladdr->city); - add_strProp (vprop, VCRegionProp, deladdr->region); - add_strProp (vprop, VCPostalCodeProp, deladdr->code); - add_strProp (vprop, VCCountryNameProp, deladdr->country); - add_CardProperty (vprop, &deladdr->prop); - } - } - } - - if (crd->dellabel.l) { - GList *node; - - for (node = crd->dellabel.l; node; node = node->next) { - CardDelLabel *dellabel = (CardDelLabel *) node->data; - - vprop = add_strProp (vobj, VCDeliveryLabelProp, - dellabel->data); - add_AddrType (vprop, dellabel->type); - add_CardProperty (vprop, &dellabel->prop); - } - } - - if (crd->phone.l) { - GList *node; - - for (node = crd->phone.l; node; node = node->next) { - CardPhone *phone = (CardPhone *) node->data; - - if (phone->prop.used) { - vprop = add_strProp (vobj, VCTelephoneProp, - (phone->data)? - phone->data: ""); - add_PhoneType (vprop, phone->type); - add_CardProperty (vprop, &phone->prop); - } - } - } - - if (crd->email.l) { - GList *node; - - for (node = crd->email.l; node; node = node->next) { - CardEMail *email = (CardEMail *) node->data; - - if (email->prop.used) { - vprop = add_strProp (vobj, VCEmailAddressProp, - email->data); - add_EMailType (vprop, email->type); - add_CardProperty (vprop, &email->prop); - } - } - } - - add_CardStrProperty (vobj, VCMailerProp, &crd->mailer); - - if (crd->timezn.prop.used) { - char *str; - - str = card_timezn_str (crd->timezn); - vprop = addPropValue (vobj, VCTimeZoneProp, str); - free (str); - add_CardProperty (vprop, &crd->timezn.prop); - } - - if (crd->geopos.prop.used) { - char *str; - - str = card_geopos_str (crd->geopos); - vprop = addPropValue (vobj, VCGeoLocationProp, str); - free (str); - add_CardProperty (vprop, &crd->geopos.prop); - } - - add_CardStrProperty (vobj, VCTitleProp, &crd->title); - add_CardStrProperty (vobj, VCBusinessRoleProp, &crd->role); - - if (crd->logo.prop.used) { - vprop = addPropSizedValue (vobj, VCLogoProp, - crd->logo.data, crd->logo.size); - add_PhotoType (vprop, crd->logo.type); - add_CardProperty (vprop, &crd->logo.prop); - } - - if (crd->agent) - addVObjectProp (vobj, card_convert_to_vobject (crd->agent)); - - if (crd->org.prop.used) { - vprop = addProp (vobj, VCOrgProp); - add_strProp (vprop, VCOrgNameProp, crd->org.name); - add_strProp (vprop, VCOrgUnitProp, crd->org.unit1); - add_strProp (vprop, VCOrgUnit2Prop, crd->org.unit2); - add_strProp (vprop, VCOrgUnit3Prop, crd->org.unit3); - add_strProp (vprop, VCOrgUnit4Prop, crd->org.unit4); - add_CardProperty (vprop, &crd->org.prop); - } - - add_CardStrProperty (vobj, VCCategoriesProp, &crd->categories); - add_CardStrProperty (vobj, VCCommentProp, &crd->comment); - - if (crd->sound.prop.used) { - if (crd->sound.type != SOUND_PHONETIC) - vprop = addPropSizedValue (vobj, VCPronunciationProp, - crd->sound.data, crd->sound.size); - else - vprop = addPropValue (vobj, VCPronunciationProp, - crd->sound.data); - - add_SoundType (vprop, crd->sound.type); - add_CardProperty (vprop, &crd->sound.prop); - } - - add_CardStrProperty (vobj, VCURLProp, &crd->url); - add_CardStrProperty (vobj, VCUniqueStringProp, &crd->uid); - - if (crd->key.prop.used) { - vprop = addPropValue (vobj, VCPublicKeyProp, crd->key.data); - add_KeyType (vprop, crd->key.type); - add_CardProperty (vprop, &crd->key.prop); - } - - return vobj; -} - -static void add_CardStrProperty_to_string (GString *string, char *prop_name, - CardStrProperty *strprop) -{ - if (strprop->prop.used) { - if (prop_name) - g_string_append (string, prop_name); - - g_string_append (string, strprop->str); - } -} - -static void add_strProp_to_string (GString *string, char *prop_name, char *val) -{ - if (val) { - if (prop_name) - g_string_append (string, prop_name); - - g_string_append (string, val); - } -} - -static void addProp_to_string (GString *string, char *prop_name) -{ - if (prop_name) - g_string_append (string, prop_name); -} - -char * -card_to_string (Card *crd) -{ - GString *string; - char *ret; - - string = g_string_new (""); - - add_CardStrProperty_to_string (string, _ ("Card: "), &crd->fname); - if (crd->name.prop.used) { - addProp_to_string (string, _ ("\nName: ")); - add_strProp_to_string (string, _ ("\n Prefix: "), crd->name.prefix); - add_strProp_to_string (string, _ ("\n Given: "), crd->name.given); - add_strProp_to_string (string, _ ("\n Additional: "), crd->name.additional); - add_strProp_to_string (string, _ ("\n Family: "), crd->name.family); - add_strProp_to_string (string, _ ("\n Suffix: "), crd->name.suffix); - g_string_append_c (string, '\n'); - } - -/* if (crd->photo.prop.used) { - addPropSizedValue (string, _ ("\nPhoto: "), - crd->photo.data, crd->photo.size); - add_PhotoType (string, crd->photo.type); - }*/ - - if (crd->bday.prop.used) { - char *date_str; - - date_str = card_bday_str (crd->bday); - add_strProp_to_string (string, _ ("\nBirth Date: "), date_str); - free (date_str); - } - - if (crd->deladdr.l) { - GList *node; - - for (node = crd->deladdr.l; node; node = node->next) { - CardDelAddr *deladdr = (CardDelAddr *) node->data; - - if (deladdr->prop.used) { - addProp_to_string (string, _ ("\nAddress:")); - add_strAddrType (string, deladdr->type); - add_strProp_to_string (string, _ ("\n Postal Box: "), deladdr->po); - add_strProp_to_string (string, _ ("\n Ext: "),deladdr->ext); - add_strProp_to_string (string, _ ("\n Street: "),deladdr->street); - add_strProp_to_string (string, _ ("\n City: "), deladdr->city); - add_strProp_to_string (string, _ ("\n Region: "), deladdr->region); - add_strProp_to_string (string, _ ("\n Postal Code: "), deladdr->code); - add_strProp_to_string (string, _ ("\n Country: "), deladdr->country); - } - } - - g_string_append_c (string, '\n'); - } - - if (crd->dellabel.l) { - GList *node; - - for (node = crd->dellabel.l; node; node = node->next) { - CardDelLabel *dellabel = (CardDelLabel *) node->data; - - add_strProp_to_string (string, _ ("\nDelivery Label: "), - dellabel->data); - add_strAddrType (string, dellabel->type); - } - } - - if (crd->phone.l) { - GList *node; - char *sep; - - if (crd->phone.l->next) { - sep = " "; - g_string_append (string, _ ("\nTelephones:\n")); - } else { - sep = " "; - g_string_append (string, _ ("\nTelephone:")); - } - - for (node = crd->phone.l; node; node = node->next) { - CardPhone *phone = (CardPhone *) node->data; - - if (phone->prop.used) { - g_string_append (string, sep); - g_string_append (string, phone->data); - add_strPhoneType (string, phone->type); - g_string_append_c (string, '\n'); - } - } - - if (crd->phone.l->next) - g_string_append_c (string, '\n'); - } - - if (crd->email.l) { - GList *node; - char *sep; - - if (crd->email.l->next) { - sep = " "; - g_string_append (string, _ ("\nE-mail:\n")); - } else { - sep = " "; - g_string_append (string, _ ("\nE-mail:")); - } - - - for (node = crd->email.l; node; node = node->next) { - CardEMail *email = (CardEMail *) node->data; - - if (email->prop.used) { - g_string_append (string, sep); - g_string_append (string, email->data); - add_strEMailType (string, email->type); - g_string_append_c (string, '\n'); - } - } - - if (crd->email.l->next) - g_string_append_c (string, '\n'); - } - - add_CardStrProperty_to_string (string, _ ("\nMailer: "), &crd->mailer); - - if (crd->timezn.prop.used) { - char *str; - - str = card_timezn_str (crd->timezn); - add_strProp_to_string (string, _ ("\nTime Zone: "), str); - free (str); - } - - if (crd->geopos.prop.used) { - char *str; - - str = card_geopos_str (crd->geopos); - add_strProp_to_string (string, _ ("\nGeo Location: "), str); - free (str); - } - - add_CardStrProperty_to_string (string, _ ("\nTitle: "), &crd->title); - add_CardStrProperty_to_string (string, _ ("\nBusiness Role: "), &crd->role); - -/* if (crd->logo.prop.used) { - addPropSizedValue (string, _ ("\nLogo: "), - crd->logo.data, crd->logo.size); - add_PhotoType (string, crd->logo.type); - }*/ - -/* if (crd->agent) - addstringectProp (string, card_convert_to_stringect (crd->agent));*/ - - if (crd->org.prop.used) { - addProp_to_string (string, _ ("\nOrg: ")); - add_strProp_to_string (string, _ ("\n Name: "), crd->org.name); - add_strProp_to_string (string, _ ("\n Unit: "), crd->org.unit1); - add_strProp_to_string (string, _ ("\n Unit2: "), crd->org.unit2); - add_strProp_to_string (string, _ ("\n Unit3: "), crd->org.unit3); - add_strProp_to_string (string, _ ("\n Unit4: "), crd->org.unit4); - g_string_append_c (string, '\n'); - } - - add_CardStrProperty_to_string (string, _ ("\nCategories: "), &crd->categories); - add_CardStrProperty_to_string (string, _ ("\nComment: "), &crd->comment); - -/* if (crd->sound.prop.used) { - if (crd->sound.type != SOUND_PHONETIC) - addPropSizedValue (string, _ ("\nPronunciation: "), - crd->sound.data, crd->sound.size); - else - add_strProp_to_string (string, _ ("\nPronunciation: "), - crd->sound.data); - - add_SoundType (string, crd->sound.type); - }*/ - - add_CardStrProperty_to_string (string, _ ("\nURL: "), &crd->url); - add_CardStrProperty_to_string (string, _ ("\nUnique String: "), &crd->uid); - - if (crd->key.prop.used) { - add_strProp_to_string (string, _ ("\nPublic Key: "), crd->key.data); - add_strKeyType (string, crd->key.type); - } - - ret = g_strdup (string->str); - g_string_free (string, TRUE); - - return ret; -} - -char * -card_to_vobj_string (Card *crd) -{ - VObject *object; - char *data, *ret_val; - - g_assert (crd != NULL); - - object = card_convert_to_vobject (crd); - data = writeMemVObject (0, 0, object); - ret_val = g_strdup (data); - free (data); - - cleanVObject (object); - - return ret_val; -} - -void -card_save (Card *crd, FILE *fp) -{ - VObject *object; - - g_return_if_fail (crd != NULL); - - object = card_convert_to_vobject (crd); - writeVObject (fp, object); - cleanVObject (object); -} diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h deleted file mode 100644 index 516cb85017..0000000000 --- a/addressbook/backend/ebook/e-card.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Authors: - * Arturo Espinosa - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_H__ -#define __E_CARD_H__ - -#include -#include -#include -#include - -typedef struct _ECard ECard; - -struct _ECard { - - char *fname; /* The full name. */ - ECardName *name; /* The structured name. */ - - GList *del_addrs; /* Delivery addresses (ECardAddr *) */ - GList *del_labels; /* Delivery address labels - * (ECardAddrLabel *) */ - GList *phone; /* Phone numbers (ECardPhone *) */ - GList *email; /* Email addresses (char *) */ - char *url; /* The person's web page. */ - - ECardDate *bday; /* The person's birthday. */ - - ECardOrg *org; /* The person's organization. */ - char *title; /* The person's title w/in his org */ - char *role; /* The person's role w/in his org */ - ECardPhoto *logo; /* This person's org's logo. */ - - ECardPhoto *photo; /* A photo of the person. */ - - ECard *agent; /* A person who sereves as this - guy's agent/secretary/etc. */ - - - char *categories; /* A list of the categories to which - this card belongs. */ - - char *comment; /* An unstructured comment string. */ - - ECardSound *sound; - - ECardKey *key; /* The person's public key. */ - ECardTimeZone *timezn; /* The person's time zone. */ - ECardGeoPos *geopos; /* The person's long/lat. */ - - char *mailer; /* The user's mailer. */ - - char *uid; /* This card's unique identifier. */ - ECardRev *rev; /* The time this card was last - modified. */ - - CardList xtension; -}; - -Card *card_new (void); -void card_free (Card *crd); -void card_prop_free (CardProperty prop); -CardProperty card_prop_empty (void); -int card_check_prop (CardProperty prop); -GList *card_load (GList *crdlist, char *fname); -void card_save (Card *crd, FILE *fp); -char *card_to_vobj_string (Card *card); -char *card_to_string (Card *card); - -char *card_bday_str (CardBDay bday); -char *card_timezn_str (CardTimeZone timezn); -char *card_geopos_str (CardGeoPos geopos); - -#endif /* ! __E_CARD_H__ */ diff --git a/addressbook/backend/idl/Makefile.am b/addressbook/backend/idl/Makefile.am deleted file mode 100644 index db61d2c30c..0000000000 --- a/addressbook/backend/idl/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -idldir = $(datadir)/idl - -idl_DATA = \ - addressbook.idl - -EXTRA_DIST = $(idl_DATA) diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl deleted file mode 100644 index eabab4b5c2..0000000000 --- a/addressbook/backend/idl/addressbook.idl +++ /dev/null @@ -1,83 +0,0 @@ -/* - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include - -module Evolution { - - typedef string CardId; - - interface CardCursor { - long get_length (); - string get_nth (in long n); - }; - - interface Book : GNOME::Unknown { - /* - * Fetching cards in the addresbook. - */ - string get_vcard (in CardId id); - - /* - * Adding and deleting cards in the book. - */ - void create_card (in string vcard); - void remove_card (in CardId Id); - - /* - * Modifying cards in the addressbook. - */ - void modify_card (in string vcard); - - void check_connection (); - - string get_name (); - }; - - interface BookListener : GNOME::Unknown { - - enum CallStatus { - Success, - RepositoryOffline, - PermissionDenied, - CardNotFound - }; - - void respond_create_card (in CallStatus status); - - void respond_remove_card (in CallStatus status); - - void respond_modify_card (in CallStatus status); - - void report_open_book_progress (in string status_message, in short percent); - - void respond_open_book (in CallStatus status, in Book book); - - /** - * report_connection_status: - * - * Used to report changes in the connection to the - * contact repository. This is often a response to a - * call to check_connection() on the Book, but wombat - * is free to report the connection status without - * being asked. - */ - void report_connection_status (in boolean connected); - - void signal_card_added (in CardId id); - void signal_card_removed (in CardId id); - void signal_card_changed (in CardId id); - }; - - interface BookFactory : GNOME::Unknown { - exception ProtocolNotSupported {}; - - void open_book (in string uri, in BookListener listener) - raises (ProtocolNotSupported); - }; -}; diff --git a/addressbook/backend/pas/Makefile.am b/addressbook/backend/pas/Makefile.am deleted file mode 100644 index 36eeab0782..0000000000 --- a/addressbook/backend/pas/Makefile.am +++ /dev/null @@ -1,72 +0,0 @@ -bin_PROGRAMS = wombat -lib_LTLIBRARIES = libpas.la - -corbadir = $(sysconfdir)/CORBA/servers - -CORBA_SOURCE = \ - addressbook.h \ - addressbook-common.c \ - addressbook-stubs.c \ - addressbook-skels.c - -idls = \ - ../idl/addressbook.idl - -idl_flags = `$(GNOME_CONFIG) --cflags idl` - -$(CORBA_SOURCE): $(idls) - $(ORBIT_IDL) ../idl/addressbook.idl $(idl_flags) - -INCLUDES = \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DG_LOG_DOMAIN=\"Wombat\" \ - -I$(srcdir) -I$(top_srcdir) \ - -I. \ - -I.. \ - -I$(top_builddir) \ - -I$(includedir) \ - $(GNOME_INCLUDEDIR) - -gnome_libs = \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) - -pas_libs = \ - libpas.la \ - $(gnome_libs) - - -libpas_la_SOURCES = \ - $(CORBA_SOURCE) \ - pas-book.c \ - pas-book-factory.c \ - pas-backend.c \ - pas-backend-file.c - -libpasincludedir = $(includedir)/backend - -libpasinclude_HEADERS = \ - pas-book.h \ - pas-book-factory.h \ - pas-backend.h \ - pas-backend-file.h - -wombat_SOURCES = \ - pas.c - -wombat_LDADD = \ - $(GTK_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOMEGNORBA_LIBS) \ - $(INTLLIBS) \ - -lbonobo \ - $(pas_libs) - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = wombat.gnorba - -BUILT_SOURCES = $(CORBA_SOURCE) -CLEANFILES += $(BUILT_SOURCES) -EXTRA_DIST = $(gnorba_DATA) \ No newline at end of file diff --git a/addressbook/backend/pas/TODO b/addressbook/backend/pas/TODO deleted file mode 100644 index 0c77c1b200..0000000000 --- a/addressbook/backend/pas/TODO +++ /dev/null @@ -1,2 +0,0 @@ -* Implement pas_book_factory_activate -* Authentication \ No newline at end of file diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c deleted file mode 100644 index f23b607efe..0000000000 --- a/addressbook/backend/pas/pas-backend-file.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include -#include - -#include -#include - -static PASBackendClass *pas_backend_file_parent_class; - -struct _PASBackendFilePrivate { - GList *clients; - gboolean loaded; -}; - -static void -pas_backend_file_process_create_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - pas_book_respond_create ( - book, Evolution_BookListener_Success); - - g_free (req->vcard); -} - -static void -pas_backend_file_process_remove_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - pas_book_respond_remove ( - book, Evolution_BookListener_Success); - - g_free (req->id); -} - -static void -pas_backend_file_process_modify_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - pas_book_respond_modify ( - book, Evolution_BookListener_Success); - - g_free (req->vcard); -} - -static void -pas_backend_file_process_check_connection (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - pas_book_report_connection (book, TRUE); -} - -static void -pas_backend_file_process_client_requests (PASBook *book) -{ - PASBackend *backend; - PASRequest *req; - - backend = pas_book_get_backend (book); - - req = pas_book_pop_request (book); - if (req == NULL) - return; - - switch (req->op) { - case CreateCard: - pas_backend_file_process_create_card (backend, book, req); - break; - - case RemoveCard: - pas_backend_file_process_remove_card (backend, book, req); - break; - - case ModifyCard: - pas_backend_file_process_modify_card (backend, book, req); - - case CheckConnection: - pas_backend_file_process_check_connection (backend, book, req); - break; - } - - g_free (req); -} - -static void -pas_backend_file_book_destroy_cb (PASBook *book) -{ - PASBackendFile *backend; - - backend = PAS_BACKEND_FILE (pas_book_get_backend (book)); - - pas_backend_remove_client (PAS_BACKEND (backend), book); -} - -static char * -pas_backend_file_get_vcard (PASBook *book, const char *id) -{ - return g_strdup ("blah blah blah"); -} - -static char * -pas_backend_file_extract_path_from_uri (const char *uri) -{ - g_assert (strncasecmp (uri, "file:", 5) == 0); - - return g_strdup (uri + 5); -} - -static void -pas_backend_file_load_uri (PASBackend *backend, - const char *uri) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - char *filename; - - g_assert (PAS_BACKEND_FILE (backend)->priv->loaded == FALSE); - - filename = pas_backend_file_extract_path_from_uri (uri); -} - -static void -pas_backend_file_add_client (PASBackend *backend, - Evolution_BookListener listener) -{ - PASBackendFile *bf; - PASBook *book; - - g_assert (backend != NULL); - g_assert (PAS_IS_BACKEND_FILE (backend)); - - bf = PAS_BACKEND_FILE (backend); - - book = pas_book_new ( - backend, listener, - pas_backend_file_get_vcard); - - g_assert (book != NULL); - - gtk_signal_connect (GTK_OBJECT (book), "destroy", - pas_backend_file_book_destroy_cb, NULL); - - gtk_signal_connect (GTK_OBJECT (book), "requests_queued", - pas_backend_file_process_client_requests, NULL); - - bf->priv->clients = g_list_prepend ( - bf->priv->clients, book); - - if (bf->priv->loaded) { - pas_book_respond_open ( - book, Evolution_BookListener_Success); - } else { - /* Open the book. */ - pas_book_respond_open ( - book, Evolution_BookListener_Success); - } -} - -static void -pas_backend_file_remove_client (PASBackend *backend, - PASBook *book) -{ - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND (backend)); - g_return_if_fail (book != NULL); - g_return_if_fail (PAS_IS_BOOK (book)); - - g_warning ("pas_backend_file_remove_client: Unimplemented!\n"); -} - -static gboolean -pas_backend_file_construct (PASBackendFile *backend) -{ - g_assert (backend != NULL); - g_assert (PAS_IS_BACKEND_FILE (backend)); - - if (! pas_backend_construct (PAS_BACKEND (backend))) - return FALSE; - - return TRUE; -} - -/** - * pas_backend_file_new: - */ -PASBackend * -pas_backend_file_new (void) -{ - PASBackendFile *backend; - - backend = gtk_type_new (pas_backend_file_get_type ()); - - if (! pas_backend_file_construct (backend)) { - gtk_object_unref (GTK_OBJECT (backend)); - - return NULL; - } - - return PAS_BACKEND (backend); -} - -static void -pas_backend_file_destroy (GtkObject *object) -{ - PASBackendFile *backend = PAS_BACKEND_FILE (object); - - GTK_OBJECT_CLASS (pas_backend_file_parent_class)->destroy (object); -} - -static void -pas_backend_file_class_init (PASBackendFileClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - PASBackendClass *parent_class; - - pas_backend_file_parent_class = gtk_type_class (pas_backend_get_type ()); - - parent_class = PAS_BACKEND_CLASS (klass); - - /* Set the virtual methods. */ - parent_class->load_uri = pas_backend_file_load_uri; - parent_class->add_client = pas_backend_file_add_client; - parent_class->remove_client = pas_backend_file_remove_client; - - object_class->destroy = pas_backend_file_destroy; -} - -static void -pas_backend_file_init (PASBackendFile *backend) -{ - PASBackendFilePrivate *priv; - - priv = g_new0 (PASBackendFilePrivate, 1); - priv->loaded = FALSE; - priv->clients = NULL; - - backend->priv = priv; -} - -/** - * pas_backend_file_get_type: - */ -GtkType -pas_backend_file_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBackendFile", - sizeof (PASBackendFile), - sizeof (PASBackendFileClass), - (GtkClassInitFunc) pas_backend_file_class_init, - (GtkObjectInitFunc) pas_backend_file_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (pas_backend_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/pas/pas-backend-file.h b/addressbook/backend/pas/pas-backend-file.h deleted file mode 100644 index a56626014b..0000000000 --- a/addressbook/backend/pas/pas-backend-file.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BACKEND_FILE_H__ -#define __PAS_BACKEND_FILE_H__ - -#include -#include - -typedef struct _PASBackendFilePrivate PASBackendFilePrivate; - -typedef struct { - PASBackend parent_object; - PASBackendFilePrivate *priv; -} PASBackendFile; - -typedef struct { - PASBackendClass parent_class; -} PASBackendFileClass; - -PASBackend *pas_backend_file_new (void); -GtkType pas_backend_file_get_type (void); - -#define PAS_BACKEND_FILE_TYPE (pas_backend_file_get_type ()) -#define PAS_BACKEND_FILE(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_FILE_TYPE, PASBackendFile)) -#define PAS_BACKEND_FILE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendFileClass)) -#define PAS_IS_BACKEND_FILE(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_FILE_TYPE)) -#define PAS_IS_BACKEND_FILE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_FILE_TYPE)) - -#endif /* ! __PAS_BACKEND_FILE_H__ */ - diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c deleted file mode 100644 index 364204c3c2..0000000000 --- a/addressbook/backend/pas/pas-backend.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include -#include - -#define CLASS(o) PAS_BACKEND_CLASS (GTK_OBJECT (o)->klass) - -gboolean -pas_backend_construct (PASBackend *backend) -{ - return TRUE; -} - -void -pas_backend_load_uri (PASBackend *backend, - const char *uri) -{ - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND (backend)); - g_return_if_fail (uri != NULL); - - g_assert (CLASS (backend)->load_uri != NULL); - - CLASS (backend)->load_uri (backend, uri); -} - -/** - * pas_backend_add_client: - * @backend: - * @listener: - */ -void -pas_backend_add_client (PASBackend *backend, - Evolution_BookListener listener) -{ - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND (backend)); - g_return_if_fail (listener != CORBA_OBJECT_NIL); - - g_assert (CLASS (backend)->add_client != NULL); - - CLASS (backend)->add_client (backend, listener); -} - -void -pas_backend_remove_client (PASBackend *backend, - PASBook *book) -{ - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND (backend)); - g_return_if_fail (book != NULL); - g_return_if_fail (PAS_IS_BOOK (book)); - - g_assert (CLASS (backend)->remove_client != NULL); - - CLASS (backend)->remove_client (backend, book); -} - -static void -pas_backend_init (PASBackend *backend) -{ -} - -static void -pas_backend_class_init (PASBackendClass *klass) -{ -} - -/** - * pas_backend_get_type: - */ -GtkType -pas_backend_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBackend", - sizeof (PASBackend), - sizeof (PASBackendClass), - (GtkClassInitFunc) pas_backend_class_init, - (GtkObjectInitFunc) pas_backend_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/pas/pas-backend.h b/addressbook/backend/pas/pas-backend.h deleted file mode 100644 index 62822619ac..0000000000 --- a/addressbook/backend/pas/pas-backend.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * An abstract class which defines the API to a given backend. - * There will be one PASBackend object for every URI which is loaded. - * - * Two people will call into the PASBackend API: - * - * 1. The PASBookFactory, when it has been asked to load a book. - * It will create a new PASBackend if one is not already running - * for the requested URI. It will call pas_backend_add_client to - * add a new client to an existing PASBackend server. - * - * 2. A PASBook, when a client has requested an operation on the - * Evolution_Book interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BACKEND_H__ -#define __PAS_BACKEND_H__ - -#include -#include -#include - -typedef struct _PASBackend PASBackend; -typedef struct _PASBackendPrivate PASBackendPrivate; - -#include - -struct _PASBackend { - GtkObject parent_object; - PASBackendPrivate *priv; -}; - -typedef struct { - GtkObjectClass parent_class; - - /* Virtual methods */ - void (*load_uri) (PASBackend *backend, const char *uri); - void (*add_client) (PASBackend *backend, Evolution_BookListener listener); - void (*remove_client) (PASBackend *backend, PASBook *book); -} PASBackendClass; - -typedef PASBackend * (*PASBackendFactoryFn) (void); - -gboolean pas_backend_construct (PASBackend *backend); -void pas_backend_load_uri (PASBackend *backend, - const char *uri); -void pas_backend_add_client (PASBackend *backend, - Evolution_BookListener listener); -void pas_backend_remove_client (PASBackend *backend, - PASBook *book); - -GtkType pas_backend_get_type (void); - -#define PAS_BACKEND_TYPE (pas_backend_get_type ()) -#define PAS_BACKEND(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_TYPE, PASBackend)) -#define PAS_BACKEND_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendClass)) -#define PAS_IS_BACKEND(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_TYPE)) -#define PAS_IS_BACKEND_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_TYPE)) - -#endif /* ! __PAS_BACKEND_H__ */ - diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c deleted file mode 100644 index 6f01ed8053..0000000000 --- a/addressbook/backend/pas/pas-book-factory.c +++ /dev/null @@ -1,474 +0,0 @@ -/* - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include -#include -#include -#include - -#define PAS_BOOK_FACTORY_GOAD_ID "evolution:card-server" - -static GnomeObjectClass *pas_book_factory_parent_class; -POA_Evolution_BookFactory__vepv pas_book_factory_vepv; - -typedef struct { - char *uri; - Evolution_BookListener listener; -} PASBookFactoryQueuedRequest; - -struct _PASBookFactoryPrivate { - gint idle_id; - GHashTable *backends; - GHashTable *active_server_map; - GList *queued_requests; -}; - -static char * -pas_book_factory_canonicalize_uri (const char *uri) -{ - /* FIXME: What do I do here? */ - - return g_strdup (uri); -} - -static char * -pas_book_factory_extract_proto_from_uri (const char *uri) -{ - char *proto; - char *p; - - p = strchr (uri, ':'); - - if (p == NULL) - return NULL; - - proto = g_malloc0 (p - uri + 1); - - strncpy (proto, uri, p - uri); - - return proto; -} - -/** - * pas_book_factory_register_backend: - * @factory: - * @proto: - * @backend: - */ -void -pas_book_factory_register_backend (PASBookFactory *factory, - const char *proto, - PASBackendFactoryFn backend) -{ - g_return_if_fail (factory != NULL); - g_return_if_fail (PAS_IS_BOOK_FACTORY (factory)); - g_return_if_fail (proto != NULL); - g_return_if_fail (backend != NULL); - - - - if (g_hash_table_lookup (factory->priv->backends, proto) != NULL) { - g_warning ("pas_book_factory_register_backend: " - "Proto \"%s\" already registered!\n", proto); - } - - g_hash_table_insert (factory->priv->backends, - g_strdup (proto), backend); -} - -static PASBackendFactoryFn -pas_book_factory_lookup_backend_factory (PASBookFactory *factory, - const char *uri) -{ - PASBackendFactoryFn backend; - char *proto; - char *canonical_uri; - - g_assert (factory != NULL); - g_assert (PAS_IS_BOOK_FACTORY (factory)); - g_assert (uri != NULL); - - canonical_uri = pas_book_factory_canonicalize_uri (uri); - if (canonical_uri == NULL) - return NULL; - - proto = pas_book_factory_extract_proto_from_uri (canonical_uri); - if (proto == NULL) { - g_free (canonical_uri); - return NULL; - } - - backend = g_hash_table_lookup (factory->priv->backends, proto); - - g_free (proto); - g_free (canonical_uri); - - return backend; -} - -static PASBackend * -pas_book_factory_launch_backend (PASBookFactory *factory, - PASBookFactoryQueuedRequest *request) -{ - PASBackendFactoryFn backend_factory; - PASBackend *backend; - - backend_factory = pas_book_factory_lookup_backend_factory ( - factory, request->uri); - g_assert (backend_factory != NULL); - - backend = (backend_factory) (); - g_assert (backend != NULL); - - g_hash_table_insert (factory->priv->active_server_map, - g_strdup (request->uri), - backend); - - return backend; -} - -static void -pas_book_factory_process_request (PASBookFactory *factory, - PASBookFactoryQueuedRequest *request) -{ - PASBackend *backend; - - request = factory->priv->queued_requests->data; - - backend = g_hash_table_lookup (factory->priv->active_server_map, request->uri); - - if (backend == NULL) { - - backend = pas_book_factory_launch_backend (factory, request); - pas_backend_add_client (backend, request->listener); - pas_backend_load_uri (backend, request->uri); - g_free (request->uri); - - return; - } - - g_free (request->uri); - - pas_backend_add_client (backend, request->listener); -} - -static gboolean -pas_book_factory_process_queue (PASBookFactory *factory) -{ - /* Process pending Book-creation requests. */ - if (factory->priv->queued_requests != NULL) { - PASBookFactoryQueuedRequest *request; - - request = factory->priv->queued_requests->data; - - pas_book_factory_process_request (factory, request); - - factory->priv->queued_requests = g_list_remove ( - factory->priv->queued_requests, request); - - g_free (request); - } - - if (factory->priv->queued_requests == NULL) { - - factory->priv->idle_id = 0; - return FALSE; - } - - return TRUE; -} - -static void -pas_book_factory_queue_request (PASBookFactory *factory, - const char *uri, - const Evolution_BookListener listener) -{ - PASBookFactoryQueuedRequest *request; - Evolution_BookListener listener_copy; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - listener_copy = CORBA_Object_duplicate (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("PASBookFactory: Could not duplicate BookListener!\n"); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - request = g_new0 (PASBookFactoryQueuedRequest, 1); - request->listener = listener_copy; - request->uri = g_strdup (uri); - - factory->priv->queued_requests = - g_list_prepend (factory->priv->queued_requests, request); - - if (! factory->priv->idle_id) { - factory->priv->idle_id = - g_idle_add ((GSourceFunc) pas_book_factory_process_queue, factory); - } -} - - -static void -impl_Evolution_BookFactory_open_book (PortableServer_Servant servant, - const CORBA_char *uri, - const Evolution_BookListener listener, - CORBA_Environment *ev) -{ - PASBookFactory *factory = - PAS_BOOK_FACTORY (gnome_object_from_servant (servant)); - PASBackendFactoryFn backend_factory; - - backend_factory = pas_book_factory_lookup_backend_factory (factory, uri); - - if (backend_factory == NULL) { - g_warning ("PASBookFactory: No backend found for uri: %s\n", uri); - - CORBA_exception_set ( - ev, CORBA_USER_EXCEPTION, - ex_Evolution_BookFactory_ProtocolNotSupported, NULL); - - return; - } - - pas_book_factory_queue_request (factory, uri, listener); -} - -static gboolean -pas_book_factory_construct (PASBookFactory *factory) -{ - POA_Evolution_BookFactory *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (factory != NULL); - g_assert (PAS_IS_BOOK_FACTORY (factory)); - - servant = (POA_Evolution_BookFactory *) g_new0 (GnomeObjectServant, 1); - servant->vepv = &pas_book_factory_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_BookFactory__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return FALSE; - } - - CORBA_exception_free (&ev); - - obj = gnome_object_activate_servant (GNOME_OBJECT (factory), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return FALSE; - } - - gnome_object_construct (GNOME_OBJECT (factory), obj); - - return TRUE; -} - -/** - * pas_book_factory_new: - */ -PASBookFactory * -pas_book_factory_new (void) -{ - PASBookFactory *factory; - - factory = gtk_type_new (pas_book_factory_get_type ()); - - if (! pas_book_factory_construct (factory)) { - g_warning ("pas_book_factory_new: Could not construct PASBookFactory!\n"); - gtk_object_unref (GTK_OBJECT (factory)); - - return NULL; - } - - return factory; -} - -/** - * pas_book_factory_activate: - */ -void -pas_book_factory_activate (PASBookFactory *factory) -{ - CORBA_Environment ev; - int ret; - - g_return_if_fail (factory != NULL); - g_return_if_fail (PAS_IS_BOOK_FACTORY (factory)); - - CORBA_exception_init (&ev); - - ret = goad_server_register ( - NULL, - gnome_object_corba_objref (GNOME_OBJECT (factory)), - PAS_BOOK_FACTORY_GOAD_ID, "server", - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("pas_book_factory_construct: Exception " - "registering PASBookFactory!\n"); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - if (ret == -1) { - g_message ("pas_book_factory_construct: Error " - "registering PASBookFactory!\n"); - return; - } - - if (ret == -2) { - g_message ("pas_book_factory_construct: Another " - "PASBookFactory is already running.\n"); - return; - - } - - return; -} - - -static void -pas_book_factory_init (PASBookFactory *factory) -{ - factory->priv = g_new0 (PASBookFactoryPrivate, 1); - - factory->priv->active_server_map = g_hash_table_new (g_str_hash, g_str_equal); - factory->priv->backends = g_hash_table_new (g_str_hash, g_str_equal); - factory->priv->queued_requests = NULL; -} - -static gboolean -pas_book_factory_remove_asm_entry (gpointer key, gpointer value, - gpointer data) -{ - CORBA_Environment ev; - - g_free (key); - - CORBA_exception_init (&ev); - CORBA_Object_release ((CORBA_Object) value, &ev); - CORBA_exception_free (&ev); - - return TRUE; -} - -static gboolean -pas_book_factory_remove_backend_entry (gpointer key, gpointer value, - gpointer data) -{ - g_free (key); - return TRUE; -} - -static void -pas_book_factory_destroy (GtkObject *object) -{ - PASBookFactory *factory = PAS_BOOK_FACTORY (object); - GList *l; - - for (l = factory->priv->queued_requests; l != NULL; l = l->next) { - PASBookFactoryQueuedRequest *request = l->data; - CORBA_Environment ev; - - g_free (request->uri); - - CORBA_exception_init (&ev); - CORBA_Object_release (request->listener, &ev); - CORBA_exception_free (&ev); - - g_free (request); - } - g_list_free (factory->priv->queued_requests); - factory->priv->queued_requests = NULL; - - g_hash_table_foreach_remove (factory->priv->active_server_map, - pas_book_factory_remove_asm_entry, - NULL); - g_hash_table_destroy (factory->priv->active_server_map); - - g_hash_table_foreach_remove (factory->priv->backends, - pas_book_factory_remove_backend_entry, - NULL); - g_hash_table_destroy (factory->priv->backends); - - g_free (factory->priv); - - GTK_OBJECT_CLASS (pas_book_factory_parent_class)->destroy (object); -} - -static POA_Evolution_BookFactory__epv * -pas_book_factory_get_epv (void) -{ - POA_Evolution_BookFactory__epv *epv; - - epv = g_new0 (POA_Evolution_BookFactory__epv, 1); - - epv->open_book = impl_Evolution_BookFactory_open_book; - - return epv; - -} - -static void -pas_book_factory_corba_class_init (void) -{ - pas_book_factory_vepv.GNOME_Unknown_epv = gnome_object_get_epv (); - pas_book_factory_vepv.Evolution_BookFactory_epv = pas_book_factory_get_epv (); -} - -static void -pas_book_factory_class_init (PASBookFactoryClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - pas_book_factory_parent_class = gtk_type_class (gnome_object_get_type ()); - - object_class->destroy = pas_book_factory_destroy; - - pas_book_factory_corba_class_init (); -} - -/** - * pas_book_factory_get_type: - */ -GtkType -pas_book_factory_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBookFactory", - sizeof (PASBookFactory), - sizeof (PASBookFactoryClass), - (GtkClassInitFunc) pas_book_factory_class_init, - (GtkObjectInitFunc) pas_book_factory_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gnome_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/pas/pas-book-factory.h b/addressbook/backend/pas/pas-book-factory.h deleted file mode 100644 index 6e72b90062..0000000000 --- a/addressbook/backend/pas/pas-book-factory.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2000, Helix Code, Inc. - */ - -#include -#include - -#include - -#ifndef __PAS_BOOK_FACTORY_H__ -#define __PAS_BOOK_FACTORY_H__ - -BEGIN_GNOME_DECLS - -typedef struct _PASBookFactoryPrivate PASBookFactoryPrivate; - -typedef struct { - GnomeObject parent_object; - PASBookFactoryPrivate *priv; -} PASBookFactory; - -typedef struct { - GnomeObjectClass parent_class; -} PASBookFactoryClass; - -PASBookFactory *pas_book_factory_new (void); - -void pas_book_factory_register_backend (PASBookFactory *factory, - const char *proto, - PASBackendFactoryFn backend_factory); - -void pas_book_factory_activate (PASBookFactory *factory); - -GtkType pas_book_factory_get_type (void); - -#define PAS_BOOK_FACTORY_TYPE (pas_book_factory_get_type ()) -#define PAS_BOOK_FACTORY(o) (GTK_CHECK_CAST ((o), PAS_BOOK_FACTORY_TYPE, PASBookFactory)) -#define PAS_BOOK_FACTORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookFactoryClass)) -#define PAS_IS_BOOK_FACTORY(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_FACTORY_TYPE)) -#define PAS_IS_BOOK_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_FACTORY_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __PAS_BOOK_FACTORY_H__ */ diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c deleted file mode 100644 index adac2fd806..0000000000 --- a/addressbook/backend/pas/pas-book.c +++ /dev/null @@ -1,573 +0,0 @@ -/* - * pas-book.c - * - * Copyright 2000, Helix Code, Inc. - */ - -#include -#include - -static GnomeObjectClass *pas_book_parent_class; -POA_Evolution_Book__vepv pas_book_vepv; - -enum { - REQUESTS_QUEUED, - LAST_SIGNAL -}; - -static guint pas_book_signals [LAST_SIGNAL]; - -struct _PASBookPrivate { - PASBackend *backend; - Evolution_BookListener listener; - PASBookGetVCardFn get_vcard; - - GList *request_queue; - gint idle_id; -}; - -static gboolean -pas_book_check_queue (PASBook *book) -{ - if (book->priv->request_queue != NULL) { - gtk_signal_emit (GTK_OBJECT (book), - pas_book_signals [REQUESTS_QUEUED]); - } - - if (book->priv->request_queue == NULL) { - book->priv->idle_id = 0; - return FALSE; - } - - return TRUE; -} - -static void -pas_book_queue_request (PASBook *book, PASRequest *req) -{ - book->priv->request_queue = - g_list_append (book->priv->request_queue, req); - - if (book->priv->idle_id == 0) { - book->priv->idle_id = g_idle_add ((GSourceFunc) pas_book_check_queue, book); - } -} - -static void -pas_book_queue_create_card (PASBook *book, const char *vcard) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = CreateCard; - req->vcard = g_strdup (vcard); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_remove_card (PASBook *book, const char *id) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = RemoveCard; - req->id = g_strdup (id); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_modify_card (PASBook *book, const char *vcard) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = ModifyCard; - req->vcard = g_strdup (vcard); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_check_connection (PASBook *book) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = CheckConnection; - - pas_book_queue_request (book, req); -} - -static CORBA_char * -impl_Evolution_Book_get_vcard (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (gnome_object_from_servant (servant)); - char *vcard; - CORBA_char *retval; - - vcard = (book->priv->get_vcard) (book, (const char *) id); - retval = CORBA_string_dup (vcard); - g_free (vcard); - - return retval; -} - -static void -impl_Evolution_Book_create_card (PortableServer_Servant servant, - const CORBA_char *vcard, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (gnome_object_from_servant (servant)); - - pas_book_queue_create_card (book, vcard); -} - -static void -impl_Evolution_Book_remove_card (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (gnome_object_from_servant (servant)); - - pas_book_queue_remove_card (book, (const char *) id); -} - -static void -impl_Evolution_Book_modify_card (PortableServer_Servant servant, - const CORBA_char *vcard, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (gnome_object_from_servant (servant)); - - pas_book_queue_modify_card (book, vcard); -} - -static void -impl_Evolution_Book_check_connection (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (gnome_object_from_servant (servant)); - - pas_book_queue_check_connection (book); -} - -/** - * pas_book_get_backend: - */ -PASBackend * -pas_book_get_backend (PASBook *book) -{ - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (PAS_IS_BOOK (book), NULL); - - return book->priv->backend; -} - -/** - * pas_book_get_listener: - */ -Evolution_BookListener -pas_book_get_listener (PASBook *book) -{ - g_return_val_if_fail (book != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (PAS_IS_BOOK (book), CORBA_OBJECT_NIL); - - return book->priv->listener; -} - -/** - * pas_book_check_pending - */ -gint -pas_book_check_pending (PASBook *book) -{ - g_return_val_if_fail (book != NULL, -1); - g_return_val_if_fail (PAS_IS_BOOK (book), -1); - - return g_list_length (book->priv->request_queue); -} - -/** - * pas_book_pop_request: - */ -PASRequest * -pas_book_pop_request (PASBook *book) -{ - GList *popped; - PASRequest *req; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (PAS_IS_BOOK (book), NULL); - - if (book->priv->request_queue == NULL) - return NULL; - - req = book->priv->request_queue->data; - - popped = book->priv->request_queue; - book->priv->request_queue = - g_list_remove_link (book->priv->request_queue, popped); - - g_list_free_1 (popped); - - return req; -} - -/** - * pas_book_respond_open: - */ -void -pas_book_respond_open (PASBook *book, - Evolution_BookListener_CallStatus status) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - if (status == Evolution_BookListener_Success) { - Evolution_BookListener_respond_open_book ( - book->priv->listener, status, - gnome_object_corba_objref (GNOME_OBJECT (book)), - &ev); - } else { - Evolution_BookListener_respond_open_book ( - book->priv->listener, status, - CORBA_OBJECT_NIL, &ev); - } - - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_open: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_create: - */ -void -pas_book_respond_create (PASBook *book, - Evolution_BookListener_CallStatus status) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_respond_create_card ( - book->priv->listener, status, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_create: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_remove: - */ -void -pas_book_respond_remove (PASBook *book, - Evolution_BookListener_CallStatus status) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_respond_remove_card ( - book->priv->listener, status, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_remove: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_modify: - */ -void -pas_book_respond_modify (PASBook *book, - Evolution_BookListener_CallStatus status) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_respond_modify_card ( - book->priv->listener, status, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_modify: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_report_connection: - */ -void -pas_book_report_connection (PASBook *book, - gboolean connected) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_report_connection_status ( - book->priv->listener, (CORBA_boolean) connected, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_report_connection: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - - -/** - * pas_book_notify_change: - */ -void -pas_book_notify_change (PASBook *book, - const char *id) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_signal_card_changed ( - book->priv->listener, (Evolution_CardId) id, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_notify_change: Exception signaling BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_notify_remove: - */ -void -pas_book_notify_remove (PASBook *book, - const char *id) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_signal_card_removed ( - book->priv->listener, (Evolution_CardId) id, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_notify_remove: Exception signaling BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_notify_add: - */ -void -pas_book_notify_add (PASBook *book, - const char *id) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_signal_card_added ( - book->priv->listener, (Evolution_CardId) id, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_notify_add: Exception signaling BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -static gboolean -pas_book_construct (PASBook *book, - PASBackend *backend, - Evolution_BookListener listener, - PASBookGetVCardFn get_vcard) -{ - POA_Evolution_Book *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (book != NULL); - g_assert (PAS_IS_BOOK (book)); - g_assert (listener != CORBA_OBJECT_NIL); - g_assert (get_vcard != NULL); - - servant = (POA_Evolution_Book *) g_new0 (GnomeObjectServant, 1); - servant->vepv = &pas_book_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_Book__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return FALSE; - } - - CORBA_exception_free (&ev); - - obj = gnome_object_activate_servant (GNOME_OBJECT (book), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return FALSE; - } - - gnome_object_construct (GNOME_OBJECT (book), obj); - - book->priv->listener = listener; - book->priv->get_vcard = get_vcard; - book->priv->backend = backend; - - return TRUE; -} - -/** - * pas_book_new: - */ -PASBook * -pas_book_new (PASBackend *backend, - Evolution_BookListener listener, - PASBookGetVCardFn get_vcard) -{ - PASBook *book; - PASBook *retval; - - g_return_val_if_fail (listener != CORBA_OBJECT_NIL, NULL); - g_return_val_if_fail (get_vcard != NULL, NULL); - - book = gtk_type_new (pas_book_get_type ()); - - if (! pas_book_construct (book, backend, listener, get_vcard)) { - gtk_object_unref (GTK_OBJECT (book)); - - return NULL; - } - - return book; -} - -static void -pas_book_destroy (GtkObject *object) -{ - PASBook *book = PAS_BOOK (object); - GList *l; - - for (l = book->priv->request_queue; l != NULL; l = l->next) { - PASRequest *req = l->data; - - g_free (req->id); - g_free (req->vcard); - g_free (req); - } - g_list_free (book->priv->request_queue); - - g_free (book->priv); - - GTK_OBJECT_CLASS (pas_book_parent_class)->destroy (object); -} - -static POA_Evolution_Book__epv * -pas_book_get_epv (void) -{ - POA_Evolution_Book__epv *epv; - - epv = g_new0 (POA_Evolution_Book__epv, 1); - - epv->get_vcard = impl_Evolution_Book_get_vcard; - epv->create_card = impl_Evolution_Book_create_card; - epv->remove_card = impl_Evolution_Book_remove_card; - epv->modify_card = impl_Evolution_Book_modify_card; - epv->check_connection = impl_Evolution_Book_check_connection; - - return epv; - -} - -static void -pas_book_corba_class_init (void) -{ - pas_book_vepv.GNOME_Unknown_epv = gnome_object_get_epv (); - pas_book_vepv.Evolution_Book_epv = pas_book_get_epv (); -} - -static void -pas_book_class_init (PASBookClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - pas_book_parent_class = gtk_type_class (gnome_object_get_type ()); - - pas_book_signals [REQUESTS_QUEUED] = - gtk_signal_new ("requests_queued", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (PASBookClass, requests_queued), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, pas_book_signals, LAST_SIGNAL); - - object_class->destroy = pas_book_destroy; - - pas_book_corba_class_init (); -} - -static void -pas_book_init (PASBook *book) -{ - book->priv = g_new0 (PASBookPrivate, 1); - book->priv->idle_id = 0; - book->priv->request_queue = NULL; -} - -/** - * pas_book_get_type: - */ -GtkType -pas_book_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBook", - sizeof (PASBook), - sizeof (PASBookClass), - (GtkClassInitFunc) pas_book_class_init, - (GtkObjectInitFunc) pas_book_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gnome_object_get_type (), &info); - } - - return type; -} - diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h deleted file mode 100644 index e929916ceb..0000000000 --- a/addressbook/backend/pas/pas-book.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * A wrapper object which exports the Evolution_Book CORBA interface - * and which maintains a request queue. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BOOK_H__ -#define __PAS_BOOK_H__ - -#include -#include -#include - -typedef struct _PASBook PASBook; -typedef struct _PASBookPrivate PASBookPrivate; - -#include - -typedef enum { - CreateCard, - RemoveCard, - ModifyCard, - CheckConnection -} PASOperation; - -typedef struct { - PASOperation op; - char *id; - char *vcard; -} PASRequest; - -struct _PASBook { - GnomeObject parent_object; - PASBookPrivate *priv; -}; - -typedef struct { - GnomeObjectClass parent_class; - - /* Signals */ - void (*requests_queued) (void); -} PASBookClass; - -typedef char * (*PASBookGetVCardFn) (PASBook *book, const char *id); - -PASBook *pas_book_new (PASBackend *backend, - Evolution_BookListener listener, - PASBookGetVCardFn get_vcard); -PASBackend *pas_book_get_backend (PASBook *book); -Evolution_BookListener pas_book_get_listener (PASBook *book); -int pas_book_check_pending (PASBook *book); -PASRequest *pas_book_pop_request (PASBook *book); - -void pas_book_respond_open (PASBook *book, - Evolution_BookListener_CallStatus status); -void pas_book_respond_create (PASBook *book, - Evolution_BookListener_CallStatus status); -void pas_book_respond_remove (PASBook *book, - Evolution_BookListener_CallStatus status); -void pas_book_respond_modify (PASBook *book, - Evolution_BookListener_CallStatus status); -void pas_book_report_connection (PASBook *book, - gboolean connected); - -void pas_book_notify_change (PASBook *book, - const char *id); -void pas_book_notify_remove (PASBook *book, - const char *id); -void pas_book_notify_add (PASBook *book, - const char *id); - -GtkType pas_book_get_type (void); - -#define PAS_BOOK_TYPE (pas_book_get_type ()) -#define PAS_BOOK(o) (GTK_CHECK_CAST ((o), PAS_BOOK_TYPE, PASBook)) -#define PAS_BOOK_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookClass)) -#define PAS_IS_BOOK(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_TYPE)) -#define PAS_IS_BOOK_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_TYPE)) - -#endif /* ! __PAS_BOOK_H__ */ diff --git a/addressbook/backend/pas/pas.c b/addressbook/backend/pas/pas.c deleted file mode 100644 index 07d6d5c757..0000000000 --- a/addressbook/backend/pas/pas.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ -#include -#include - -#include -#include - -CORBA_Environment ev; -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - - gnome_CORBA_init_with_popt_table ( - "Personal Addressbook Server", "0.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) - g_error (_("Could not initialize Bonobo")); -} - -int -main (int argc, char **argv) -{ - PASBookFactory *factory; - - CORBA_exception_init (&ev); - - - init_bonobo (argc, argv); - - /* - * Create the factory and register the local-file backend with - * it. - */ - factory = pas_book_factory_new (); - - pas_book_factory_register_backend ( - factory, "file", pas_backend_file_new); - - pas_book_factory_activate (factory); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/backend/pas/wombat.gnorba b/addressbook/backend/pas/wombat.gnorba deleted file mode 100644 index f45ecb3158..0000000000 --- a/addressbook/backend/pas/wombat.gnorba +++ /dev/null @@ -1,5 +0,0 @@ -[evolution:card-server] -type=exe -repo_id=IDL:Evolution/CardServer:1.0 -description=The Personal Addressbook Server -location_info=wombat diff --git a/addressbook/contact-editor/.cvsignore b/addressbook/contact-editor/.cvsignore deleted file mode 100644 index 1771e82554..0000000000 --- a/addressbook/contact-editor/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -contact-editor-test \ No newline at end of file diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am deleted file mode 100644 index 7c3d0de273..0000000000 --- a/addressbook/contact-editor/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ - -images = email.png head.png phone.png snailmail.png web.png arrow.png briefcase.png netmeeting.png netfreebusy.png - -EXTRA_DIST = $(images) -pkgdata_DATA = $(images) - -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DDATADIR=\""$(datadir)"\" - -INCLUDES = \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = \ - libecontacteditor.a - -libecontacteditor_a_SOURCES = \ - e-contact-editor.c \ - e-contact-editor.h - -noinst_PROGRAMS = \ - contact-editor-test - -contact_editor_test_SOURCES = \ - test-editor.c - -contact_editor_test_LDADD = \ - libecontacteditor.a \ - $(EXTRA_GNOME_LIBS) - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - contact-editor.glade - diff --git a/addressbook/contact-editor/arrow.png b/addressbook/contact-editor/arrow.png deleted file mode 100644 index b7f782c1e5..0000000000 Binary files a/addressbook/contact-editor/arrow.png and /dev/null differ diff --git a/addressbook/contact-editor/briefcase.png b/addressbook/contact-editor/briefcase.png deleted file mode 100644 index dd59b8fd39..0000000000 Binary files a/addressbook/contact-editor/briefcase.png and /dev/null differ diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade deleted file mode 100644 index 24f98decac..0000000000 --- a/addressbook/contact-editor/contact-editor.glade +++ /dev/null @@ -1,2205 +0,0 @@ - - - - - Contact-editor - contact-editor - True - False - False - False - False - True - e-contact-editor-strings.h - - - - GtkWindow - contact editor - False - Contact Editor - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - - - GtkNotebook - notebook-contact-editor - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - - GtkTable - table-contact-editor-general - 7 - 12 - 8 - False - 4 - 4 - - - GtkEntry - entry-phone1 - True - True - True - 0 - - - 7 - 8 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-phone2 - True - True - True - 0 - - - 7 - 8 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-phone3 - True - True - True - 0 - - - 7 - 8 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-phone4 - True - True - True - 0 - - - 7 - 8 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-fullname - True - True - True - 0 - - - 3 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-web - True - True - True - 0 - - - 3 - 4 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label-phone3 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label-phone2 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label-phone1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label-phone4 - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkText - text-address - 1 - 1 - True - True - - - 7 - 8 - 5 - 9 - 0 - 0 - True - False - False - False - True - True - - - - - GtkLabel - label-email1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkButton - button-fullname - True - - - 1 - 3 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-jobtitle - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-company - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-fileas - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-web - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkHBox - hbox5 - False - 0 - - 0 - 8 - 10 - 11 - 0 - 0 - True - True - False - False - True - True - - - - GtkText - text-comments - True - True - - - 0 - True - True - - - - - GtkVScrollbar - vscrollbar-comments - GTK_UPDATE_CONTINUOUS - 0 - 0 - 0 - 0 - 0 - 0 - - 0 - False - False - - - - - - GtkHBox - hbox3 - False - 6 - - 0 - 8 - 11 - 12 - 0 - 0 - True - False - False - False - True - True - - - - GtkButton - button-contacts - True - - - 0 - False - False - - - - - GtkEntry - entry-contacts - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button-categories - True - - - 0 - False - False - - - - - GtkEntry - entry-categories - True - True - True - 0 - - - 0 - False - False - - - - - - GtkAlignment - alignment2 - 0 - 0 - 0 - 0 - - 7 - 8 - 9 - 10 - 0 - 0 - True - False - False - False - True - True - - - - GtkCheckButton - checkbutton-mailingaddress - True - - False - True - - - - - GtkButton - button-address - True - - - 5 - 7 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkEntry - entry-jobtitle - True - True - True - 0 - - - 3 - 4 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-company - True - True - True - 0 - - - 3 - 4 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkCombo - combo-fileas - True - False - True - True - True - False - - - 3 - 4 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - GtkCombo:entry - entry14 - True - True - True - 0 - - - - - - GtkHBox - hbox4 - False - 4 - - 3 - 4 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - entry-email1 - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button23 - - 0 - False - False - - - - Placeholder - - - - - - GtkAlignment - alignment3 - 1 - 0.5 - 0 - 1 - - 2 - 3 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-email1 - True - - - Placeholder - - - - - - GtkAlignment - alignment4 - 1 - 0.5 - 0 - 1 - - 6 - 7 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-address1 - True - - - Placeholder - - - - - - GtkAlignment - alignment5 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone4 - True - - - Placeholder - - - - - - GtkAlignment - alignment7 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone2 - True - - - Placeholder - - - - - - GtkAlignment - alignment8 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone1 - True - - - Placeholder - - - - - - GtkLabel - label-address1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - - - GtkHSeparator - hseparator6 - - 0 - 4 - 7 - 8 - 0 - 2 - True - False - False - False - True - True - - - - - GtkHSeparator - hseparator4 - - 4 - 8 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - - - - - GtkHSeparator - hseparator5 - - 0 - 4 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - - - - - GtkAlignment - alignment6 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone3 - True - - - Placeholder - - - - - - - GtkLabel - Notebook:tab - label15 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkTable - table-contact-editor-details - 7 - 12 - 6 - False - 4 - 4 - - - GtkLabel - label21 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label22 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label23 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label24 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label25 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label26 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 7 - 8 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label27 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label28 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 10 - 11 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label31 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label30 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label29 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label32 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkEntry - entry4 - True - True - True - 0 - - - 2 - 3 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry5 - True - True - True - 0 - - - 2 - 3 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry6 - True - True - True - 0 - - - 2 - 3 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry7 - True - True - True - 0 - - - 2 - 3 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry8 - True - True - True - 0 - - - 2 - 3 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry9 - True - True - True - 0 - - - 2 - 6 - 7 - 8 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry10 - True - True - True - 0 - - - 2 - 5 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry11 - True - True - True - 0 - - - 2 - 6 - 10 - 11 - 0 - 0 - True - False - False - False - True - False - - - - - GnomeDateEdit - dateedit2 - False - False - False - 7 - 19 - - 4 - 6 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GnomeDateEdit - dateedit1 - False - False - False - 7 - 19 - - 4 - 6 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry13 - True - True - True - 0 - - - 4 - 6 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry12 - True - True - True - 0 - - - 4 - 6 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkButton - button-callnow - True - - - 5 - 6 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkHBox - hbox7 - False - 6 - - 0 - 6 - 9 - 10 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label33 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 2 - - 0 - False - False - - - - - GtkHSeparator - hseparator8 - - 0 - True - True - - - - - - GtkHBox - hbox8 - False - 6 - - 0 - 6 - 6 - 7 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label34 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 2 - - 0 - False - False - - - - - GtkHSeparator - hseparator9 - - 0 - True - True - - - - - - GtkHSeparator - hseparator7 - - 0 - 6 - 3 - 4 - 0 - 2 - False - False - False - False - True - True - - - - - - GtkLabel - Notebook:tab - label16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkText - text3 - True - False - - - - - GtkLabel - Notebook:tab - label17 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkText - text2 - True - False - - - - - GtkLabel - Notebook:tab - label18 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkText - text4 - True - False - - - - - GtkLabel - Notebook:tab - label19 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GnomeDialog - dialog2 - False - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox2 - False - 8 - - 4 - True - True - - - - GtkTable - table2 - 2 - 2 - False - 0 - 0 - - 0 - True - True - - - - GtkEntry - entry2 - True - True - True - 0 - - - 0 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkVBox - vbox1 - False - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - True - False - False - True - True - - - - GtkButton - button31 - True - - - 0 - False - False - - - - - GtkButton - button32 - True - - - 0 - False - False - - - - - - GtkScrolledWindow - scrolledwindow1 - 200 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - 1 - 0 - 1 - 0 - 0 - True - True - False - False - True - True - - - - GtkCList - clist1 - True - 1 - 80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_NONE - - - GtkLabel - CList:title - label20 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area2 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button28 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button29 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button30 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - - - GnomeDialog - dialog-add-phone - False - New phone type - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - vbox2 - False - 8 - - 4 - True - True - - - - GtkFrame - frame-add-phone - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkAlignment - alignment9 - 9 - 0.5 - 0.5 - 1 - 1 - - - GtkEntry - entry-add-phone - True - True - True - 0 - - - - - - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button43 - True - True - - GNOME_STOCK_PIXMAP_ADD - - - - GtkButton - button44 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - - diff --git a/addressbook/contact-editor/e-contact-editor-strings.h b/addressbook/contact-editor/e-contact-editor-strings.h deleted file mode 100644 index 131dd6fdf4..0000000000 --- a/addressbook/contact-editor/e-contact-editor-strings.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("Contact Editor"); -gchar *s = N_("Business Fax"); -gchar *s = N_("Home"); -gchar *s = N_("Business"); -gchar *s = N_("Mobile"); -gchar *s = N_("Email"); -gchar *s = N_("\tFull Name..."); -gchar *s = N_("Job Title:"); -gchar *s = N_("Company:"); -gchar *s = N_("File As:"); -gchar *s = N_("Web page address:"); -gchar *s = N_("Contacts..."); -gchar *s = N_("Categories..."); -gchar *s = N_("This is the mailing address"); -gchar *s = N_("A_ddress..."); -gchar *s = N_("Business"); -gchar *s = N_("General"); -gchar *s = N_("Department:"); -gchar *s = N_("Office:"); -gchar *s = N_("Profession:"); -gchar *s = N_("Nickname:"); -gchar *s = N_("Spouse's name:"); -gchar *s = N_("Directory Server:"); -gchar *s = N_("Email alias:"); -gchar *s = N_("Address:"); -gchar *s = N_("Birthday:"); -gchar *s = N_("Assistant's name:"); -gchar *s = N_("Manager's name:"); -gchar *s = N_("Anniversary:"); -gchar *s = N_("Call Now"); -gchar *s = N_("Internet Free-Busy"); -gchar *s = N_("Online NetMeeting settings"); -gchar *s = N_("Details"); -gchar *s = N_("Activities"); -gchar *s = N_("Certificates"); -gchar *s = N_("All Fields"); -gchar *s = N_("Add"); -gchar *s = N_("Delete"); -gchar *s = N_("Phone Types"); -gchar *s = N_("New phone type"); -gchar *s = N_("New phone type"); -gchar *s = N_("Add"); diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c deleted file mode 100644 index 01091b4bc3..0000000000 --- a/addressbook/contact-editor/e-contact-editor.c +++ /dev/null @@ -1,567 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-contact-editor.h" -static void e_contact_editor_init (EContactEditor *card); -static void e_contact_editor_class_init (EContactEditorClass *klass); -static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_destroy (GtkObject *object); - -static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info); -static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); - -static GtkVBoxClass *parent_class = NULL; - -#if 0 -enum { - E_CONTACT_EDITOR_RESIZE, - E_CONTACT_EDITOR_LAST_SIGNAL -}; - -static guint e_contact_editor_signals[E_CONTACT_EDITOR_LAST_SIGNAL] = { 0 }; -#endif - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD -}; - -enum { - DYNAMIC_LIST_EMAIL, - DYNAMIC_LIST_PHONE, - DYNAMIC_LIST_ADDRESS -}; - -GtkType -e_contact_editor_get_type (void) -{ - static GtkType contact_editor_type = 0; - - if (!contact_editor_type) - { - static const GtkTypeInfo contact_editor_info = - { - "EContactEditor", - sizeof (EContactEditor), - sizeof (EContactEditorClass), - (GtkClassInitFunc) e_contact_editor_class_init, - (GtkObjectInitFunc) e_contact_editor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_type = gtk_type_unique (gtk_vbox_get_type (), &contact_editor_info); - } - - return contact_editor_type; -} - -static void -e_contact_editor_class_init (EContactEditorClass *klass) -{ - GtkObjectClass *object_class; - GtkVBoxClass *vbox_class; - - object_class = (GtkObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - - parent_class = gtk_type_class (gtk_vbox_get_type ()); - -#if 0 - e_contact_editor_signals[E_CONTACT_EDITOR_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_contact_editor_signals, E_CONTACT_EDITOR_LAST_SIGNAL); -#endif - - gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - - object_class->set_arg = e_contact_editor_set_arg; - object_class->get_arg = e_contact_editor_get_arg; - object_class->destroy = e_contact_editor_destroy; -} - -static void -_add_image(GtkTable *table, gchar *image, int left, int right, int top, int bottom) -{ - gtk_table_attach(table, - gtk_widget_new(gtk_alignment_get_type(), - "child", gnome_pixmap_new_from_file(image), - "xalign", (double) 0, - "yalign", (double) 0, - "xscale", (double) 0, - "yscale", (double) 0, - NULL), - left, right, top, bottom, - GTK_FILL, GTK_FILL, - 0, 0); -} - -static void -_add_images(GtkTable *table) -{ - _add_image(table, DATADIR "/evolution/head.png", 0, 1, 0, 4); - _add_image(table, DATADIR "/evolution/phone.png", 4, 5, 0, 4); - _add_image(table, DATADIR "/evolution/email.png", 0, 1, 5, 7); - _add_image(table, DATADIR "/evolution/web.png", 0, 1, 8, 10); - _add_image(table, DATADIR "/evolution/snailmail.png", 4, 5, 5, 10); -} - -static void -_add_details_images(GtkTable *table) -{ - _add_image(table, DATADIR "/evolution/briefcase.png", 0, 1, 0, 2); - _add_image(table, DATADIR "/evolution/head.png", 0, 1, 4, 6); - _add_image(table, DATADIR "/evolution/netmeeting.png", 0, 1, 7, 9); - _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 10, 12); -} - -static void -_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GtkSignalFunc func) -{ - GladeXML *gui = editor->gui; - GtkWidget *button = glade_xml_get_widget(gui, button_xml); - gchar *image_temp; - image_temp = g_strdup_printf("%s%s", DATADIR "/evolution/", image); - gtk_container_add(GTK_CONTAINER(button), - gnome_pixmap_new_from_file(image_temp)); - g_free(image_temp); - gtk_signal_connect(GTK_OBJECT(button), "button_press_event", func, editor); - -} - -static void -_replace_buttons(EContactEditor *editor) -{ - _replace_button(editor, "button-phone1", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone2", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone3", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone4", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-address1", "arrow.png", _address_arrow_pressed); - _replace_button(editor, "button-email1", "arrow.png", _email_arrow_pressed); -} - -static void -e_contact_editor_init (EContactEditor *e_contact_editor) -{ - GladeXML *gui; - GtkAdjustment *adjustment; - - /* e_contact_editor->card = NULL;*/ - gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL); - e_contact_editor->gui = gui; - gtk_widget_reparent(glade_xml_get_widget(gui, "notebook-contact-editor"), - GTK_WIDGET(e_contact_editor)); - - _add_images(GTK_TABLE(glade_xml_get_widget(gui, "table-contact-editor-general"))); - _add_details_images(GTK_TABLE(glade_xml_get_widget(gui, "table-contact-editor-details"))); - _replace_buttons(e_contact_editor); - - gtk_object_get(GTK_OBJECT(glade_xml_get_widget(gui, "text-comments")), - "vadjustment", &adjustment, - NULL); - gtk_range_set_adjustment(GTK_RANGE(glade_xml_get_widget(gui, "vscrollbar-comments")), - adjustment); - - e_contact_editor->email_info = NULL; - e_contact_editor->phone_info = NULL; - e_contact_editor->address_info = NULL; - e_contact_editor->email_popup = NULL; - e_contact_editor->phone_popup = NULL; - e_contact_editor->address_popup = NULL; - e_contact_editor->email_list = NULL; - e_contact_editor->phone_list = NULL; - e_contact_editor->address_list = NULL; -} - -void -e_contact_editor_destroy (GtkObject *object) { - EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object); - - if (e_contact_editor->email_list) { - g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->email_list); - } - if (e_contact_editor->email_info) { - g_free(e_contact_editor->email_info); - } - if (e_contact_editor->email_popup) { - gtk_widget_unref(e_contact_editor->email_popup); - } - - if (e_contact_editor->phone_list) { - g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->phone_list); - } - if (e_contact_editor->phone_info) { - g_free(e_contact_editor->phone_info); - } - if (e_contact_editor->phone_popup) { - gtk_widget_unref(e_contact_editor->phone_popup); - } - - if (e_contact_editor->address_list) { - g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->address_list); - } - if (e_contact_editor->address_info) { - g_free(e_contact_editor->address_info); - } - if (e_contact_editor->address_popup) { - gtk_widget_unref(e_contact_editor->address_popup); - } - - gtk_object_unref(GTK_OBJECT(e_contact_editor->gui)); -} - -GtkWidget* -e_contact_editor_new (void *card) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_get_type ())); - gtk_object_set (GTK_OBJECT(widget), - "card", card, - NULL); - return widget; -} - -static void -e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (o); - - switch (arg_id){ - case ARG_CARD: - /* e_contact_editor->card = GTK_VALUE_POINTER (*arg); - _update_card(e_contact_editor); - gnome_canvas_item_request_update (item);*/ - break; - } -} - -static void -e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (object); - - switch (arg_id) { - case ARG_CARD: - /* GTK_VALUE_POINTER (*arg) = e_contact_editor->card; */ - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -_popup_position(GtkMenu *menu, - gint *x, - gint *y, - gpointer data) -{ - GtkWidget *button = GTK_WIDGET(data); - GtkRequisition request; - int mh, mw; - gdk_window_get_origin (button->window, x, y); - *x += button->allocation.width; - *y += button->allocation.height; - - gtk_widget_size_request(GTK_WIDGET(menu), &request); - - mh = request.height; - mw = request.width; - - *x -= mw; - if (*x < 0) - *x = 0; - - if (*y < 0) - *y = 0; - - if ((*x + mw) > gdk_screen_width ()) - *x = gdk_screen_width () - mw; - - if ((*y + mh) > gdk_screen_height ()) - *y = gdk_screen_height () - mh; -} - -static void -_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title) -{ - gint menu_item; - gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event"); - gtk_widget_realize(popup); - menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor); - if ( menu_item != -1 ) { - if (menu_item == g_list_length (*list)) { - e_contact_editor_build_dialog(editor, entry, label, dialog_title, list, info); - } else { - gtk_object_set(GTK_OBJECT(glade_xml_get_widget(editor->gui, label)), - "label", g_list_nth_data(*list, menu_item), - NULL); - } - } -} - -static void -e_contact_editor_build_ui_info(GList *list, GnomeUIInfo **infop) -{ - GnomeUIInfo *info; - GnomeUIInfo singleton = { GNOME_APP_UI_ITEM, NULL, NULL, NULL, NULL, NULL, GNOME_APP_PIXMAP_NONE, 0, 0, 0, NULL }; - GnomeUIInfo end = GNOMEUIINFO_END; - int length; - int i; - - info = *infop; - - if ( info ) - g_free(info); - length = g_list_length( list ); - info = g_new(GnomeUIInfo, length + 2); - for (i = 0; i < length; i++) { - info[i] = singleton; - info[i].label = _(list->data); - list = list->next; - } - info[i] = singleton; - info[i].label = N_("Other..."); - i++; - info[i] = end; - - *infop = info; -} - -static void -_dialog_clicked(GtkWidget *dialog, gint button, EContactEditor *editor) -{ - GtkWidget *label = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_label"); - GtkWidget *entry = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_entry"); - GtkWidget *dialog_entry = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry"); - GList **list = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_list"); - GList **info = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_info"); - switch (button) { - case 0: - gtk_object_set(GTK_OBJECT(label), - "label", gtk_entry_get_text(GTK_ENTRY(dialog_entry)), - NULL); - *list = g_list_append(*list, g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog_entry)))); - g_free(*info); - *info = NULL; - break; - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static void -_dialog_destroy(EContactEditor *editor, GtkWidget *dialog) -{ - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static GtkWidget * -e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info) -{ - GtkWidget *dialog_entry = gtk_entry_new(); - GtkWidget *entry = glade_xml_get_widget(editor->gui, entry_id); - GtkWidget *label = glade_xml_get_widget(editor->gui, label_id); - - GtkWidget *dialog = gnome_dialog_new(title, - NULL); - - gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox), - gtk_widget_new (gtk_frame_get_type(), - "border_width", 4, - "label", title, - "child", gtk_widget_new(gtk_alignment_get_type(), - "child", dialog_entry, - "xalign", .5, - "yalign", .5, - "xscale", 1.0, - "yscale", 1.0, - "border_width", 9, - NULL), - NULL)); - - gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(dialog), - "Add", - GNOME_STOCK_PIXMAP_ADD); - gnome_dialog_append_button(GNOME_DIALOG(dialog), GNOME_STOCK_BUTTON_CANCEL); - gnome_dialog_set_default(GNOME_DIALOG(dialog), 0); - - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - _dialog_clicked, editor); - gtk_signal_connect_while_alive(GTK_OBJECT(editor), "destroy", - _dialog_destroy, GTK_OBJECT(dialog), GTK_OBJECT(dialog)); - - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_entry", entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_label", label); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry", dialog_entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_list", list); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_info", info); - - gtk_widget_show_all(dialog); - return dialog; -} - -static void -_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int which; - int i; - gchar *label; - gchar *entry; - if ( widget == glade_xml_get_widget(editor->gui, "button-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone4") ) { - which = 4; - } else - return; - - label = g_strdup_printf("label-phone%d", which); - entry = g_strdup_printf("entry-phone%d", which); - - if (editor->phone_list == NULL) { - static char *info[] = { - N_("Assistant"), - N_("Business"), - N_("Business 2"), - N_("Business Fax"), - N_("Callback"), - N_("Car"), - N_("Company"), - N_("Home"), - N_("Home 2"), - N_("Home Fax"), - N_("ISDN"), - N_("Mobile"), - N_("Other"), - N_("Other Fax"), - N_("Pager"), - N_("Primary"), - N_("Radio"), - N_("Telex"), - N_("TTY/TDD") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->phone_list = g_list_append(editor->phone_list, g_strdup(info[i])); - } - } - if (editor->phone_info == NULL) { - e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info); - - if ( editor->phone_popup ) - gtk_widget_unref(editor->phone_popup); - - editor->phone_popup = gnome_popup_menu_new(editor->phone_info); - } - - _arrow_pressed (widget, button, editor, editor->phone_popup, &editor->phone_list, &editor->phone_info, label, entry, "Add new phone number type"); - - g_free(label); - g_free(entry); -} - -static void -_email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - if (editor->email_list == NULL) { - static char *info[] = { - N_("Email"), - N_("Email 2"), - N_("Email 3") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->email_list = g_list_append(editor->email_list, g_strdup(info[i])); - } - } - if (editor->email_info == NULL) { - e_contact_editor_build_ui_info(editor->email_list, &editor->email_info); - - if ( editor->email_popup ) - gtk_widget_unref(editor->email_popup); - - editor->email_popup = gnome_popup_menu_new(editor->email_info); - } - - _arrow_pressed (widget, button, editor, editor->email_popup, &editor->email_list, &editor->email_info, "label-email1", "entry-email1", "Add new Email type"); -} - -static void -_address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - if (editor->address_list == NULL) { - static char *info[] = { - N_("Business"), - N_("Home"), - N_("Other") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->address_list = g_list_append(editor->address_list, g_strdup(info[i])); - } - } - if (editor->address_info == NULL) { - e_contact_editor_build_ui_info(editor->address_list, &editor->address_info); - - if ( editor->address_popup ) - gtk_widget_unref(editor->address_popup); - - editor->address_popup = gnome_popup_menu_new(editor->address_info); - } - - _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "entry-address1", "Add new Address type"); -} diff --git a/addressbook/contact-editor/e-contact-editor.h b/addressbook/contact-editor/e-contact-editor.h deleted file mode 100644 index 7b914967ee..0000000000 --- a/addressbook/contact-editor/e-contact-editor.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CONTACT_EDITOR_H__ -#define __E_CONTACT_EDITOR_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * R The card currently being edited - */ - -#define E_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ()) -#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor)) -#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) - - -typedef struct _EContactEditor EContactEditor; -typedef struct _EContactEditorClass EContactEditorClass; - -struct _EContactEditor -{ - GtkVBox parent; - - /* item specific fields */ - /* ECard *card; */ - - GladeXML *gui; - GnomeUIInfo *email_info; - GnomeUIInfo *phone_info; - GnomeUIInfo *address_info; - GtkWidget *email_popup; - GtkWidget *phone_popup; - GtkWidget *address_popup; - GList *email_list; - GList *phone_list; - GList *address_list; -}; - -struct _EContactEditorClass -{ - GtkVBoxClass parent_class; -}; - - -GtkWidget *e_contact_editor_new(void *card); -GtkType e_contact_editor_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/contact-editor/email.png b/addressbook/contact-editor/email.png deleted file mode 100644 index f3ff02e343..0000000000 Binary files a/addressbook/contact-editor/email.png and /dev/null differ diff --git a/addressbook/contact-editor/head.png b/addressbook/contact-editor/head.png deleted file mode 100644 index ca00b75f92..0000000000 Binary files a/addressbook/contact-editor/head.png and /dev/null differ diff --git a/addressbook/contact-editor/netfreebusy.png b/addressbook/contact-editor/netfreebusy.png deleted file mode 100644 index 09ec8a2a5c..0000000000 Binary files a/addressbook/contact-editor/netfreebusy.png and /dev/null differ diff --git a/addressbook/contact-editor/netmeeting.png b/addressbook/contact-editor/netmeeting.png deleted file mode 100644 index 4cb90c121e..0000000000 Binary files a/addressbook/contact-editor/netmeeting.png and /dev/null differ diff --git a/addressbook/contact-editor/phone.png b/addressbook/contact-editor/phone.png deleted file mode 100644 index ebec84ba0b..0000000000 Binary files a/addressbook/contact-editor/phone.png and /dev/null differ diff --git a/addressbook/contact-editor/snailmail.png b/addressbook/contact-editor/snailmail.png deleted file mode 100644 index 647ae8f68c..0000000000 Binary files a/addressbook/contact-editor/snailmail.png and /dev/null differ diff --git a/addressbook/contact-editor/test-editor.c b/addressbook/contact-editor/test-editor.c deleted file mode 100644 index 49ed7e48bf..0000000000 --- a/addressbook/contact-editor/test-editor.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-editor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include -#include -#include "e-contact-editor.h" - -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - static int count = 2; - count --; - if ( count <= 0 ) - exit(0); -} - -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Editor Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact editor canvas item" ), - NULL); - gtk_widget_show (about); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Editor Test", VERSION, argc, argv); - - glade_gnome_init (); - - app = gnome_app_new("Contact Editor Test", NULL); - - editor = e_contact_editor_new(NULL); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - app = gnome_app_new("Contact Editor Test", NULL); - - editor = e_contact_editor_new(NULL); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/contact-editor/web.png b/addressbook/contact-editor/web.png deleted file mode 100644 index 3211a11b19..0000000000 Binary files a/addressbook/contact-editor/web.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/.cvsignore b/addressbook/gui/contact-editor/.cvsignore deleted file mode 100644 index 1771e82554..0000000000 --- a/addressbook/gui/contact-editor/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -contact-editor-test \ No newline at end of file diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am deleted file mode 100644 index 7c3d0de273..0000000000 --- a/addressbook/gui/contact-editor/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ - -images = email.png head.png phone.png snailmail.png web.png arrow.png briefcase.png netmeeting.png netfreebusy.png - -EXTRA_DIST = $(images) -pkgdata_DATA = $(images) - -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DDATADIR=\""$(datadir)"\" - -INCLUDES = \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = \ - libecontacteditor.a - -libecontacteditor_a_SOURCES = \ - e-contact-editor.c \ - e-contact-editor.h - -noinst_PROGRAMS = \ - contact-editor-test - -contact_editor_test_SOURCES = \ - test-editor.c - -contact_editor_test_LDADD = \ - libecontacteditor.a \ - $(EXTRA_GNOME_LIBS) - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - contact-editor.glade - diff --git a/addressbook/gui/contact-editor/arrow.png b/addressbook/gui/contact-editor/arrow.png deleted file mode 100644 index b7f782c1e5..0000000000 Binary files a/addressbook/gui/contact-editor/arrow.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/briefcase.png b/addressbook/gui/contact-editor/briefcase.png deleted file mode 100644 index dd59b8fd39..0000000000 Binary files a/addressbook/gui/contact-editor/briefcase.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade deleted file mode 100644 index 24f98decac..0000000000 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ /dev/null @@ -1,2205 +0,0 @@ - - - - - Contact-editor - contact-editor - True - False - False - False - False - True - e-contact-editor-strings.h - - - - GtkWindow - contact editor - False - Contact Editor - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - - - GtkNotebook - notebook-contact-editor - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - - GtkTable - table-contact-editor-general - 7 - 12 - 8 - False - 4 - 4 - - - GtkEntry - entry-phone1 - True - True - True - 0 - - - 7 - 8 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-phone2 - True - True - True - 0 - - - 7 - 8 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-phone3 - True - True - True - 0 - - - 7 - 8 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-phone4 - True - True - True - 0 - - - 7 - 8 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-fullname - True - True - True - 0 - - - 3 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-web - True - True - True - 0 - - - 3 - 4 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label-phone3 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label-phone2 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label-phone1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label-phone4 - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkText - text-address - 1 - 1 - True - True - - - 7 - 8 - 5 - 9 - 0 - 0 - True - False - False - False - True - True - - - - - GtkLabel - label-email1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkButton - button-fullname - True - - - 1 - 3 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-jobtitle - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-company - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-fileas - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAccelLabel - accellabel-web - - GTK_JUSTIFY_LEFT - False - 0 - 0.5 - 0 - 0 - - 1 - 3 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkHBox - hbox5 - False - 0 - - 0 - 8 - 10 - 11 - 0 - 0 - True - True - False - False - True - True - - - - GtkText - text-comments - True - True - - - 0 - True - True - - - - - GtkVScrollbar - vscrollbar-comments - GTK_UPDATE_CONTINUOUS - 0 - 0 - 0 - 0 - 0 - 0 - - 0 - False - False - - - - - - GtkHBox - hbox3 - False - 6 - - 0 - 8 - 11 - 12 - 0 - 0 - True - False - False - False - True - True - - - - GtkButton - button-contacts - True - - - 0 - False - False - - - - - GtkEntry - entry-contacts - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button-categories - True - - - 0 - False - False - - - - - GtkEntry - entry-categories - True - True - True - 0 - - - 0 - False - False - - - - - - GtkAlignment - alignment2 - 0 - 0 - 0 - 0 - - 7 - 8 - 9 - 10 - 0 - 0 - True - False - False - False - True - True - - - - GtkCheckButton - checkbutton-mailingaddress - True - - False - True - - - - - GtkButton - button-address - True - - - 5 - 7 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkEntry - entry-jobtitle - True - True - True - 0 - - - 3 - 4 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry-company - True - True - True - 0 - - - 3 - 4 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkCombo - combo-fileas - True - False - True - True - True - False - - - 3 - 4 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - GtkCombo:entry - entry14 - True - True - True - 0 - - - - - - GtkHBox - hbox4 - False - 4 - - 3 - 4 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - GtkEntry - entry-email1 - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button23 - - 0 - False - False - - - - Placeholder - - - - - - GtkAlignment - alignment3 - 1 - 0.5 - 0 - 1 - - 2 - 3 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-email1 - True - - - Placeholder - - - - - - GtkAlignment - alignment4 - 1 - 0.5 - 0 - 1 - - 6 - 7 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-address1 - True - - - Placeholder - - - - - - GtkAlignment - alignment5 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone4 - True - - - Placeholder - - - - - - GtkAlignment - alignment7 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone2 - True - - - Placeholder - - - - - - GtkAlignment - alignment8 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone1 - True - - - Placeholder - - - - - - GtkLabel - label-address1 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 5 - 6 - 6 - 7 - 0 - 0 - False - False - False - False - True - True - - - - - GtkHSeparator - hseparator6 - - 0 - 4 - 7 - 8 - 0 - 2 - True - False - False - False - True - True - - - - - GtkHSeparator - hseparator4 - - 4 - 8 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - - - - - GtkHSeparator - hseparator5 - - 0 - 4 - 4 - 5 - 0 - 2 - True - False - False - False - True - False - - - - - GtkAlignment - alignment6 - 1 - 0.5 - 0 - 0 - - 6 - 7 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button-phone3 - True - - - Placeholder - - - - - - - GtkLabel - Notebook:tab - label15 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkTable - table-contact-editor-details - 7 - 12 - 6 - False - 4 - 4 - - - GtkLabel - label21 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label22 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label23 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label24 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label25 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label26 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 7 - 8 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label27 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label28 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 10 - 11 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label31 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label30 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label29 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label32 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 3 - 4 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkEntry - entry4 - True - True - True - 0 - - - 2 - 3 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry5 - True - True - True - 0 - - - 2 - 3 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry6 - True - True - True - 0 - - - 2 - 3 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry7 - True - True - True - 0 - - - 2 - 3 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry8 - True - True - True - 0 - - - 2 - 3 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry9 - True - True - True - 0 - - - 2 - 6 - 7 - 8 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry10 - True - True - True - 0 - - - 2 - 5 - 8 - 9 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry11 - True - True - True - 0 - - - 2 - 6 - 10 - 11 - 0 - 0 - True - False - False - False - True - False - - - - - GnomeDateEdit - dateedit2 - False - False - False - 7 - 19 - - 4 - 6 - 5 - 6 - 0 - 0 - True - False - False - False - True - False - - - - - GnomeDateEdit - dateedit1 - False - False - False - 7 - 19 - - 4 - 6 - 4 - 5 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry13 - True - True - True - 0 - - - 4 - 6 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry12 - True - True - True - 0 - - - 4 - 6 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkButton - button-callnow - True - - - 5 - 6 - 8 - 9 - 0 - 0 - False - False - False - False - True - True - - - - - GtkHBox - hbox7 - False - 6 - - 0 - 6 - 9 - 10 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label33 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 2 - - 0 - False - False - - - - - GtkHSeparator - hseparator8 - - 0 - True - True - - - - - - GtkHBox - hbox8 - False - 6 - - 0 - 6 - 6 - 7 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label34 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 2 - - 0 - False - False - - - - - GtkHSeparator - hseparator9 - - 0 - True - True - - - - - - GtkHSeparator - hseparator7 - - 0 - 6 - 3 - 4 - 0 - 2 - False - False - False - False - True - True - - - - - - GtkLabel - Notebook:tab - label16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkText - text3 - True - False - - - - - GtkLabel - Notebook:tab - label17 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkText - text2 - True - False - - - - - GtkLabel - Notebook:tab - label18 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkText - text4 - True - False - - - - - GtkLabel - Notebook:tab - label19 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GnomeDialog - dialog2 - False - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox2 - False - 8 - - 4 - True - True - - - - GtkTable - table2 - 2 - 2 - False - 0 - 0 - - 0 - True - True - - - - GtkEntry - entry2 - True - True - True - 0 - - - 0 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkVBox - vbox1 - False - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - True - False - False - True - True - - - - GtkButton - button31 - True - - - 0 - False - False - - - - - GtkButton - button32 - True - - - 0 - False - False - - - - - - GtkScrolledWindow - scrolledwindow1 - 200 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - 1 - 0 - 1 - 0 - 0 - True - True - False - False - True - True - - - - GtkCList - clist1 - True - 1 - 80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_NONE - - - GtkLabel - CList:title - label20 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area2 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button28 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button29 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button30 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - - - GnomeDialog - dialog-add-phone - False - New phone type - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - vbox2 - False - 8 - - 4 - True - True - - - - GtkFrame - frame-add-phone - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkAlignment - alignment9 - 9 - 0.5 - 0.5 - 1 - 1 - - - GtkEntry - entry-add-phone - True - True - True - 0 - - - - - - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button43 - True - True - - GNOME_STOCK_PIXMAP_ADD - - - - GtkButton - button44 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - - diff --git a/addressbook/gui/contact-editor/e-contact-editor-strings.h b/addressbook/gui/contact-editor/e-contact-editor-strings.h deleted file mode 100644 index 131dd6fdf4..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-strings.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("Contact Editor"); -gchar *s = N_("Business Fax"); -gchar *s = N_("Home"); -gchar *s = N_("Business"); -gchar *s = N_("Mobile"); -gchar *s = N_("Email"); -gchar *s = N_("\tFull Name..."); -gchar *s = N_("Job Title:"); -gchar *s = N_("Company:"); -gchar *s = N_("File As:"); -gchar *s = N_("Web page address:"); -gchar *s = N_("Contacts..."); -gchar *s = N_("Categories..."); -gchar *s = N_("This is the mailing address"); -gchar *s = N_("A_ddress..."); -gchar *s = N_("Business"); -gchar *s = N_("General"); -gchar *s = N_("Department:"); -gchar *s = N_("Office:"); -gchar *s = N_("Profession:"); -gchar *s = N_("Nickname:"); -gchar *s = N_("Spouse's name:"); -gchar *s = N_("Directory Server:"); -gchar *s = N_("Email alias:"); -gchar *s = N_("Address:"); -gchar *s = N_("Birthday:"); -gchar *s = N_("Assistant's name:"); -gchar *s = N_("Manager's name:"); -gchar *s = N_("Anniversary:"); -gchar *s = N_("Call Now"); -gchar *s = N_("Internet Free-Busy"); -gchar *s = N_("Online NetMeeting settings"); -gchar *s = N_("Details"); -gchar *s = N_("Activities"); -gchar *s = N_("Certificates"); -gchar *s = N_("All Fields"); -gchar *s = N_("Add"); -gchar *s = N_("Delete"); -gchar *s = N_("Phone Types"); -gchar *s = N_("New phone type"); -gchar *s = N_("New phone type"); -gchar *s = N_("Add"); diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c deleted file mode 100644 index 01091b4bc3..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ /dev/null @@ -1,567 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-contact-editor.h" -static void e_contact_editor_init (EContactEditor *card); -static void e_contact_editor_class_init (EContactEditorClass *klass); -static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_destroy (GtkObject *object); - -static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info); -static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); - -static GtkVBoxClass *parent_class = NULL; - -#if 0 -enum { - E_CONTACT_EDITOR_RESIZE, - E_CONTACT_EDITOR_LAST_SIGNAL -}; - -static guint e_contact_editor_signals[E_CONTACT_EDITOR_LAST_SIGNAL] = { 0 }; -#endif - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD -}; - -enum { - DYNAMIC_LIST_EMAIL, - DYNAMIC_LIST_PHONE, - DYNAMIC_LIST_ADDRESS -}; - -GtkType -e_contact_editor_get_type (void) -{ - static GtkType contact_editor_type = 0; - - if (!contact_editor_type) - { - static const GtkTypeInfo contact_editor_info = - { - "EContactEditor", - sizeof (EContactEditor), - sizeof (EContactEditorClass), - (GtkClassInitFunc) e_contact_editor_class_init, - (GtkObjectInitFunc) e_contact_editor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_type = gtk_type_unique (gtk_vbox_get_type (), &contact_editor_info); - } - - return contact_editor_type; -} - -static void -e_contact_editor_class_init (EContactEditorClass *klass) -{ - GtkObjectClass *object_class; - GtkVBoxClass *vbox_class; - - object_class = (GtkObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - - parent_class = gtk_type_class (gtk_vbox_get_type ()); - -#if 0 - e_contact_editor_signals[E_CONTACT_EDITOR_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_contact_editor_signals, E_CONTACT_EDITOR_LAST_SIGNAL); -#endif - - gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - - object_class->set_arg = e_contact_editor_set_arg; - object_class->get_arg = e_contact_editor_get_arg; - object_class->destroy = e_contact_editor_destroy; -} - -static void -_add_image(GtkTable *table, gchar *image, int left, int right, int top, int bottom) -{ - gtk_table_attach(table, - gtk_widget_new(gtk_alignment_get_type(), - "child", gnome_pixmap_new_from_file(image), - "xalign", (double) 0, - "yalign", (double) 0, - "xscale", (double) 0, - "yscale", (double) 0, - NULL), - left, right, top, bottom, - GTK_FILL, GTK_FILL, - 0, 0); -} - -static void -_add_images(GtkTable *table) -{ - _add_image(table, DATADIR "/evolution/head.png", 0, 1, 0, 4); - _add_image(table, DATADIR "/evolution/phone.png", 4, 5, 0, 4); - _add_image(table, DATADIR "/evolution/email.png", 0, 1, 5, 7); - _add_image(table, DATADIR "/evolution/web.png", 0, 1, 8, 10); - _add_image(table, DATADIR "/evolution/snailmail.png", 4, 5, 5, 10); -} - -static void -_add_details_images(GtkTable *table) -{ - _add_image(table, DATADIR "/evolution/briefcase.png", 0, 1, 0, 2); - _add_image(table, DATADIR "/evolution/head.png", 0, 1, 4, 6); - _add_image(table, DATADIR "/evolution/netmeeting.png", 0, 1, 7, 9); - _add_image(table, DATADIR "/evolution/netfreebusy.png", 0, 1, 10, 12); -} - -static void -_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GtkSignalFunc func) -{ - GladeXML *gui = editor->gui; - GtkWidget *button = glade_xml_get_widget(gui, button_xml); - gchar *image_temp; - image_temp = g_strdup_printf("%s%s", DATADIR "/evolution/", image); - gtk_container_add(GTK_CONTAINER(button), - gnome_pixmap_new_from_file(image_temp)); - g_free(image_temp); - gtk_signal_connect(GTK_OBJECT(button), "button_press_event", func, editor); - -} - -static void -_replace_buttons(EContactEditor *editor) -{ - _replace_button(editor, "button-phone1", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone2", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone3", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone4", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-address1", "arrow.png", _address_arrow_pressed); - _replace_button(editor, "button-email1", "arrow.png", _email_arrow_pressed); -} - -static void -e_contact_editor_init (EContactEditor *e_contact_editor) -{ - GladeXML *gui; - GtkAdjustment *adjustment; - - /* e_contact_editor->card = NULL;*/ - gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL); - e_contact_editor->gui = gui; - gtk_widget_reparent(glade_xml_get_widget(gui, "notebook-contact-editor"), - GTK_WIDGET(e_contact_editor)); - - _add_images(GTK_TABLE(glade_xml_get_widget(gui, "table-contact-editor-general"))); - _add_details_images(GTK_TABLE(glade_xml_get_widget(gui, "table-contact-editor-details"))); - _replace_buttons(e_contact_editor); - - gtk_object_get(GTK_OBJECT(glade_xml_get_widget(gui, "text-comments")), - "vadjustment", &adjustment, - NULL); - gtk_range_set_adjustment(GTK_RANGE(glade_xml_get_widget(gui, "vscrollbar-comments")), - adjustment); - - e_contact_editor->email_info = NULL; - e_contact_editor->phone_info = NULL; - e_contact_editor->address_info = NULL; - e_contact_editor->email_popup = NULL; - e_contact_editor->phone_popup = NULL; - e_contact_editor->address_popup = NULL; - e_contact_editor->email_list = NULL; - e_contact_editor->phone_list = NULL; - e_contact_editor->address_list = NULL; -} - -void -e_contact_editor_destroy (GtkObject *object) { - EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object); - - if (e_contact_editor->email_list) { - g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->email_list); - } - if (e_contact_editor->email_info) { - g_free(e_contact_editor->email_info); - } - if (e_contact_editor->email_popup) { - gtk_widget_unref(e_contact_editor->email_popup); - } - - if (e_contact_editor->phone_list) { - g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->phone_list); - } - if (e_contact_editor->phone_info) { - g_free(e_contact_editor->phone_info); - } - if (e_contact_editor->phone_popup) { - gtk_widget_unref(e_contact_editor->phone_popup); - } - - if (e_contact_editor->address_list) { - g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->address_list); - } - if (e_contact_editor->address_info) { - g_free(e_contact_editor->address_info); - } - if (e_contact_editor->address_popup) { - gtk_widget_unref(e_contact_editor->address_popup); - } - - gtk_object_unref(GTK_OBJECT(e_contact_editor->gui)); -} - -GtkWidget* -e_contact_editor_new (void *card) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_get_type ())); - gtk_object_set (GTK_OBJECT(widget), - "card", card, - NULL); - return widget; -} - -static void -e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (o); - - switch (arg_id){ - case ARG_CARD: - /* e_contact_editor->card = GTK_VALUE_POINTER (*arg); - _update_card(e_contact_editor); - gnome_canvas_item_request_update (item);*/ - break; - } -} - -static void -e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (object); - - switch (arg_id) { - case ARG_CARD: - /* GTK_VALUE_POINTER (*arg) = e_contact_editor->card; */ - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -_popup_position(GtkMenu *menu, - gint *x, - gint *y, - gpointer data) -{ - GtkWidget *button = GTK_WIDGET(data); - GtkRequisition request; - int mh, mw; - gdk_window_get_origin (button->window, x, y); - *x += button->allocation.width; - *y += button->allocation.height; - - gtk_widget_size_request(GTK_WIDGET(menu), &request); - - mh = request.height; - mw = request.width; - - *x -= mw; - if (*x < 0) - *x = 0; - - if (*y < 0) - *y = 0; - - if ((*x + mw) > gdk_screen_width ()) - *x = gdk_screen_width () - mw; - - if ((*y + mh) > gdk_screen_height ()) - *y = gdk_screen_height () - mh; -} - -static void -_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title) -{ - gint menu_item; - gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event"); - gtk_widget_realize(popup); - menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor); - if ( menu_item != -1 ) { - if (menu_item == g_list_length (*list)) { - e_contact_editor_build_dialog(editor, entry, label, dialog_title, list, info); - } else { - gtk_object_set(GTK_OBJECT(glade_xml_get_widget(editor->gui, label)), - "label", g_list_nth_data(*list, menu_item), - NULL); - } - } -} - -static void -e_contact_editor_build_ui_info(GList *list, GnomeUIInfo **infop) -{ - GnomeUIInfo *info; - GnomeUIInfo singleton = { GNOME_APP_UI_ITEM, NULL, NULL, NULL, NULL, NULL, GNOME_APP_PIXMAP_NONE, 0, 0, 0, NULL }; - GnomeUIInfo end = GNOMEUIINFO_END; - int length; - int i; - - info = *infop; - - if ( info ) - g_free(info); - length = g_list_length( list ); - info = g_new(GnomeUIInfo, length + 2); - for (i = 0; i < length; i++) { - info[i] = singleton; - info[i].label = _(list->data); - list = list->next; - } - info[i] = singleton; - info[i].label = N_("Other..."); - i++; - info[i] = end; - - *infop = info; -} - -static void -_dialog_clicked(GtkWidget *dialog, gint button, EContactEditor *editor) -{ - GtkWidget *label = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_label"); - GtkWidget *entry = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_entry"); - GtkWidget *dialog_entry = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry"); - GList **list = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_list"); - GList **info = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_info"); - switch (button) { - case 0: - gtk_object_set(GTK_OBJECT(label), - "label", gtk_entry_get_text(GTK_ENTRY(dialog_entry)), - NULL); - *list = g_list_append(*list, g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog_entry)))); - g_free(*info); - *info = NULL; - break; - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static void -_dialog_destroy(EContactEditor *editor, GtkWidget *dialog) -{ - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static GtkWidget * -e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info) -{ - GtkWidget *dialog_entry = gtk_entry_new(); - GtkWidget *entry = glade_xml_get_widget(editor->gui, entry_id); - GtkWidget *label = glade_xml_get_widget(editor->gui, label_id); - - GtkWidget *dialog = gnome_dialog_new(title, - NULL); - - gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox), - gtk_widget_new (gtk_frame_get_type(), - "border_width", 4, - "label", title, - "child", gtk_widget_new(gtk_alignment_get_type(), - "child", dialog_entry, - "xalign", .5, - "yalign", .5, - "xscale", 1.0, - "yscale", 1.0, - "border_width", 9, - NULL), - NULL)); - - gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(dialog), - "Add", - GNOME_STOCK_PIXMAP_ADD); - gnome_dialog_append_button(GNOME_DIALOG(dialog), GNOME_STOCK_BUTTON_CANCEL); - gnome_dialog_set_default(GNOME_DIALOG(dialog), 0); - - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - _dialog_clicked, editor); - gtk_signal_connect_while_alive(GTK_OBJECT(editor), "destroy", - _dialog_destroy, GTK_OBJECT(dialog), GTK_OBJECT(dialog)); - - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_entry", entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_label", label); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry", dialog_entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_list", list); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_info", info); - - gtk_widget_show_all(dialog); - return dialog; -} - -static void -_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int which; - int i; - gchar *label; - gchar *entry; - if ( widget == glade_xml_get_widget(editor->gui, "button-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone4") ) { - which = 4; - } else - return; - - label = g_strdup_printf("label-phone%d", which); - entry = g_strdup_printf("entry-phone%d", which); - - if (editor->phone_list == NULL) { - static char *info[] = { - N_("Assistant"), - N_("Business"), - N_("Business 2"), - N_("Business Fax"), - N_("Callback"), - N_("Car"), - N_("Company"), - N_("Home"), - N_("Home 2"), - N_("Home Fax"), - N_("ISDN"), - N_("Mobile"), - N_("Other"), - N_("Other Fax"), - N_("Pager"), - N_("Primary"), - N_("Radio"), - N_("Telex"), - N_("TTY/TDD") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->phone_list = g_list_append(editor->phone_list, g_strdup(info[i])); - } - } - if (editor->phone_info == NULL) { - e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info); - - if ( editor->phone_popup ) - gtk_widget_unref(editor->phone_popup); - - editor->phone_popup = gnome_popup_menu_new(editor->phone_info); - } - - _arrow_pressed (widget, button, editor, editor->phone_popup, &editor->phone_list, &editor->phone_info, label, entry, "Add new phone number type"); - - g_free(label); - g_free(entry); -} - -static void -_email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - if (editor->email_list == NULL) { - static char *info[] = { - N_("Email"), - N_("Email 2"), - N_("Email 3") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->email_list = g_list_append(editor->email_list, g_strdup(info[i])); - } - } - if (editor->email_info == NULL) { - e_contact_editor_build_ui_info(editor->email_list, &editor->email_info); - - if ( editor->email_popup ) - gtk_widget_unref(editor->email_popup); - - editor->email_popup = gnome_popup_menu_new(editor->email_info); - } - - _arrow_pressed (widget, button, editor, editor->email_popup, &editor->email_list, &editor->email_info, "label-email1", "entry-email1", "Add new Email type"); -} - -static void -_address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - if (editor->address_list == NULL) { - static char *info[] = { - N_("Business"), - N_("Home"), - N_("Other") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->address_list = g_list_append(editor->address_list, g_strdup(info[i])); - } - } - if (editor->address_info == NULL) { - e_contact_editor_build_ui_info(editor->address_list, &editor->address_info); - - if ( editor->address_popup ) - gtk_widget_unref(editor->address_popup); - - editor->address_popup = gnome_popup_menu_new(editor->address_info); - } - - _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address1", "entry-address1", "Add new Address type"); -} diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h deleted file mode 100644 index 7b914967ee..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CONTACT_EDITOR_H__ -#define __E_CONTACT_EDITOR_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * R The card currently being edited - */ - -#define E_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ()) -#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor)) -#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) - - -typedef struct _EContactEditor EContactEditor; -typedef struct _EContactEditorClass EContactEditorClass; - -struct _EContactEditor -{ - GtkVBox parent; - - /* item specific fields */ - /* ECard *card; */ - - GladeXML *gui; - GnomeUIInfo *email_info; - GnomeUIInfo *phone_info; - GnomeUIInfo *address_info; - GtkWidget *email_popup; - GtkWidget *phone_popup; - GtkWidget *address_popup; - GList *email_list; - GList *phone_list; - GList *address_list; -}; - -struct _EContactEditorClass -{ - GtkVBoxClass parent_class; -}; - - -GtkWidget *e_contact_editor_new(void *card); -GtkType e_contact_editor_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/gui/contact-editor/email.png b/addressbook/gui/contact-editor/email.png deleted file mode 100644 index f3ff02e343..0000000000 Binary files a/addressbook/gui/contact-editor/email.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/head.png b/addressbook/gui/contact-editor/head.png deleted file mode 100644 index ca00b75f92..0000000000 Binary files a/addressbook/gui/contact-editor/head.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/netfreebusy.png b/addressbook/gui/contact-editor/netfreebusy.png deleted file mode 100644 index 09ec8a2a5c..0000000000 Binary files a/addressbook/gui/contact-editor/netfreebusy.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/netmeeting.png b/addressbook/gui/contact-editor/netmeeting.png deleted file mode 100644 index 4cb90c121e..0000000000 Binary files a/addressbook/gui/contact-editor/netmeeting.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/phone.png b/addressbook/gui/contact-editor/phone.png deleted file mode 100644 index ebec84ba0b..0000000000 Binary files a/addressbook/gui/contact-editor/phone.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/snailmail.png b/addressbook/gui/contact-editor/snailmail.png deleted file mode 100644 index 647ae8f68c..0000000000 Binary files a/addressbook/gui/contact-editor/snailmail.png and /dev/null differ diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c deleted file mode 100644 index 49ed7e48bf..0000000000 --- a/addressbook/gui/contact-editor/test-editor.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-editor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include -#include -#include "e-contact-editor.h" - -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - static int count = 2; - count --; - if ( count <= 0 ) - exit(0); -} - -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Editor Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact editor canvas item" ), - NULL); - gtk_widget_show (about); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Editor Test", VERSION, argc, argv); - - glade_gnome_init (); - - app = gnome_app_new("Contact Editor Test", NULL); - - editor = e_contact_editor_new(NULL); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - app = gnome_app_new("Contact Editor Test", NULL); - - editor = e_contact_editor_new(NULL); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/contact-editor/web.png b/addressbook/gui/contact-editor/web.png deleted file mode 100644 index 3211a11b19..0000000000 Binary files a/addressbook/gui/contact-editor/web.png and /dev/null differ diff --git a/addressbook/gui/minicard/.cvsignore b/addressbook/gui/minicard/.cvsignore deleted file mode 100644 index 4af6725b43..0000000000 --- a/addressbook/gui/minicard/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -minicard-label-test -minicard-test -reflow-test \ No newline at end of file diff --git a/addressbook/gui/minicard/Makefile.am b/addressbook/gui/minicard/Makefile.am deleted file mode 100644 index 0790577ad1..0000000000 --- a/addressbook/gui/minicard/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/e-util \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = \ - libeminicard.a - -libeminicard_a_SOURCES = \ - e-minicard.c \ - e-minicard.h \ - e-minicard-label.c \ - e-minicard-label.h \ - e-reflow.c \ - e-reflow.h - -noinst_PROGRAMS = \ - minicard-label-test \ - minicard-test \ - reflow-test - -minicard_label_test_SOURCES = \ - test-minicard-label.c - -minicard_label_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a - -minicard_test_SOURCES = \ - test-minicard.c - -minicard_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a - -reflow_test_SOURCES = \ - test-reflow.c - -reflow_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a diff --git a/addressbook/gui/minicard/e-minicard-label.c b/addressbook/gui/minicard/e-minicard-label.c deleted file mode 100644 index 5b528d6190..0000000000 --- a/addressbook/gui/minicard/e-minicard-label.c +++ /dev/null @@ -1,462 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-label.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-minicard-label.h" -#include "e-text.h" -#include "e-canvas.h" -#include "e-util.h" -static void e_minicard_label_init (EMinicardLabel *card); -static void e_minicard_label_class_init (EMinicardLabelClass *klass); -static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_label_realize (GnomeCanvasItem *item); -static void e_minicard_label_unrealize (GnomeCanvasItem *item); - -static void update_label( EMinicardLabel *minicard_label ); -static void resize( GtkObject *object, gpointer data ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_MINICARD_LABEL_RESIZE, - E_MINICARD_LABEL_LAST_SIGNAL -}; - -static guint e_minicard_label_signals[E_MINICARD_LABEL_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_FIELD, - ARG_FIELDNAME -}; - -GtkType -e_minicard_label_get_type (void) -{ - static GtkType minicard_label_type = 0; - - if (!minicard_label_type) - { - static const GtkTypeInfo minicard_label_info = - { - "EMinicardLabel", - sizeof (EMinicardLabel), - sizeof (EMinicardLabelClass), - (GtkClassInitFunc) e_minicard_label_class_init, - (GtkObjectInitFunc) e_minicard_label_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_label_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_label_info); - } - - return minicard_label_type; -} - -static void -e_minicard_label_class_init (EMinicardLabelClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_minicard_label_signals[E_MINICARD_LABEL_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMinicardLabelClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_minicard_label_signals, E_MINICARD_LABEL_LAST_SIGNAL); - - gtk_object_add_arg_type ("EMinicardLabel::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELD); - gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELDNAME); - - klass->resize = NULL; - - object_class->set_arg = e_minicard_label_set_arg; - object_class->get_arg = e_minicard_label_get_arg; - /* object_class->destroy = e_minicard_label_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_label_realize; - item_class->unrealize = e_minicard_label_unrealize; - item_class->event = e_minicard_label_event; -} - -static void -e_minicard_label_init (EMinicardLabel *minicard_label) -{ - minicard_label->width = 10; - minicard_label->height = 10; - minicard_label->rect = NULL; - minicard_label->fieldname = NULL; - minicard_label->field = NULL; - minicard_label->fieldname_text = NULL; - minicard_label->field_text = NULL; -} - -static void -e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicardLabel *e_minicard_label; - - item = GNOME_CANVAS_ITEM (o); - e_minicard_label = E_MINICARD_LABEL (o); - - switch (arg_id){ - case ARG_WIDTH: - e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - update_label( e_minicard_label ); - gnome_canvas_item_request_update (item); - break; - case ARG_HAS_FOCUS: - if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) - e_canvas_item_grab_focus(e_minicard_label->field); - break; - case ARG_FIELD: - if ( e_minicard_label->field ) - gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->field_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; - case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->fieldname_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; - } -} - -static void -e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardLabel *e_minicard_label; - char *temp; - - e_minicard_label = E_MINICARD_LABEL (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_FIELD: - if ( e_minicard_label->field ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); - break; - case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_label_realize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - GnomeCanvasGroup *group; - static GdkFont *font = NULL; - - if ( font == NULL ) { - font = gdk_font_load("lucidasans-10"); - } - - e_minicard_label = E_MINICARD_LABEL (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - - e_minicard_label->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - "outline_color", NULL, - NULL ); - e_minicard_label->fieldname = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) 2, - "y", (double) 1, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - "clip_height", (double) 1, - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - NULL ); - if ( e_minicard_label->fieldname_text ) - { - gnome_canvas_item_set( e_minicard_label->fieldname, - "text", e_minicard_label->fieldname_text, - NULL ); - g_free( e_minicard_label->fieldname_text ); - } - gtk_signal_connect(GTK_OBJECT(e_minicard_label->fieldname), - "resize", - GTK_SIGNAL_FUNC(resize), - (gpointer) e_minicard_label); - - e_minicard_label->field = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) ( e_minicard_label->width / 2 + 2 ), - "y", (double) 1, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - "clip_height", (double) 1, - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - "editable", TRUE, - NULL ); - if ( e_minicard_label->field_text ) - { - gnome_canvas_item_set( e_minicard_label->field, - "text", e_minicard_label->field_text, - NULL ); - g_free( e_minicard_label->field_text ); - } - - gtk_signal_connect(GTK_OBJECT(e_minicard_label->field), - "resize", - GTK_SIGNAL_FUNC(resize), - (gpointer) e_minicard_label); - - update_label (e_minicard_label); - - if (!item->canvas->aa) - { - } - -} - -static void -e_minicard_label_unrealize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item); -} - -static gboolean -e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", "grey50", - "fill_color", "grey90", - NULL ); - e_minicard_label->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", NULL, - "fill_color", NULL, - NULL ); - e_minicard_label->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_MOTION_NOTIFY: - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: { - GnomeCanvasItem *field; - ArtPoint p; - double inv[6], affine[6]; - gboolean return_val; - - field = e_minicard_label->field; - art_affine_identity (affine); - - if (field->xform != NULL) { - if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) { - art_affine_multiply (affine, affine, field->xform); - } else { - affine[4] += field->xform[0]; - affine[5] += field->xform[1]; - } - } - - art_affine_invert (inv, affine); - switch(event->type) { - case GDK_MOTION_NOTIFY: - p.x = event->motion.x; - p.y = event->motion.y; - art_affine_point (&p, &p, inv); - event->motion.x = p.x; - event->motion.y = p.y; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - p.x = event->button.x; - p.y = event->button.y; - art_affine_point (&p, &p, inv); - event->button.x = p.x; - event->button.y = p.y; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - p.x = event->crossing.x; - p.y = event->crossing.y; - art_affine_point (&p, &p, inv); - event->crossing.x = p.x; - event->crossing.y = p.y; - break; - default: - break; - } - - gtk_signal_emit_by_name(GTK_OBJECT(e_minicard_label->field), "event", event, &return_val); - return return_val; - break; - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -update_label( EMinicardLabel *e_minicard_label ) -{ - if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) - { - gint old_height; - gdouble text_height; - old_height = e_minicard_label->height; - - gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), - "text_height", &text_height, - NULL); - gnome_canvas_item_set(e_minicard_label->fieldname, - "clip_height", (double) text_height, - NULL); - - e_minicard_label->height = text_height; - - - gtk_object_get(GTK_OBJECT(e_minicard_label->field), - "text_height", &text_height, - NULL); - gnome_canvas_item_set(e_minicard_label->field, - "clip_height", (double) text_height, - NULL); - - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; - - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "x", (double) ( e_minicard_label->width / 2 + 2 ), - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - NULL ); - - if (old_height != e_minicard_label->height) - gtk_signal_emit_by_name (GTK_OBJECT (e_minicard_label), "resize"); - - } -} - - - -static void -resize( GtkObject *object, gpointer data ) -{ - update_label(E_MINICARD_LABEL(data)); -} diff --git a/addressbook/gui/minicard/e-minicard-label.h b/addressbook/gui/minicard/e-minicard-label.h deleted file mode 100644 index ddbe7ab191..0000000000 --- a/addressbook/gui/minicard/e-minicard-label.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-label.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_MINICARD_LABEL_H__ -#define __E_MINICARD_LABEL_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardLabel - A label doing focus with non-marching ants. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the label - * height double R height of the label - * field string RW text in the field label - * fieldname string RW text in the fieldname label - */ - -#define E_MINICARD_LABEL_TYPE (e_minicard_label_get_type ()) -#define E_MINICARD_LABEL(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_LABEL_TYPE, EMinicardLabel)) -#define E_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_LABEL_TYPE, EMiniCardLabelClass)) -#define E_IS_MINICARD_LABEL(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_LABEL_TYPE)) -#define E_IS_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_LABEL_TYPE)) - - -typedef struct _EMinicardLabel EMinicardLabel; -typedef struct _EMinicardLabelClass EMinicardLabelClass; - -struct _EMinicardLabel -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - double width; - double height; - GnomeCanvasItem *fieldname; - GnomeCanvasItem *field; - GnomeCanvasItem *rect; - char *fieldname_text; - char *field_text; - - gboolean has_focus; -}; - -struct _EMinicardLabelClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicardLabel *text); -}; - - -GtkType e_minicard_label_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_LABEL_H__ */ diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c deleted file mode 100644 index 805c4e78ff..0000000000 --- a/addressbook/gui/minicard/e-minicard.c +++ /dev/null @@ -1,471 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-minicard.h" -#include "e-minicard-label.h" -#include "e-text.h" -#include "e-canvas.h" -#include "e-util.h" -static void e_minicard_init (EMinicard *card); -static void e_minicard_class_init (EMinicardClass *klass); -static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_realize (GnomeCanvasItem *item); -static void e_minicard_unrealize (GnomeCanvasItem *item); - -static void _update_card ( EMinicard *minicard ); -static void _resize( GtkObject *object, gpointer data ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_MINICARD_RESIZE, - E_MINICARD_LAST_SIGNAL -}; - -static guint e_minicard_signals[E_MINICARD_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_CARD -}; - -GtkType -e_minicard_get_type (void) -{ - static GtkType minicard_type = 0; - - if (!minicard_type) - { - static const GtkTypeInfo minicard_info = - { - "EMinicard", - sizeof (EMinicard), - sizeof (EMinicardClass), - (GtkClassInitFunc) e_minicard_class_init, - (GtkObjectInitFunc) e_minicard_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info); - } - - return minicard_type; -} - -static void -e_minicard_class_init (EMinicardClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_minicard_signals[E_MINICARD_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMinicardClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_minicard_signals, E_MINICARD_LAST_SIGNAL); - - gtk_object_add_arg_type ("EMinicard::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - - object_class->set_arg = e_minicard_set_arg; - object_class->get_arg = e_minicard_get_arg; - /* object_class->destroy = e_minicard_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_realize; - item_class->unrealize = e_minicard_unrealize; - item_class->event = e_minicard_event; -} - -static void -e_minicard_init (EMinicard *minicard) -{ - /* minicard->card = NULL;*/ - minicard->rect = NULL; - minicard->fields = NULL; - minicard->width = 10; - minicard->height = 10; - minicard->has_focus = FALSE; -} - -static void -e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicard *e_minicard; - - item = GNOME_CANVAS_ITEM (o); - e_minicard = E_MINICARD (o); - - switch (arg_id){ - case ARG_WIDTH: - if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { - e_minicard->width = GTK_VALUE_DOUBLE (*arg); - _update_card(e_minicard); - gnome_canvas_item_request_update (item); - } - break; - case ARG_HAS_FOCUS: - if (e_minicard->fields) { - if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START || - GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(e_minicard->fields->data), - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(g_list_last(e_minicard->fields)->data), - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } - } - else - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(e_minicard)); - break; - case ARG_CARD: - /* e_minicard->card = GTK_VALUE_POINTER (*arg); - _update_card(e_minicard); - gnome_canvas_item_request_update (item);*/ - break; - } -} - -static void -e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_CARD: - /* GTK_VALUE_POINTER (*arg) = e_minicard->card; */ - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_realize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - GnomeCanvasGroup *group; - GnomeCanvasItem *new_item; - - e_minicard = E_MINICARD (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_minicard->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard->width - 1, - "y2", (double) e_minicard->height - 1, - "outline_color", NULL, - NULL ); - - e_minicard->header_rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 2, - "y1", (double) 2, - "x2", (double) e_minicard->width - 3, - "y2", (double) e_minicard->height - 3, - "fill_color", "grey70", - NULL ); - - e_minicard->header_text = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) 6, - "y", (double) 6, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard->width - 12 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font", "lucidasans-bold-10", - "fill_color", "black", - "text", "Chris Lahey", - NULL ); - - gtk_signal_connect(GTK_OBJECT(e_minicard->header_text), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - if ( rand() % 2 ) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4, - "fieldname", "Address:", - "field", "100 Main St\nHome town, USA", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4.0, - "fieldname", "Email:", - "field", "clahey@address.com", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - _update_card( e_minicard ); - - if (!item->canvas->aa) { - } -} - -static void -e_minicard_unrealize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gboolean -e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard->rect, - "outline_color", "grey50", - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color", "darkblue", - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color", "white", - NULL ); - e_minicard->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard->rect, - "outline_color", NULL, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color", "grey70", - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color", "black", - NULL ); - e_minicard->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - e_canvas_item_grab_focus(item); - } - break; - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_minicard->fields; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus != E_FOCUS_NONE) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM (list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -_update_card( EMinicard *e_minicard ) -{ - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) { - GList *list; - gdouble text_height; - gint old_height; - - old_height = e_minicard->height; - - gtk_object_get( GTK_OBJECT( e_minicard->header_text ), - "text_height", &text_height, - NULL ); - - e_minicard->height = text_height + 10.0; - - gnome_canvas_item_set( e_minicard->header_rect, - "y2", text_height + 9.0, - NULL ); - - gnome_canvas_item_set( e_minicard->header_text, - "clip_height", (double)text_height, - NULL ); - - for(list = e_minicard->fields; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &text_height, - NULL); - gnome_canvas_item_set(GNOME_CANVAS_ITEM(list->data), - "y", (double) e_minicard->height, - NULL); - e_minicard->height += text_height; - } - e_minicard->height += 2; - - gnome_canvas_item_set( e_minicard->rect, - "y2", (double) e_minicard->height - 1, - NULL ); - - gnome_canvas_item_set( e_minicard->rect, - "x2", (double) e_minicard->width - 1.0, - "y2", (double) e_minicard->height - 1.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "x2", (double) e_minicard->width - 3.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "clip_width", (double) e_minicard->width - 12, - NULL ); - for ( list = e_minicard->fields; list; list = g_list_next( list ) ) { - gnome_canvas_item_set( GNOME_CANVAS_ITEM( list->data ), - "width", (double) e_minicard->width - 4.0, - NULL ); - - if (old_height != e_minicard->height) - gtk_signal_emit_by_name (GTK_OBJECT (e_minicard), "resize"); - } - } -} - -static void -_resize( GtkObject *object, gpointer data ) -{ - _update_card(E_MINICARD(data)); -} diff --git a/addressbook/gui/minicard/e-minicard.h b/addressbook/gui/minicard/e-minicard.h deleted file mode 100644 index 3be80c1586..0000000000 --- a/addressbook/gui/minicard/e-minicard.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_MINICARD_H__ -#define __E_MINICARD_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicard - A small card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the card - * height double R height of the card - * card ECard* RW Pointer to the ECard - */ - -#define E_MINICARD_TYPE (e_minicard_get_type ()) -#define E_MINICARD(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_TYPE, EMinicard)) -#define E_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_TYPE, EMinicardClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_TYPE)) - - -typedef struct _EMinicard EMinicard; -typedef struct _EMinicardClass EMinicardClass; -typedef enum _EMinicardFocusType EMinicardFocusType; - -enum _EMinicardFocusType { - E_MINICARD_FOCUS_TYPE_START, - E_MINICARD_FOCUS_TYPE_END -}; - -struct _EMinicard -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - /* ECard *card; */ - - GnomeCanvasItem *rect; - GnomeCanvasItem *header_rect; - GnomeCanvasItem *header_text; - GList *fields; /* Of type GnomeCanvasItem. */ - - gboolean has_focus; - - double width; - double height; -}; - -struct _EMinicardClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicard *minicard); -}; - - -GtkType e_minicard_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_H__ */ diff --git a/addressbook/gui/minicard/e-reflow.c b/addressbook/gui/minicard/e-reflow.c deleted file mode 100644 index 984e972f0c..0000000000 --- a/addressbook/gui/minicard/e-reflow.c +++ /dev/null @@ -1,787 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include "e-reflow.h" -#include "e-canvas-utils.h" -#include "e-util.h" -static void e_reflow_init (EReflow *card); -static void e_reflow_class_init (EReflowClass *klass); -static void e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_reflow_realize (GnomeCanvasItem *item); -static void e_reflow_unrealize (GnomeCanvasItem *item); -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags); -static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item); - -static void _update_reflow ( EReflow *reflow ); -static void _resize( GtkObject *object, gpointer data ); -static void _queue_reflow(EReflow *e_reflow); - -#define E_REFLOW_DIVIDER_WIDTH 2 -#define E_REFLOW_BORDER_WIDTH 7 -#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_REFLOW_RESIZE, - E_REFLOW_LAST_SIGNAL -}; - -static guint e_reflow_signals[E_REFLOW_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_MINIMUM_WIDTH, - ARG_WIDTH, - ARG_HEIGHT -}; - -GtkType -e_reflow_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EReflow", - sizeof (EReflow), - sizeof (EReflowClass), - (GtkClassInitFunc) e_reflow_class_init, - (GtkObjectInitFunc) e_reflow_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (gnome_canvas_group_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_reflow_class_init (EReflowClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_reflow_signals[E_REFLOW_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EReflowClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_reflow_signals, E_REFLOW_LAST_SIGNAL); - - gtk_object_add_arg_type ("EReflow::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("EReflow::width", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_WIDTH); - gtk_object_add_arg_type ("EReflow::height", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_HEIGHT); - - object_class->set_arg = e_reflow_set_arg; - object_class->get_arg = e_reflow_get_arg; - /* object_class->destroy = e_reflow_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->event = e_reflow_event; - item_class->realize = e_reflow_realize; - item_class->unrealize = e_reflow_unrealize; - item_class->draw = e_reflow_draw; - item_class->update = e_reflow_update; - item_class->point = e_reflow_point; -} - -static void -e_reflow_init (EReflow *reflow) -{ - /* reflow->card = NULL;*/ - reflow->items = NULL; - reflow->columns = NULL; - reflow->column_width = 150; - - reflow->minimum_width = 10; - reflow->width = 10; - reflow->height = 10; - reflow->idle = 0; - - reflow->column_drag = FALSE; - - reflow->need_height_update = FALSE; - reflow->need_column_resize = FALSE; - - reflow->default_cursor_shown = TRUE; - reflow->arrow_cursor = NULL; - reflow->default_cursor = NULL; -} - -static void -e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EReflow *e_reflow; - - item = GNOME_CANVAS_ITEM (o); - e_reflow = E_REFLOW (o); - - switch (arg_id){ - case ARG_HEIGHT: - e_reflow->height = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - case ARG_MINIMUM_WIDTH: - e_reflow->minimum_width = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - } -} - -static void -e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (object); - - switch (arg_id) { - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width; - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_reflow->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_reflow_realize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - GnomeCanvasGroup *group; - GList *list; - GtkAdjustment *adjustment; - - e_reflow = E_REFLOW (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); - e_reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); - - for(list = e_reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM(list->data); - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - } - - _queue_reflow( e_reflow ); - - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - - if (!item->canvas->aa) { - } -} - -static void -e_reflow_unrealize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - if (!item->canvas->aa) - { - } - - gdk_cursor_destroy (e_reflow->arrow_cursor); - gdk_cursor_destroy (e_reflow->default_cursor); - - g_list_free (e_reflow->items); - g_list_free (e_reflow->columns); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gint -e_reflow_pick_line (EReflow *e_reflow, double x) -{ - x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER; - return x; -} - -static gboolean -e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - switch( event->type ) - { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_reflow->items; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - break; - case GDK_BUTTON_PRESS: - switch(event->button.button) - { - case 1: - { - GdkEventButton *button = (GdkEventButton *) event; - double n_x; - n_x = button->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x); - e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; - e_reflow->temp_column_width = e_reflow->column_width; - e_reflow->column_drag = TRUE; - - gnome_canvas_item_grab (item, - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - e_reflow->arrow_cursor, - button->time); - - e_reflow->previous_temp_column_width = -1; - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - return TRUE; - } - } - break; - case 4: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value -= adjustment->step_increment; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - case 5: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value += adjustment->step_increment; - if ( new_value > adjustment->upper - adjustment->page_size ) - new_value = adjustment->upper - adjustment->page_size; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - } - break; - case GDK_BUTTON_RELEASE: - if (e_reflow->column_drag) { - gdouble old_width = e_reflow->column_width; - GdkEventButton *button = (GdkEventButton *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if ( e_reflow->temp_column_width < 50 ) - e_reflow->temp_column_width = 50; - e_reflow->column_drag = FALSE; - if ( old_width != e_reflow->temp_column_width ) { - gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width)); - e_reflow->column_width = e_reflow->temp_column_width; - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - _queue_reflow(e_reflow); - } else { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - gnome_canvas_item_ungrab (item, button->time); - return TRUE; - } - break; - case GDK_MOTION_NOTIFY: - if (e_reflow->column_drag) { - double old_width = e_reflow->temp_column_width; - GdkEventMotion *motion = (GdkEventMotion *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (motion->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if (e_reflow->temp_column_width < 50) - e_reflow->temp_column_width = 50; - if (old_width != e_reflow->temp_column_width) { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - return TRUE; - } else { - GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x; - n_x = motion->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } else - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - - } - break; - case GDK_ENTER_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } - } - break; - case GDK_LEAVE_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) { - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - } - } - break; - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -void -e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item) -{ - e_reflow->items = g_list_append(e_reflow->items, item); - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - _queue_reflow(e_reflow); - } - -} - -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - int x_rect, y_rect, width_rect, height_rect; - gdouble running_width; - EReflow *e_reflow = E_REFLOW(item); - int i; - double column_width; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw) - GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height); - column_width = e_reflow->column_width; - running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i = x; - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - NULL, - GTK_WIDGET(item->canvas), - "reflow", - x_rect - x, - y_rect - y, - width_rect, - height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - if (e_reflow->column_drag) { - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - i += start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gdk_draw_rectangle(drawable, - GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL], - TRUE, - x_rect - x, - y_rect - y, - width_rect - 1, - height_rect - 1); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ - EReflow *e_reflow; - double x0, x1, y0, y1; - - e_reflow = E_REFLOW (item); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) - GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags); - - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x1 < x0 + e_reflow->width ) - x1 = x0 + e_reflow->width; - if ( y1 < y0 + e_reflow->height ) - y1 = y0 + e_reflow->height; - item->x2 = x1; - item->y2 = y1; - - if (e_reflow->need_height_update) { - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x0 > 0 ) - x0 = 0; - if ( y0 > 0 ) - y0 = 0; - if ( x1 < E_REFLOW(item)->width ) - x1 = E_REFLOW(item)->width; - if ( x1 < E_REFLOW(item)->height ) - x1 = E_REFLOW(item)->height; - - gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1); - e_reflow->need_height_update = FALSE; - } else if (e_reflow->need_column_resize) { - int x_rect, y_rect, width_rect, height_rect; - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - gdouble running_width; - int i; - double column_width; - - if ( e_reflow->previous_temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->previous_temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - if ( e_reflow->temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - e_reflow->previous_temp_column_width = e_reflow->temp_column_width; - e_reflow->need_column_resize = FALSE; - } -} - -static double -e_reflow_point (GnomeCanvasItem *item, - double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - double distance = 1; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point) - distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item); - if (*actual_item) - return 0; - - *actual_item = item; - return 0; -#if 0 - if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) { - float n_x; - n_x = x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if (n_x < E_REFLOW_FULL_GUTTER) { - *actual_item = item; - return 0; - } - } - return distance; -#endif -} - -static void -_reflow( EReflow *e_reflow ) -{ - gdouble running_height; - GList *list; - double item_height; - - if (e_reflow->columns) { - g_list_free (e_reflow->columns); - e_reflow->columns = NULL; - } - - e_reflow->column_count = 0; - - if (e_reflow->items == NULL) { - e_reflow->columns = NULL; - e_reflow->column_count = 1; - return; - } - - list = e_reflow->items; - - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count = 1; - - list = g_list_next(list); - - for ( ; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) { - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count ++; - } else { - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -_update_reflow( EReflow *e_reflow ) -{ - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - - gdouble old_width; - gdouble running_width; - - _reflow (e_reflow); - - old_width = e_reflow->width; - - running_width = E_REFLOW_BORDER_WIDTH; - - if (e_reflow->items == NULL) { - } else { - GList *list; - GList *next_column; - gdouble item_height; - gdouble running_height; - - running_height = E_REFLOW_BORDER_WIDTH; - - list = e_reflow->items; - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - running_height += item_height + E_REFLOW_BORDER_WIDTH; - next_column = g_list_next(e_reflow->columns); - list = g_list_next(list); - - for( ; list; list = g_list_next(list)) { - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - - if (next_column && (next_column->data == list)) { - next_column = g_list_next (next_column); - running_height = E_REFLOW_BORDER_WIDTH; - running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH; - } - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - - } - e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH; - if ( e_reflow->width < e_reflow->minimum_width ) - e_reflow->width = e_reflow->minimum_width; - if (old_width != e_reflow->width) - gtk_signal_emit_by_name (GTK_OBJECT (e_reflow), "resize"); - } -} - - -static gboolean -_idle_reflow(gpointer data) -{ - EReflow *e_reflow = E_REFLOW(data); - _update_reflow(e_reflow); - e_reflow->need_height_update = TRUE; - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(e_reflow)); - e_reflow->idle = 0; - return FALSE; -} - -static void -_queue_reflow(EReflow *e_reflow) -{ - if (e_reflow->idle == 0) - e_reflow->idle = g_idle_add(_idle_reflow, e_reflow); -} - -static void -_resize( GtkObject *object, gpointer data ) -{ - _queue_reflow(E_REFLOW(data)); -} diff --git a/addressbook/gui/minicard/e-reflow.h b/addressbook/gui/minicard/e-reflow.h deleted file mode 100644 index 3a731474cb..0000000000 --- a/addressbook/gui/minicard/e-reflow.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-reflow.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_REFLOW_H__ -#define __E_REFLOW_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EReflow - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * minimum_width double RW minimum width of the reflow. width >= minimum_width - * width double R width of the reflow - * height double RW height of the reflow - */ - -#define E_REFLOW_TYPE (e_reflow_get_type ()) -#define E_REFLOW(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_TYPE, EReflow)) -#define E_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass)) -#define E_IS_REFLOW(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_TYPE)) -#define E_IS_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE)) - - -typedef struct _EReflow EReflow; -typedef struct _EReflowClass EReflowClass; - -struct _EReflow -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - /* EBook *book; */ - - GList *items; /* Of type GnomeCanvasItem */ - GList *columns; /* Of type GList pointing to type GnomeCanvasItem (points into items) */ - gint column_count; /* Number of columnns */ - - double minimum_width; - double width; - double height; - - double column_width; - - int idle; - - /* These are all for when the column is being dragged. */ - gboolean column_drag; - gdouble start_x; - gint which_column_dragged; - double temp_column_width; - double previous_temp_column_width; - - guint need_height_update : 1; - guint need_column_resize : 1; - - guint default_cursor_shown : 1; - GdkCursor *arrow_cursor; - GdkCursor *default_cursor; -}; - -struct _EReflowClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EReflow *reflow); -}; - -/* To be added to a reflow, an item must have the arguments "x", "y", - and "width" as Read/Write arguments and "height" as a Read Only - argument. It must also have a "resize" signal. */ -void e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item); -GtkType e_reflow_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_REFLOW_H__ */ diff --git a/addressbook/gui/minicard/test-minicard-label.c b/addressbook/gui/minicard/test-minicard-label.c deleted file mode 100644 index 8da34e6f22..0000000000 --- a/addressbook/gui/minicard/test-minicard-label.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard-label.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-minicard-label.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *label; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( label, - "width", (double) allocation->width, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Label Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard label canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void button_press_callback( GtkWidget *widget, gpointer data ) -{ - gnome_canvas_item_grab_focus( label ); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Label Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Label Test", NULL); - - canvas = gnome_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - label = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_label_get_type(), - "x", (double) 0, - "y", (double) 0, - "width", (double) 100, - "height", (double) 100, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "button_press_event", - GTK_SIGNAL_FUNC( button_press_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/minicard/test-minicard.c b/addressbook/gui/minicard/test-minicard.c deleted file mode 100644 index 1ad066b3fe..0000000000 --- a/addressbook/gui/minicard/test-minicard.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *card; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( card, - "width", (double) allocation->width, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Test", NULL); - - canvas = gnome_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - for ( i = 0; i < 1; i++ ) - { - card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_get_type(), - "x", (double) 0, - "y", (double) 0, - "width", (double) 100, - NULL ); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/minicard/test-reflow.c b/addressbook/gui/minicard/test-reflow.c deleted file mode 100644 index 319a3f5626..0000000000 --- a/addressbook/gui/minicard/test-reflow.c +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-canvas.h" -#include "e-reflow.h" -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvasItem *item, gpointer data) -{ - double width; - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(item->canvas , 0, 0, width, last_alloc.height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollbar; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Reflow Test", VERSION, argc, argv); - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_reflow_get_type(), - "x", (double) 0, - "y", (double) 0, - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_signal_connect( GTK_OBJECT( reflow ), "resize", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) app); - for ( i = 0; i < 200; i++ ) - { - GnomeCanvasItem *item; - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow), - e_minicard_get_type(), - NULL); - e_reflow_add_item(E_REFLOW(reflow), item); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas))); - - gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); - - gnome_app_set_contents( GNOME_APP( app ), vbox ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am deleted file mode 100644 index 0790577ad1..0000000000 --- a/addressbook/gui/widgets/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/e-util \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = \ - libeminicard.a - -libeminicard_a_SOURCES = \ - e-minicard.c \ - e-minicard.h \ - e-minicard-label.c \ - e-minicard-label.h \ - e-reflow.c \ - e-reflow.h - -noinst_PROGRAMS = \ - minicard-label-test \ - minicard-test \ - reflow-test - -minicard_label_test_SOURCES = \ - test-minicard-label.c - -minicard_label_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a - -minicard_test_SOURCES = \ - test-minicard.c - -minicard_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a - -reflow_test_SOURCES = \ - test-reflow.c - -reflow_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c deleted file mode 100644 index 5b528d6190..0000000000 --- a/addressbook/gui/widgets/e-minicard-label.c +++ /dev/null @@ -1,462 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-label.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-minicard-label.h" -#include "e-text.h" -#include "e-canvas.h" -#include "e-util.h" -static void e_minicard_label_init (EMinicardLabel *card); -static void e_minicard_label_class_init (EMinicardLabelClass *klass); -static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_label_realize (GnomeCanvasItem *item); -static void e_minicard_label_unrealize (GnomeCanvasItem *item); - -static void update_label( EMinicardLabel *minicard_label ); -static void resize( GtkObject *object, gpointer data ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_MINICARD_LABEL_RESIZE, - E_MINICARD_LABEL_LAST_SIGNAL -}; - -static guint e_minicard_label_signals[E_MINICARD_LABEL_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_FIELD, - ARG_FIELDNAME -}; - -GtkType -e_minicard_label_get_type (void) -{ - static GtkType minicard_label_type = 0; - - if (!minicard_label_type) - { - static const GtkTypeInfo minicard_label_info = - { - "EMinicardLabel", - sizeof (EMinicardLabel), - sizeof (EMinicardLabelClass), - (GtkClassInitFunc) e_minicard_label_class_init, - (GtkObjectInitFunc) e_minicard_label_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_label_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_label_info); - } - - return minicard_label_type; -} - -static void -e_minicard_label_class_init (EMinicardLabelClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_minicard_label_signals[E_MINICARD_LABEL_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMinicardLabelClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_minicard_label_signals, E_MINICARD_LABEL_LAST_SIGNAL); - - gtk_object_add_arg_type ("EMinicardLabel::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELD); - gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELDNAME); - - klass->resize = NULL; - - object_class->set_arg = e_minicard_label_set_arg; - object_class->get_arg = e_minicard_label_get_arg; - /* object_class->destroy = e_minicard_label_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_label_realize; - item_class->unrealize = e_minicard_label_unrealize; - item_class->event = e_minicard_label_event; -} - -static void -e_minicard_label_init (EMinicardLabel *minicard_label) -{ - minicard_label->width = 10; - minicard_label->height = 10; - minicard_label->rect = NULL; - minicard_label->fieldname = NULL; - minicard_label->field = NULL; - minicard_label->fieldname_text = NULL; - minicard_label->field_text = NULL; -} - -static void -e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicardLabel *e_minicard_label; - - item = GNOME_CANVAS_ITEM (o); - e_minicard_label = E_MINICARD_LABEL (o); - - switch (arg_id){ - case ARG_WIDTH: - e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - update_label( e_minicard_label ); - gnome_canvas_item_request_update (item); - break; - case ARG_HAS_FOCUS: - if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) - e_canvas_item_grab_focus(e_minicard_label->field); - break; - case ARG_FIELD: - if ( e_minicard_label->field ) - gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->field_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; - case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->fieldname_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; - } -} - -static void -e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardLabel *e_minicard_label; - char *temp; - - e_minicard_label = E_MINICARD_LABEL (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_FIELD: - if ( e_minicard_label->field ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); - break; - case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_label_realize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - GnomeCanvasGroup *group; - static GdkFont *font = NULL; - - if ( font == NULL ) { - font = gdk_font_load("lucidasans-10"); - } - - e_minicard_label = E_MINICARD_LABEL (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - - e_minicard_label->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - "outline_color", NULL, - NULL ); - e_minicard_label->fieldname = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) 2, - "y", (double) 1, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - "clip_height", (double) 1, - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - NULL ); - if ( e_minicard_label->fieldname_text ) - { - gnome_canvas_item_set( e_minicard_label->fieldname, - "text", e_minicard_label->fieldname_text, - NULL ); - g_free( e_minicard_label->fieldname_text ); - } - gtk_signal_connect(GTK_OBJECT(e_minicard_label->fieldname), - "resize", - GTK_SIGNAL_FUNC(resize), - (gpointer) e_minicard_label); - - e_minicard_label->field = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) ( e_minicard_label->width / 2 + 2 ), - "y", (double) 1, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - "clip_height", (double) 1, - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - "editable", TRUE, - NULL ); - if ( e_minicard_label->field_text ) - { - gnome_canvas_item_set( e_minicard_label->field, - "text", e_minicard_label->field_text, - NULL ); - g_free( e_minicard_label->field_text ); - } - - gtk_signal_connect(GTK_OBJECT(e_minicard_label->field), - "resize", - GTK_SIGNAL_FUNC(resize), - (gpointer) e_minicard_label); - - update_label (e_minicard_label); - - if (!item->canvas->aa) - { - } - -} - -static void -e_minicard_label_unrealize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item); -} - -static gboolean -e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", "grey50", - "fill_color", "grey90", - NULL ); - e_minicard_label->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", NULL, - "fill_color", NULL, - NULL ); - e_minicard_label->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_MOTION_NOTIFY: - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: { - GnomeCanvasItem *field; - ArtPoint p; - double inv[6], affine[6]; - gboolean return_val; - - field = e_minicard_label->field; - art_affine_identity (affine); - - if (field->xform != NULL) { - if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) { - art_affine_multiply (affine, affine, field->xform); - } else { - affine[4] += field->xform[0]; - affine[5] += field->xform[1]; - } - } - - art_affine_invert (inv, affine); - switch(event->type) { - case GDK_MOTION_NOTIFY: - p.x = event->motion.x; - p.y = event->motion.y; - art_affine_point (&p, &p, inv); - event->motion.x = p.x; - event->motion.y = p.y; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - p.x = event->button.x; - p.y = event->button.y; - art_affine_point (&p, &p, inv); - event->button.x = p.x; - event->button.y = p.y; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - p.x = event->crossing.x; - p.y = event->crossing.y; - art_affine_point (&p, &p, inv); - event->crossing.x = p.x; - event->crossing.y = p.y; - break; - default: - break; - } - - gtk_signal_emit_by_name(GTK_OBJECT(e_minicard_label->field), "event", event, &return_val); - return return_val; - break; - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -update_label( EMinicardLabel *e_minicard_label ) -{ - if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) - { - gint old_height; - gdouble text_height; - old_height = e_minicard_label->height; - - gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), - "text_height", &text_height, - NULL); - gnome_canvas_item_set(e_minicard_label->fieldname, - "clip_height", (double) text_height, - NULL); - - e_minicard_label->height = text_height; - - - gtk_object_get(GTK_OBJECT(e_minicard_label->field), - "text_height", &text_height, - NULL); - gnome_canvas_item_set(e_minicard_label->field, - "clip_height", (double) text_height, - NULL); - - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; - - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "x", (double) ( e_minicard_label->width / 2 + 2 ), - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - NULL ); - - if (old_height != e_minicard_label->height) - gtk_signal_emit_by_name (GTK_OBJECT (e_minicard_label), "resize"); - - } -} - - - -static void -resize( GtkObject *object, gpointer data ) -{ - update_label(E_MINICARD_LABEL(data)); -} diff --git a/addressbook/gui/widgets/e-minicard-label.h b/addressbook/gui/widgets/e-minicard-label.h deleted file mode 100644 index ddbe7ab191..0000000000 --- a/addressbook/gui/widgets/e-minicard-label.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-label.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_MINICARD_LABEL_H__ -#define __E_MINICARD_LABEL_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardLabel - A label doing focus with non-marching ants. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the label - * height double R height of the label - * field string RW text in the field label - * fieldname string RW text in the fieldname label - */ - -#define E_MINICARD_LABEL_TYPE (e_minicard_label_get_type ()) -#define E_MINICARD_LABEL(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_LABEL_TYPE, EMinicardLabel)) -#define E_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_LABEL_TYPE, EMiniCardLabelClass)) -#define E_IS_MINICARD_LABEL(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_LABEL_TYPE)) -#define E_IS_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_LABEL_TYPE)) - - -typedef struct _EMinicardLabel EMinicardLabel; -typedef struct _EMinicardLabelClass EMinicardLabelClass; - -struct _EMinicardLabel -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - double width; - double height; - GnomeCanvasItem *fieldname; - GnomeCanvasItem *field; - GnomeCanvasItem *rect; - char *fieldname_text; - char *field_text; - - gboolean has_focus; -}; - -struct _EMinicardLabelClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicardLabel *text); -}; - - -GtkType e_minicard_label_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_LABEL_H__ */ diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c deleted file mode 100644 index 805c4e78ff..0000000000 --- a/addressbook/gui/widgets/e-minicard.c +++ /dev/null @@ -1,471 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-minicard.h" -#include "e-minicard-label.h" -#include "e-text.h" -#include "e-canvas.h" -#include "e-util.h" -static void e_minicard_init (EMinicard *card); -static void e_minicard_class_init (EMinicardClass *klass); -static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_realize (GnomeCanvasItem *item); -static void e_minicard_unrealize (GnomeCanvasItem *item); - -static void _update_card ( EMinicard *minicard ); -static void _resize( GtkObject *object, gpointer data ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_MINICARD_RESIZE, - E_MINICARD_LAST_SIGNAL -}; - -static guint e_minicard_signals[E_MINICARD_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_CARD -}; - -GtkType -e_minicard_get_type (void) -{ - static GtkType minicard_type = 0; - - if (!minicard_type) - { - static const GtkTypeInfo minicard_info = - { - "EMinicard", - sizeof (EMinicard), - sizeof (EMinicardClass), - (GtkClassInitFunc) e_minicard_class_init, - (GtkObjectInitFunc) e_minicard_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info); - } - - return minicard_type; -} - -static void -e_minicard_class_init (EMinicardClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_minicard_signals[E_MINICARD_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMinicardClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_minicard_signals, E_MINICARD_LAST_SIGNAL); - - gtk_object_add_arg_type ("EMinicard::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - - object_class->set_arg = e_minicard_set_arg; - object_class->get_arg = e_minicard_get_arg; - /* object_class->destroy = e_minicard_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_realize; - item_class->unrealize = e_minicard_unrealize; - item_class->event = e_minicard_event; -} - -static void -e_minicard_init (EMinicard *minicard) -{ - /* minicard->card = NULL;*/ - minicard->rect = NULL; - minicard->fields = NULL; - minicard->width = 10; - minicard->height = 10; - minicard->has_focus = FALSE; -} - -static void -e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicard *e_minicard; - - item = GNOME_CANVAS_ITEM (o); - e_minicard = E_MINICARD (o); - - switch (arg_id){ - case ARG_WIDTH: - if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { - e_minicard->width = GTK_VALUE_DOUBLE (*arg); - _update_card(e_minicard); - gnome_canvas_item_request_update (item); - } - break; - case ARG_HAS_FOCUS: - if (e_minicard->fields) { - if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START || - GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(e_minicard->fields->data), - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(g_list_last(e_minicard->fields)->data), - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } - } - else - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(e_minicard)); - break; - case ARG_CARD: - /* e_minicard->card = GTK_VALUE_POINTER (*arg); - _update_card(e_minicard); - gnome_canvas_item_request_update (item);*/ - break; - } -} - -static void -e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_CARD: - /* GTK_VALUE_POINTER (*arg) = e_minicard->card; */ - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_realize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - GnomeCanvasGroup *group; - GnomeCanvasItem *new_item; - - e_minicard = E_MINICARD (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_minicard->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard->width - 1, - "y2", (double) e_minicard->height - 1, - "outline_color", NULL, - NULL ); - - e_minicard->header_rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 2, - "y1", (double) 2, - "x2", (double) e_minicard->width - 3, - "y2", (double) e_minicard->height - 3, - "fill_color", "grey70", - NULL ); - - e_minicard->header_text = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) 6, - "y", (double) 6, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard->width - 12 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font", "lucidasans-bold-10", - "fill_color", "black", - "text", "Chris Lahey", - NULL ); - - gtk_signal_connect(GTK_OBJECT(e_minicard->header_text), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - if ( rand() % 2 ) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4, - "fieldname", "Address:", - "field", "100 Main St\nHome town, USA", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4.0, - "fieldname", "Email:", - "field", "clahey@address.com", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - _update_card( e_minicard ); - - if (!item->canvas->aa) { - } -} - -static void -e_minicard_unrealize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gboolean -e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard->rect, - "outline_color", "grey50", - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color", "darkblue", - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color", "white", - NULL ); - e_minicard->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard->rect, - "outline_color", NULL, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color", "grey70", - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color", "black", - NULL ); - e_minicard->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - e_canvas_item_grab_focus(item); - } - break; - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_minicard->fields; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus != E_FOCUS_NONE) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM (list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -_update_card( EMinicard *e_minicard ) -{ - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) { - GList *list; - gdouble text_height; - gint old_height; - - old_height = e_minicard->height; - - gtk_object_get( GTK_OBJECT( e_minicard->header_text ), - "text_height", &text_height, - NULL ); - - e_minicard->height = text_height + 10.0; - - gnome_canvas_item_set( e_minicard->header_rect, - "y2", text_height + 9.0, - NULL ); - - gnome_canvas_item_set( e_minicard->header_text, - "clip_height", (double)text_height, - NULL ); - - for(list = e_minicard->fields; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &text_height, - NULL); - gnome_canvas_item_set(GNOME_CANVAS_ITEM(list->data), - "y", (double) e_minicard->height, - NULL); - e_minicard->height += text_height; - } - e_minicard->height += 2; - - gnome_canvas_item_set( e_minicard->rect, - "y2", (double) e_minicard->height - 1, - NULL ); - - gnome_canvas_item_set( e_minicard->rect, - "x2", (double) e_minicard->width - 1.0, - "y2", (double) e_minicard->height - 1.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "x2", (double) e_minicard->width - 3.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "clip_width", (double) e_minicard->width - 12, - NULL ); - for ( list = e_minicard->fields; list; list = g_list_next( list ) ) { - gnome_canvas_item_set( GNOME_CANVAS_ITEM( list->data ), - "width", (double) e_minicard->width - 4.0, - NULL ); - - if (old_height != e_minicard->height) - gtk_signal_emit_by_name (GTK_OBJECT (e_minicard), "resize"); - } - } -} - -static void -_resize( GtkObject *object, gpointer data ) -{ - _update_card(E_MINICARD(data)); -} diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h deleted file mode 100644 index 3be80c1586..0000000000 --- a/addressbook/gui/widgets/e-minicard.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_MINICARD_H__ -#define __E_MINICARD_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicard - A small card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the card - * height double R height of the card - * card ECard* RW Pointer to the ECard - */ - -#define E_MINICARD_TYPE (e_minicard_get_type ()) -#define E_MINICARD(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_TYPE, EMinicard)) -#define E_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_TYPE, EMinicardClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_TYPE)) - - -typedef struct _EMinicard EMinicard; -typedef struct _EMinicardClass EMinicardClass; -typedef enum _EMinicardFocusType EMinicardFocusType; - -enum _EMinicardFocusType { - E_MINICARD_FOCUS_TYPE_START, - E_MINICARD_FOCUS_TYPE_END -}; - -struct _EMinicard -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - /* ECard *card; */ - - GnomeCanvasItem *rect; - GnomeCanvasItem *header_rect; - GnomeCanvasItem *header_text; - GList *fields; /* Of type GnomeCanvasItem. */ - - gboolean has_focus; - - double width; - double height; -}; - -struct _EMinicardClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicard *minicard); -}; - - -GtkType e_minicard_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_H__ */ diff --git a/addressbook/gui/widgets/test-minicard-label.c b/addressbook/gui/widgets/test-minicard-label.c deleted file mode 100644 index 8da34e6f22..0000000000 --- a/addressbook/gui/widgets/test-minicard-label.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard-label.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-minicard-label.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *label; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( label, - "width", (double) allocation->width, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Label Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard label canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void button_press_callback( GtkWidget *widget, gpointer data ) -{ - gnome_canvas_item_grab_focus( label ); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Label Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Label Test", NULL); - - canvas = gnome_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - label = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_label_get_type(), - "x", (double) 0, - "y", (double) 0, - "width", (double) 100, - "height", (double) 100, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "button_press_event", - GTK_SIGNAL_FUNC( button_press_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-minicard.c b/addressbook/gui/widgets/test-minicard.c deleted file mode 100644 index 1ad066b3fe..0000000000 --- a/addressbook/gui/widgets/test-minicard.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *card; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( card, - "width", (double) allocation->width, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Test", NULL); - - canvas = gnome_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - for ( i = 0; i < 1; i++ ) - { - card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_get_type(), - "x", (double) 0, - "y", (double) 0, - "width", (double) 100, - NULL ); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c deleted file mode 100644 index 319a3f5626..0000000000 --- a/addressbook/gui/widgets/test-reflow.c +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-canvas.h" -#include "e-reflow.h" -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvasItem *item, gpointer data) -{ - double width; - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(item->canvas , 0, 0, width, last_alloc.height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollbar; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Reflow Test", VERSION, argc, argv); - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_reflow_get_type(), - "x", (double) 0, - "y", (double) 0, - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_signal_connect( GTK_OBJECT( reflow ), "resize", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) app); - for ( i = 0; i < 200; i++ ) - { - GnomeCanvasItem *item; - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow), - e_minicard_get_type(), - NULL); - e_reflow_add_item(E_REFLOW(reflow), item); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas))); - - gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); - - gnome_app_set_contents( GNOME_APP( app ), vbox ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/printing/.cvsignore b/addressbook/printing/.cvsignore deleted file mode 100644 index eeb58ea38b..0000000000 --- a/addressbook/printing/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -contact-print-test -contact-print-style-editor-test diff --git a/addressbook/printing/Makefile.am b/addressbook/printing/Makefile.am deleted file mode 100644 index 7095171859..0000000000 --- a/addressbook/printing/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ - -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - $(GNOME_PRINT_CFLAGS) - -INCLUDES = \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = \ - libecontactprint.a - -libecontactprint_a_SOURCES = \ - e-contact-print.c \ - e-contact-print.h \ - e-contact-print-style-editor.c \ - e-contact-print-style-editor.h \ - e-contact-print-types.h - -noinst_PROGRAMS = \ - contact-print-test \ - contact-print-style-editor-test - -contact_print_test_SOURCES = \ - test-print.c - -contact_print_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libecontactprint.a \ - $(GNOME_PRINT_LIBS) - -contact_print_style_editor_test_SOURCES = \ - test-contact-print-style-editor.c - -contact_print_style_editor_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libecontactprint.a \ - $(GNOME_PRINT_LIBS) - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - e-contact-print.glade - diff --git a/addressbook/printing/e-contact-print-style-editor.c b/addressbook/printing/e-contact-print-style-editor.c deleted file mode 100644 index 5eb5cadacf..0000000000 --- a/addressbook/printing/e-contact-print-style-editor.c +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print-style-editor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-contact-print-style-editor.h" -static void e_contact_print_style_editor_init (EContactPrintStyleEditor *card); -static void e_contact_print_style_editor_class_init (EContactPrintStyleEditorClass *klass); -static void e_contact_print_style_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_print_style_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_print_style_editor_destroy (GtkObject *object); - -static GtkVBoxClass *parent_class = NULL; - - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD -}; - -GtkType -e_contact_print_style_editor_get_type (void) -{ - static GtkType contact_print_style_editor_type = 0; - - if (!contact_print_style_editor_type) - { - static const GtkTypeInfo contact_print_style_editor_info = - { - "EContactPrintStyleEditor", - sizeof (EContactPrintStyleEditor), - sizeof (EContactPrintStyleEditorClass), - (GtkClassInitFunc) e_contact_print_style_editor_class_init, - (GtkObjectInitFunc) e_contact_print_style_editor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_print_style_editor_type = gtk_type_unique (gtk_vbox_get_type (), &contact_print_style_editor_info); - } - - return contact_print_style_editor_type; -} - -static void -e_contact_print_style_editor_class_init (EContactPrintStyleEditorClass *klass) -{ - GtkObjectClass *object_class; - GtkVBoxClass *vbox_class; - - object_class = (GtkObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - - parent_class = gtk_type_class (gtk_vbox_get_type ()); - - object_class->set_arg = e_contact_print_style_editor_set_arg; - object_class->get_arg = e_contact_print_style_editor_get_arg; - object_class->destroy = e_contact_print_style_editor_destroy; -} - -#if 0 -static void -_add_image(GtkTable *table, gchar *image, int left, int right, int top, int bottom) -{ - gtk_table_attach(table, - gtk_widget_new(gtk_alignment_get_type(), - "child", gnome_pixmap_new_from_file(image), - "xalign", (double) 0, - "yalign", (double) 0, - "xscale", (double) 0, - "yscale", (double) 0, - NULL), - left, right, top, bottom, - GTK_FILL, GTK_FILL, - 0, 0); -} -#endif - -static void -e_contact_print_style_editor_init (EContactPrintStyleEditor *e_contact_print_style_editor) -{ - GladeXML *gui; - - /* e_contact_print_style_editor->card = NULL;*/ - gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-print.glade", NULL); - e_contact_print_style_editor->gui = gui; - gtk_widget_reparent(glade_xml_get_widget(gui, "vbox-contact-print-style-editor"), - GTK_WIDGET(e_contact_print_style_editor)); -} - -void -e_contact_print_style_editor_destroy (GtkObject *object) -{ - EContactPrintStyleEditor *e_contact_print_style_editor = E_CONTACT_PRINT_STYLE_EDITOR(object); - gtk_object_unref(GTK_OBJECT(e_contact_print_style_editor->gui)); -} - -GtkWidget* -e_contact_print_style_editor_new (char *filename) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_print_style_editor_get_type ())); - return widget; -} - -static void -e_contact_print_style_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactPrintStyleEditor *e_contact_print_style_editor; - - e_contact_print_style_editor = E_CONTACT_PRINT_STYLE_EDITOR (o); - - switch (arg_id){ - default: - break; - } -} - -static void -e_contact_print_style_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactPrintStyleEditor *e_contact_print_style_editor; - - e_contact_print_style_editor = E_CONTACT_PRINT_STYLE_EDITOR (object); - - switch (arg_id) { - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/addressbook/printing/e-contact-print-style-editor.h b/addressbook/printing/e-contact-print-style-editor.h deleted file mode 100644 index cf0f17f889..0000000000 --- a/addressbook/printing/e-contact-print-style-editor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-print-style-editor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_CONTACT_PRINT_STYLE_EDITOR_H__ -#define __E_CONTACT_PRINT_STYLE_EDITOR_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactPrintStyleEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * R The card currently being edited - */ - -#define E_CONTACT_PRINT_STYLE_EDITOR_TYPE (e_contact_print_style_editor_get_type ()) -#define E_CONTACT_PRINT_STYLE_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_PRINT_STYLE_EDITOR_TYPE, EContactPrintStyleEditor)) -#define E_CONTACT_PRINT_STYLE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_PRINT_STYLE_EDITOR_TYPE, EContactPrintStyleEditorClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_PRINT_STYLE_EDITOR_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_PRINT_STYLE_EDITOR_TYPE)) - - -typedef struct _EContactPrintStyleEditor EContactPrintStyleEditor; -typedef struct _EContactPrintStyleEditorClass EContactPrintStyleEditorClass; - -struct _EContactPrintStyleEditor -{ - GtkVBox parent; - - /* item specific fields */ - GladeXML *gui; -}; - -struct _EContactPrintStyleEditorClass -{ - GtkVBoxClass parent_class; -}; - - -GtkWidget *e_contact_print_style_editor_new(char *filename); -GtkType e_contact_print_style_editor_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_PRINT_STYLE_EDITOR_H__ */ diff --git a/addressbook/printing/e-contact-print-types.h b/addressbook/printing/e-contact-print-types.h deleted file mode 100644 index e99cfe6d39..0000000000 --- a/addressbook/printing/e-contact-print-types.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print-types.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef E_CONTACT_PRINT_TYPES_H -#define E_CONTACT_PRINT_TYPES_H - -#include -#include - -typedef struct _EContactPrintStyle EContactPrintStyle; -typedef enum _EContactPrintType EContactPrintType; - -enum _EContactPrintType { - E_CONTACT_PRINT_TYPE_CARDS, - E_CONTACT_PRINT_TYPE_MEMO_STYLE, - E_CONTACT_PRINT_TYPE_PHONE_LIST -}; - -struct _EContactPrintStyle -{ - gchar *title; - EContactPrintType type; - gboolean sections_start_new_page; - guint num_columns; - guint blank_forms; - gboolean letter_tabs; - gboolean letter_headings; - GnomeFont *headings_font; - GnomeFont *body_font; - gboolean print_using_grey; - gint paper_type; - gdouble paper_width; - gdouble paper_height; - gint paper_source; - gdouble top_margin; - gdouble left_margin; - gdouble bottom_margin; - gdouble right_margin; - gint page_size; - gdouble page_width; - gdouble page_height; - gboolean orientation_portrait; - GnomeFont *header_font; - gchar *left_header; - gchar *center_header; - gchar *right_header; - GnomeFont *footer_font; - gchar *left_footer; - gchar *center_footer; - gchar *right_footer; - gboolean reverse_on_even_pages; -}; - -#endif /* E_CONTACT_PRINT_TYPES_H */ - diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c deleted file mode 100644 index 5dc0e9f4bc..0000000000 --- a/addressbook/printing/e-contact-print.c +++ /dev/null @@ -1,953 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include "e-contact-print.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SCALE 5 -#define HYPHEN_PIXELS 20 -#define HYPHEN_PENALTY ( (SCALE) * (SCALE) * (HYPHEN_PIXELS) * (HYPHEN_PIXELS) ) - -typedef struct _EContactPrintContext EContactPrintContext; - -static int cardcount; - -struct _EContactPrintContext -{ - GnomePrintContext *pc; - GnomePrintMaster *master; - gdouble x; - gdouble y; - gint column; - EContactPrintStyle *style; - gboolean first_section; - gchar first_char_on_page; - gchar last_char_on_page; - GnomeFont *letter_heading_font; - GnomeFont *letter_tab_font; -}; - -static gint -e_contact_divide_text(GnomePrintContext *pc, GnomeFont *font, double width, gchar *text, GList **return_val /* Of type char[] */) -{ - if ( width == -1 || gnome_font_get_width_string(font, text) <= width ) { - if ( return_val ) { - *return_val = g_list_append(*return_val, g_strdup(text)); - } - return 1; - } else { -#if 1 - int i, l; - double x = 0; - int lastend = 0; - int linestart = 0; - int firstword = 1; - int linecount = 0; - l = strlen(text); - for ( i = 0; i < l; i++ ) { - if ( text[i] == ' ' ) { - if ( (!firstword) && x + gnome_font_get_width_string_n(font, text + lastend, i - lastend) > width ) { - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, lastend - linestart)); - } - x = gnome_font_get_width_string(font, " "); - linestart = lastend + 1; - x += gnome_font_get_width_string_n(font, text + linestart, i - linestart); - lastend = i; - linecount ++; - } else { - x += gnome_font_get_width_string_n(font, text + lastend, i - lastend); - lastend = i; - } - firstword = 0; - } else if ( text[i] == '\n' ) { - if ( (!firstword) && x + gnome_font_get_width_string_n(font, text + lastend, i - lastend) > width ) { - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, lastend - linestart)); - } - linestart = lastend + 1; - lastend = i; - linecount ++; - } - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, i - linestart)); - } - linestart = i + 1; - lastend = i + 1; - linecount ++; - x = gnome_font_get_width_string(font, " "); - - firstword = 1; - } - } - if ( (!firstword) && x + gnome_font_get_width_string_n(font, text + lastend, i - lastend) > width ) { - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, lastend - linestart)); - } - linestart = lastend + 1; - lastend = i; - linecount ++; - } - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, i - linestart)); - } - linecount ++; - return(linecount); -#else - HnjBreak *breaks; - gint *result; - gint *is; - gint n_breaks = 0, n_actual_breaks = 0; - gint i; - gint l; - gchar *hyphenation; - double x = - gnome_font_get_width_string(font, " ") * SCALE; - HnjParams hnjparams; - - hnjparams.set_width = width * SCALE + x; - hnjparams.max_neg_space = 0; - hnjparams.tab_width = 0; - - l = strlen(text); - - /* find possible line breaks. */ - for (i = 0; i < l; i++) { - if (text[i] == '-') - n_breaks++; - else if (text[i] == ' ') - n_breaks++; -#if 0 - else if (hyphenation[i] & 1) - n_breaks++; -#endif - } - - breaks = g_new( HnjBreak, n_breaks + 1 ); - result = g_new( gint, n_breaks + 1 ); - is = g_new( gint, n_breaks + 1 ); - n_breaks = 0; - /* find possible line breaks. */ - - for (i = 0; i < l; i++) { - if ( text[i] == '-' ) { - x += gnome_font_get_width(font, text[i]) * SCALE; - breaks[n_breaks].x0 = x; - breaks[n_breaks].x1 = x; - breaks[n_breaks].penalty = HYPHEN_PENALTY; - breaks[n_breaks].flags = HNJ_JUST_FLAG_ISHYPHEN; - is[n_breaks] = i + 1; - n_breaks++; - } else if ( text[i] == ' ' ) { - breaks[ n_breaks ].x0 = x; - x += gnome_font_get_width(font, text[i]) * SCALE; - breaks[ n_breaks ].x1 = x; - breaks[ n_breaks ].penalty = 0; - breaks[ n_breaks ].flags = HNJ_JUST_FLAG_ISSPACE; - is[ n_breaks ] = i + 1; - n_breaks++; -#if 0 - } else if (word->hyphenation[i] & 1) { - breaks[n_breaks].x0 = x + gnome_font_get_width(font, '-') * SCALE; - breaks[n_breaks].x1 = x; - breaks[n_breaks].penalty = HYPHEN_PENALTY; - breaks[n_breaks].flags = HNJ_JUST_FLAG_ISHYPHEN; - is[n_breaks] = i + 1; - n_breaks++; -#endif - } else - x += gnome_font_get_width(font, text[i]) * SCALE; - - } - is[n_breaks] = i; - breaks[n_breaks].flags = 0; - n_breaks++; - - /* Calculate optimal line breaks. */ - n_actual_breaks = hnj_hs_just (breaks, n_breaks, - &hnjparams, result); - - if ( return_val ) { - gchar *next_val; - if ( breaks[result[0]].flags == HNJ_JUST_FLAG_ISHYPHEN && text[is[result[0]]] != '-' ) { - next_val = g_new(gchar, is[result[0]] + 2); - strncpy(next_val, text, is[result[0]]); - next_val[is[result[0]]] = 0; - strcat(next_val, "-"); - } else { - next_val = g_new(gchar, is[result[0]] + 1); - strncpy(next_val, text, is[result[0]]); - next_val[is[result[0]]] = 0; - } - *return_val = g_list_append(*return_val, next_val); - - for ( i = 1; i < n_actual_breaks; i++ ) { - if ( (breaks[result[i]].flags & HNJ_JUST_FLAG_ISHYPHEN) && (text[is[result[i]]] != '-') ) { - next_val = g_new(gchar, is[result[i]] - is[result[i - 1]] + 2); - strncpy(next_val, text + is[result[i - 1]], is[result[i]] - is[result[i - 1]]); - next_val[is[result[i]] - is[result[i - 1]]] = 0; - strcat(next_val, "-"); - } else { - next_val = g_new(gchar, is[result[i]] - is[result[i - 1]] + 1); - strncpy(next_val, text + is[result[i - 1]], is[result[i]] - is[result[i - 1]]); - next_val[is[result[i]] - is[result[i - 1]]] = 0; - } - *return_val = g_list_append(*return_val, next_val); - } - } - - g_free (breaks); - g_free (result); - g_free (is); - return n_actual_breaks; -#endif - } -} - -static void -e_contact_output(GnomePrintContext *pc, GnomeFont *font, double x, double y, double width, gchar *text) -{ - GList *list = NULL, *list_start; - int first_line = 1; - gnome_print_gsave(pc); - gnome_print_setfont(pc, font); - e_contact_divide_text(pc, font, width, text, &list); - for ( list_start = list; list; list = g_list_next(list)) { - y -= gnome_font_get_ascender(font); - gnome_print_moveto(pc, x, y); - gnome_print_show(pc, (char *)list->data); - y -= gnome_font_get_descender(font); - y -= .2 * font->size; - if ( first_line ) { - x += gnome_font_get_width_string(font, " "); - first_line = 0; - } - } - g_list_foreach( list_start, (GFunc) g_free, NULL ); - g_list_free( list_start ); - gnome_print_grestore(pc); -} - -static gdouble -e_contact_text_height(GnomePrintContext *pc, GnomeFont *font, double width, gchar *text) -{ - int line_count = e_contact_divide_text(pc, font, width, text, NULL); - return line_count * (gnome_font_get_ascender(font) + gnome_font_get_descender(font)) + - line_count * .2 * font->size; -} - -static void -e_contact_output_and_advance(EContactPrintContext *ctxt, GnomeFont *font, double x, double width, gchar *text) -{ - ctxt->y -= .1 * font->size; - e_contact_output(ctxt->pc, font, x, ctxt->y, width, text); - ctxt->y -= e_contact_text_height(ctxt->pc, font, width, text); - ctxt->y -= .1 * font->size; -} - -static void -e_contact_rectangle(GnomePrintContext *pc, - gdouble x0, - gdouble y0, - gdouble x1, - gdouble y1, - gdouble r, - gdouble g, - gdouble b) -{ - gnome_print_gsave(pc); - gnome_print_setrgbcolor(pc, r, g, b); - gnome_print_moveto(pc, x0, y0); - gnome_print_lineto(pc, x1, y0); - gnome_print_lineto(pc, x1, y1); - gnome_print_lineto(pc, x0, y1); - gnome_print_lineto(pc, x0, y0); - gnome_print_fill(pc); - gnome_print_grestore(pc); -} - -static gchar *e_card_get_string(void *card, gchar *key) -{ - return key; -} - -static gchar *e_card_get_string_fileas(void *card) -{ - if (cardcount < 4) - return "Lahey, Chris"; - else if (cardcount < 20) - return "Rasputin"; - else if (cardcount < 24) - return "Wow, this guy has a really long name. Can you believe it?"; - else - return "Zamboni"; -} - -static double -e_contact_get_letter_tab_width (EContactPrintContext *ctxt) -{ - return gnome_font_get_width_string(ctxt->letter_tab_font, "123") + 4 + 18; -} - -static double -e_contact_print_letter_tab (EContactPrintContext *ctxt) -{ - char character; - gdouble x, y; - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble tab_height, tab_width; - gdouble font_size; - tab_height = 72 * (ctxt->style->page_height - ctxt->style->top_margin - ctxt->style->bottom_margin) / 27.0; - font_size = tab_height / 2; - tab_width = e_contact_get_letter_tab_width(ctxt) - 18; - x = page_width + 72 * (ctxt->style->left_margin) - tab_width; - y = 72 * (ctxt->style->page_height - ctxt->style->top_margin); - - - gnome_print_gsave( ctxt->pc ); - if ( ctxt->style->print_using_grey ) - e_contact_rectangle( ctxt->pc, x, 72 * (ctxt->style->page_height - ctxt->style->top_margin), x + tab_width, ctxt->style->bottom_margin * 72, .85, .85, .85 ); - for ( character = 'A' - 1; character <= 'Z'; character ++ ) { - char string[] = "123"; - if ( character >= 'A' ) { - string[0] = tolower(character); - string[1] = 0; - } - if ( character >= ctxt->first_char_on_page && character <= ctxt->last_char_on_page ) { - e_contact_rectangle( ctxt->pc, x + 1, y - 1, x + tab_width - 1, y - (tab_height - 1), 0, 0, 0 ); - gnome_print_setrgbcolor( ctxt->pc, 1, 1, 1 ); - e_contact_output( ctxt->pc, ctxt->letter_tab_font, x + tab_width / 2 - gnome_font_get_width_string(ctxt->letter_tab_font, string) / 2, y - (tab_height - font_size) / 2, -1, string ); - } else { - gnome_print_setrgbcolor( ctxt->pc, 0, 0, 0 ); - e_contact_output( ctxt->pc, ctxt->letter_tab_font, x + tab_width / 2 - gnome_font_get_width_string(ctxt->letter_tab_font, string) / 2, y - (tab_height - font_size) / 2, -1, string ); - } - y -= tab_height; - } - gnome_print_grestore( ctxt->pc ); - return gnome_font_get_width_string(ctxt->style->body_font, "123") + ctxt->style->body_font->size / 5; -} - -static double -e_contact_get_letter_heading_height (EContactPrintContext *ctxt) -{ - gdouble ascender, descender; - ascender = gnome_font_get_ascender(ctxt->letter_heading_font); - descender = gnome_font_get_descender(ctxt->letter_heading_font); - return ascender + descender + 9; -} - -static void -e_contact_print_letter_heading (EContactPrintContext *ctxt, gchar *character) -{ - gdouble ascender, descender; - gdouble width; - - width = gnome_font_get_width_string(ctxt->letter_heading_font, "m") * 1.7; - ascender = gnome_font_get_ascender(ctxt->letter_heading_font); - descender = gnome_font_get_descender(ctxt->letter_heading_font); - gnome_print_gsave( ctxt->pc ); - e_contact_rectangle( ctxt->pc, ctxt->x, ctxt->y, ctxt->x + width, ctxt->y - (ascender + descender + 6), 0, 0, 0); - gnome_print_setrgbcolor(ctxt->pc, 1, 1, 1); - ctxt->y -= 4; - e_contact_output(ctxt->pc, ctxt->letter_heading_font, ctxt->x + (width - gnome_font_get_width_string(ctxt->letter_heading_font, character))/ 2, ctxt->y, -1, character); - ctxt->y -= ascender + descender; - ctxt->y -= 2; - ctxt->y -= 3; - gnome_print_grestore( ctxt->pc ); -} - -static void -e_contact_start_new_page(EContactPrintContext *ctxt) -{ - ctxt->x = ctxt->style->left_margin * 72; - ctxt->y = (ctxt->style->page_height - ctxt->style->top_margin) * 72; - ctxt->column = 0; - if ( ctxt->style->letter_tabs ) - e_contact_print_letter_tab(ctxt); - gnome_print_showpage(ctxt->pc); - - ctxt->first_char_on_page = ctxt->last_char_on_page + 1; -} - -static double -e_contact_get_card_size(void *card, EContactPrintContext *ctxt, GList *shown_fields) -{ - gdouble height = 0; - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - - height += ctxt->style->headings_font->size * .2; - - height += ctxt->style->headings_font->size * .2; - - height += e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, e_card_get_string_fileas(card)); - height += ctxt->style->headings_font->size * .2; - - height += ctxt->style->headings_font->size * .2; - - for(; shown_fields; shown_fields = g_list_next(shown_fields)) { - double xoff = 0; - gchar *field = e_card_get_string(card, shown_fields->data); - xoff += gnome_font_get_width_string(ctxt->style->body_font, shown_fields->data); - xoff += gnome_font_get_width_string(ctxt->style->body_font, ": "); - height += e_contact_text_height(ctxt->pc, ctxt->style->body_font, column_width - xoff, field); - height += .2 * ctxt->style->body_font->size; - } - height += ctxt->style->headings_font->size * .4; - return height; -} - - -static void -e_contact_print_card (void *card, EContactPrintContext *ctxt, GList *shown_fields) -{ - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - - gnome_print_gsave(ctxt->pc); - - ctxt->y -= ctxt->style->headings_font->size * .2; - - ctxt->y -= ctxt->style->headings_font->size * .2; - - if (ctxt->style->print_using_grey) - e_contact_rectangle(ctxt->pc, ctxt->x, ctxt->y + ctxt->style->headings_font->size * .2, ctxt->x + column_width, ctxt->y - e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, e_card_get_string_fileas(card)) - ctxt->style->headings_font->size * .2, .85, .85, .85); - e_contact_output(ctxt->pc, ctxt->style->headings_font, ctxt->x + 2, ctxt->y, column_width - 4, e_card_get_string_fileas(card)); - ctxt->y -= e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, e_card_get_string_fileas(card)); - ctxt->y -= ctxt->style->headings_font->size * .2; - - ctxt->y -= ctxt->style->headings_font->size * .2; - - for(; shown_fields; shown_fields = g_list_next(shown_fields)) { - double xoff = 0; - gchar *field = e_card_get_string(card, shown_fields->data); - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, -1, shown_fields->data); - xoff += gnome_font_get_width_string(ctxt->style->body_font, shown_fields->data); - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, -1, ": "); - xoff += gnome_font_get_width_string(ctxt->style->body_font, ": "); - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, column_width - xoff, field); - ctxt->y -= e_contact_text_height(ctxt->pc, ctxt->style->body_font, column_width - xoff, field); - ctxt->y -= .2 * ctxt->style->body_font->size; - } - ctxt->y -= ctxt->style->headings_font->size * .4; - gnome_print_grestore(ctxt->pc); -} - -static void -e_contact_start_new_column (EContactPrintContext *ctxt) -{ - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_offset; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_offset = (page_width + 18) / ctxt->style->num_columns; - ctxt->column ++; - if (ctxt->column >= ctxt->style->num_columns) { - e_contact_start_new_page(ctxt); - ctxt->column = 0; - } - ctxt->x = (72 * ctxt->style->left_margin) + column_offset * ctxt->column; - ctxt->y = 72 * (ctxt->style->page_height - ctxt->style->top_margin); -} - -static void -e_contact_do_print_cards (void *book, EContactPrintContext *ctxt, GList *shown_fields) -{ - gchar *character = NULL; - void *card = NULL; - gboolean first_contact = TRUE; - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - ctxt->y = (ctxt->style->page_height - ctxt->style->top_margin) * 72; - ctxt->x = (ctxt->style->left_margin) * 72; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - - ctxt->first_char_on_page = 'A' - 1; - - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - /* - for(card = e_book_get_first(book); card; card = e_book_get_next(book)) { - */ - for (cardcount=0; cardcount < 30; cardcount++) { - gchar *file_as = e_card_get_string_fileas(card); - if ( file_as && (!character || *character != tolower(*file_as)) ) { - if (ctxt->style->sections_start_new_page && ! first_contact) { - e_contact_start_new_page(ctxt); - } - else if ((!first_contact) && (ctxt->y - e_contact_get_letter_heading_height(ctxt) - e_contact_get_card_size(card, ctxt, shown_fields) < ctxt->style->bottom_margin * 72)) - e_contact_start_new_column(ctxt); - if (!character) - character = g_strdup(" "); - *character = tolower(*file_as); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, character); - ctxt->first_section = FALSE; - } - else if ( (!first_contact) && (ctxt->y - e_contact_get_card_size(card, ctxt, shown_fields) < ctxt->style->bottom_margin * 72)) { - e_contact_start_new_column(ctxt); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, character); - } - ctxt->last_char_on_page = toupper(*file_as); - if ( ctxt->last_char_on_page < ctxt->first_char_on_page ) - ctxt->first_char_on_page = ctxt->last_char_on_page; - e_contact_print_card(card, ctxt, shown_fields); - first_contact = FALSE; - } - ctxt->last_char_on_page = 'Z'; - if ( ctxt->style->letter_tabs ) - e_contact_print_letter_tab(ctxt); - gnome_print_showpage(ctxt->pc); - gnome_print_context_close(ctxt->pc); - g_free(character); -} - -static double -e_contact_get_phone_list_size(void *card, EContactPrintContext *ctxt, GList *shown_fields) -{ - double height = 0; - - height += ctxt->style->headings_font->size * .2; - - height += ctxt->style->headings_font->size * .2; - - for(; shown_fields; shown_fields = g_list_next(shown_fields)) { - if ( 1 ) /* field is a phone field. */ { - gchar *field = e_card_get_string(card, shown_fields->data); - height += e_contact_text_height(ctxt->pc, ctxt->style->body_font, 100, field); - height += .2 * ctxt->style->body_font->size; - } - } - height += ctxt->style->headings_font->size * .4; - return height; -} - - -static void -e_contact_print_phone_list (void *card, EContactPrintContext *ctxt, GList *shown_fields) -{ - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - double xoff, dotwidth; - int dotcount; - char *dots; - int i; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - - gnome_print_gsave(ctxt->pc); - - ctxt->y -= ctxt->style->headings_font->size * .2; - - ctxt->y -= ctxt->style->headings_font->size * .2; - - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x, ctxt->y, -1, e_card_get_string_fileas(card)); - - xoff = column_width - 9 * ctxt->style->body_font->size; - dotwidth = xoff - - gnome_font_get_width_string(ctxt->style->body_font, e_card_get_string_fileas(card)) - - gnome_font_get_width_string(ctxt->style->body_font, " "); - dotcount = dotwidth / gnome_font_get_width(ctxt->style->body_font, '.'); - dots = g_new(gchar, dotcount + 1); - for (i = 0; i < dotcount; i++) - dots[i] = '.'; - dots[dotcount] = 0; - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff - dotcount * gnome_font_get_width(ctxt->style->body_font, '.'), ctxt->y, -1, dots); - g_free(dots); - - for(; shown_fields; shown_fields = g_list_next(shown_fields)) { - if ( 1 ) /* field is a phone field. */ { - gchar *field = e_card_get_string(card, shown_fields->data); - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, -1, shown_fields->data); - e_contact_output(ctxt->pc, ctxt->style->body_font, - ctxt->x + column_width - gnome_font_get_width_string(ctxt->style->body_font, - field), - ctxt->y, - -1, - field); - ctxt->y -= e_contact_text_height(ctxt->pc, ctxt->style->body_font, 100, field); - ctxt->y -= .2 * ctxt->style->body_font->size; - } - } - ctxt->y -= ctxt->style->headings_font->size * .4; - gnome_print_grestore(ctxt->pc); -} - -static void -e_contact_do_print_phone_list (void *book, EContactPrintContext *ctxt, GList *shown_fields) -{ - gchar *character = NULL; - void *card = NULL; - int i; - gboolean first_contact = TRUE; - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - ctxt->y = (ctxt->style->page_height - ctxt->style->top_margin) * 72; - ctxt->x = (ctxt->style->left_margin) * 72; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - - ctxt->first_char_on_page = 'A' - 1; - - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - /* - for(card = e_book_get_first(book); card; card = e_book_get_next(book)) { - */ - for (i=0; i < 30; i++) { - gchar *file_as = e_card_get_string_fileas(card); - if ( file_as && (!character || *character != tolower(*file_as)) ) { - if (ctxt->style->sections_start_new_page && ! first_contact) { - e_contact_start_new_page(ctxt); - } - else if ((!first_contact) && (ctxt->y - e_contact_get_letter_heading_height(ctxt) - e_contact_get_phone_list_size(card, ctxt, shown_fields) < ctxt->style->bottom_margin * 72)) - e_contact_start_new_column(ctxt); - if (!character) - character = g_strdup(" "); - *character = tolower(*file_as); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, character); - ctxt->first_section = FALSE; - } - else if ( (!first_contact) && (ctxt->y - e_contact_get_card_size(card, ctxt, shown_fields) < ctxt->style->bottom_margin * 72)) { - e_contact_start_new_column(ctxt); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, character); - } - ctxt->last_char_on_page = toupper(*file_as); - if ( ctxt->last_char_on_page < ctxt->first_char_on_page ) - ctxt->first_char_on_page = ctxt->last_char_on_page; - e_contact_print_phone_list(card, ctxt, shown_fields); - first_contact = FALSE; - } - ctxt->last_char_on_page = 'Z'; - if ( ctxt->style->letter_tabs ) - e_contact_print_letter_tab(ctxt); - gnome_print_showpage(ctxt->pc); - gnome_print_context_close(ctxt->pc); - g_free(character); -} - -static void -e_contact_do_print (void *book, EContactPrintContext *ctxt, GList *shown_fields) -{ - switch ( ctxt->style->type ) { - case E_CONTACT_PRINT_TYPE_CARDS: - e_contact_do_print_cards( book, ctxt, shown_fields ); - break; - case E_CONTACT_PRINT_TYPE_PHONE_LIST: - e_contact_do_print_phone_list( book, ctxt, shown_fields ); - break; - } -} - -static void lowify( char *data ) -{ - for ( ; *data; data++ ) - *data = tolower(*data); -} - -static gboolean get_bool( char *data ) -{ - if ( data ) { - lowify ( data ); - return ! strcmp(data, "true"); - } else - return FALSE; -} - -static void get_string( char *data, char **variable ) -{ - g_free ( *variable ); - if ( data ) - *variable = g_strdup( data ); - else - *variable = g_strdup( "" ); -} - -static int get_integer( char *data ) -{ - if ( data ) - return atoi(data); - else - return 0; -} - -static double get_float( char *data ) -{ - if ( data ) - return atof(data); - else - return 0; -} - -static void get_font( char *data, GnomeFont **variable ) -{ - if ( data ) { - GnomeFont *font = gnome_font_new_from_full_name( data ); - if ( font ) { - gtk_object_unref( GTK_OBJECT(*variable) ); - *variable = font; - } - } -} - - -static void -e_contact_build_style(EContactPrintStyle *style) -{ - xmlDocPtr styledoc; - style->title = g_strdup(""); - style->type = E_CONTACT_PRINT_TYPE_CARDS; - style->sections_start_new_page = TRUE; - style->num_columns = 2; - style->blank_forms = 2; - style->letter_tabs = TRUE; - style->letter_headings = FALSE; - style->headings_font = gnome_font_new("Helvetica-Bold", 8); - style->body_font = gnome_font_new("Helvetica", 6); - style->print_using_grey = TRUE; - style->paper_type = 0; - style->paper_width = 8.5; - style->paper_height = 11; - style->paper_source = 0; - style->top_margin = .5; - style->left_margin = .5; - style->bottom_margin = .5; - style->right_margin = .5; - style->page_size = 0; - style->page_width = 2.75; - style->page_height = 4.25; -#if 0 - style->page_width = 4.25; - style->page_height = 5.5; -#endif -#if 0 - style->page_width = 5.5; - style->page_height = 8.5; -#endif - style->orientation_portrait = FALSE; - style->header_font = gnome_font_new("Helvetica", 6); - style->left_header = g_strdup(""); - style->center_header = g_strdup(""); - style->right_header = g_strdup(""); - style->footer_font = gnome_font_new("Helvetica", 6); - style->left_footer = g_strdup(""); - style->center_footer = g_strdup(""); - style->right_footer = g_strdup(""); - style->reverse_on_even_pages = FALSE; - styledoc = xmlParseFile("smallbook.ecps"); - if (styledoc) { - xmlNodePtr stylenode = xmlDocGetRootElement(styledoc); - xmlNodePtr node; - for (node = stylenode->childs; node; node = node->next) { - char *data = xmlNodeGetContent ( node ); - if ( !strcmp( node->name, "title" ) ) { - get_string(data, &(style->title)); - } else if ( !strcmp( node->name, "type" ) ) { - lowify( data ); - if ( !strcmp( data, "cards" ) ) - style->type = E_CONTACT_PRINT_TYPE_CARDS; - else if ( !strcmp( data, "memo_style" ) ) - style->type = E_CONTACT_PRINT_TYPE_MEMO_STYLE; - else if ( !strcmp( data, "phone_list" ) ) - style->type = E_CONTACT_PRINT_TYPE_PHONE_LIST; - } else if ( !strcmp( node->name, "sections_start_new_page" ) ) { - style->sections_start_new_page = get_bool(data); - } else if ( !strcmp( node->name, "num_columns" ) ) { - style->num_columns = get_integer(data); - } else if ( !strcmp( node->name, "blank_forms" ) ) { - style->blank_forms = get_integer(data); - } else if ( !strcmp( node->name, "letter_tabs" ) ) { - style->letter_tabs = get_bool(data); - } else if ( !strcmp( node->name, "letter_headings" ) ) { - style->letter_headings = get_bool(data); - } else if ( !strcmp( node->name, "headings_font" ) ) { - get_font( data, &(style->headings_font) ); - } else if ( !strcmp( node->name, "body_font" ) ) { - get_font( data, &(style->body_font) ); - } else if ( !strcmp( node->name, "print_using_grey" ) ) { - style->print_using_grey = get_bool(data); - } else if ( !strcmp( node->name, "paper_width" ) ) { - style->paper_width = get_float(data); - } else if ( !strcmp( node->name, "paper_height" ) ) { - style->paper_height = get_float(data); - } else if ( !strcmp( node->name, "top_margin" ) ) { - style->top_margin = get_float(data); - } else if ( !strcmp( node->name, "left_margin" ) ) { - style->left_margin = get_float(data); - } else if ( !strcmp( node->name, "bottom_margin" ) ) { - style->bottom_margin = get_float(data); - } else if ( !strcmp( node->name, "right_margin" ) ) { - style->right_margin = get_float(data); - } else if ( !strcmp( node->name, "page_width" ) ) { - style->page_width = get_float(data); - } else if ( !strcmp( node->name, "page_height" ) ) { - style->page_height = get_float(data); - } else if ( !strcmp( node->name, "orientation" ) ) { - if ( data ) { - lowify(data); - style->orientation_portrait = strcmp(data, "landscape"); - } else { - style->orientation_portrait = TRUE; - } - } else if ( !strcmp( node->name, "header_font" ) ) { - get_font( data, &(style->header_font) ); - } else if ( !strcmp( node->name, "left_header" ) ) { - get_string(data, &(style->left_header)); - } else if ( !strcmp( node->name, "center_header" ) ) { - get_string(data, &(style->center_header)); - } else if ( !strcmp( node->name, "right_header" ) ) { - get_string(data, &(style->right_header)); - } else if ( !strcmp( node->name, "footer_font" ) ) { - get_font( data, &(style->footer_font) ); - } else if ( !strcmp( node->name, "left_footer" ) ) { - get_string(data, &(style->left_footer)); - } else if ( !strcmp( node->name, "center_footer" ) ) { - get_string(data, &(style->center_footer)); - } else if ( !strcmp( node->name, "right_footer" ) ) { - get_string(data, &(style->right_footer)); - } else if ( !strcmp( node->name, "reverse_on_even_pages" ) ) { - style->reverse_on_even_pages = get_bool(data); - } - if ( data ) - xmlFree (data); - } - xmlFreeDoc(styledoc); - } -} - -static gint -e_contact_print_close(GnomeDialog *dialog, gpointer data) -{ - return FALSE; -} - -static void -e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data) -{ - EContactPrintContext ctxt; - EContactPrintStyle style; - GnomePrintMaster *master; - GtkWidget *preview; - GnomePrintContext *pc; - void *book = gtk_object_get_data(GTK_OBJECT(dialog), "book"); - GList *shown_fields = gtk_object_get_data(GTK_OBJECT(dialog), "shown_fields"); - gdouble font_size; - switch( button ) { - case GNOME_PRINT_PRINT: - master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) ); - pc = gnome_print_master_get_context( master ); - e_contact_build_style(&style); - - ctxt.x = 0; - ctxt.y = 0; - ctxt.column = 0; - ctxt.style = &style; - ctxt.master = master; - ctxt.first_section = TRUE; - ctxt.first_char_on_page = 'A' - 1; - - font_size = 72 * ctxt.style->page_height / 27.0 / 2.0; - ctxt.letter_heading_font = gnome_font_new(gnome_font_get_name(ctxt.style->headings_font), ctxt.style->headings_font->size * 1.5); - ctxt.letter_tab_font = gnome_font_new(gnome_font_get_name(ctxt.style->headings_font), font_size); - - ctxt.pc = GNOME_PRINT_CONTEXT(gnome_print_multipage_new_from_sizes(pc, - 72 * style.paper_width, - 72 * style.paper_height, - 72 * style.page_width, - 72 * style.page_height)); - - e_contact_do_print(book, &ctxt, shown_fields); - gnome_print_master_print(master); - gtk_object_unref(GTK_OBJECT(ctxt.pc)); - gtk_object_unref(GTK_OBJECT(master)); - gnome_dialog_close(dialog); - break; - case GNOME_PRINT_PREVIEW: - master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) ); - pc = gnome_print_master_get_context( master ); - e_contact_build_style(&style); - - ctxt.x = 0; - ctxt.y = 0; - ctxt.column = 0; - ctxt.style = &style; - ctxt.master = master; - ctxt.first_section = TRUE; - ctxt.first_char_on_page = 'A' - 1; - - font_size = 72 * ctxt.style->page_height / 27.0 / 2.0; - ctxt.letter_heading_font = gnome_font_new(gnome_font_get_name(ctxt.style->headings_font), ctxt.style->headings_font->size * 1.5); - ctxt.letter_tab_font = gnome_font_new(gnome_font_get_name(ctxt.style->headings_font), font_size); - - ctxt.pc = GNOME_PRINT_CONTEXT(gnome_print_multipage_new_from_sizes(pc, - 72 * style.paper_width, - 72 * style.paper_height, - 72 * style.page_width, - 72 * style.page_height)); - - e_contact_do_print(book, &ctxt, shown_fields); - preview = GTK_WIDGET(gnome_print_master_preview_new(master, "Print Preview")); - gtk_widget_show_all(preview); - gtk_object_unref(GTK_OBJECT(ctxt.pc)); - gtk_object_unref(GTK_OBJECT(master)); - break; - case GNOME_PRINT_CANCEL: - gnome_dialog_close(dialog); - break; - } -} - -GtkWidget * -e_contact_print_dialog_new(void *book, GList *shown_fields) -{ - GtkWidget *dialog; - - - dialog = gnome_print_dialog_new("Print cards", GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES); - gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION, - NULL, NULL, NULL); - - gtk_object_set_data(GTK_OBJECT(dialog), "book", book); - gtk_object_set_data(GTK_OBJECT(dialog), "shown_fields", shown_fields); - gtk_signal_connect(GTK_OBJECT(dialog), - "clicked", GTK_SIGNAL_FUNC(e_contact_print_button), NULL); - gtk_signal_connect(GTK_OBJECT(dialog), - "close", GTK_SIGNAL_FUNC(e_contact_print_close), NULL); - return dialog; -} diff --git a/addressbook/printing/e-contact-print.glade b/addressbook/printing/e-contact-print.glade deleted file mode 100644 index c078929d07..0000000000 --- a/addressbook/printing/e-contact-print.glade +++ /dev/null @@ -1,1993 +0,0 @@ - - - - - Printing - printing - False - False - False - - - - GnomeDialog - print-edit-style - False - Page Setup: - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkVBox - vbox-contact-print-style-editor - False - 5 - - 0 - True - True - - - - GtkHBox - hbox2 - 5 - False - 16 - - 0 - True - True - - - - GtkLabel - label8 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - label-style-name - True - False - True - 0 - - - 0 - False - False - - - - - - GtkNotebook - notebook1 - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - 0 - True - True - - - - GtkVBox - vbox2 - 5 - False - 5 - - - GtkAlignment - alignment1 - 0.5 - 0.5 - 0 - 0 - - 0 - True - True - - - - GtkFrame - frame5 - - 0 - GTK_SHADOW_ETCHED_IN - - - Placeholder - - - - - - GtkHBox - hbox1 - True - 7 - - 0 - True - True - - - - GtkFrame - frame6 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkAlignment - alignment4 - 0 - 0 - 0 - 0 - - - GtkTable - table1 - 8 - 6 - 5 - False - 0 - 0 - - - GtkLabel - label5 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - - GtkLabel - label4 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAlignment - alignment2 - 0 - 0.5 - 0 - 0 - - 1 - 5 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - GtkRadioButton - radiobutton1 - True - - True - True - - - - - GtkCheckButton - checkbutton1 - True - - False - True - - 1 - 5 - 4 - 5 - 0 - 0 - False - False - False - False - True - True - - - - - GtkCheckButton - checkbutton2 - True - - False - True - - 1 - 5 - 5 - 6 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAlignment - alignment3 - 0 - 0.5 - 0 - 0 - - 1 - 5 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkRadioButton - radiobutton2 - True - - False - True - - - - - GtkLabel - label6 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 3 - 2 - 3 - 0 - 2 - False - False - False - False - True - True - - - - - GtkLabel - label7 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 3 - 3 - 4 - 0 - 2 - False - False - False - False - True - True - - - - - GtkAlignment - alignment6 - 0 - 0.5 - 0 - 0 - - 3 - 4 - 3 - 4 - 0 - 2 - False - False - False - False - True - True - - - - GtkSpinButton - spinbutton2 - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 2 - 0 - 100 - 1 - 10 - 10 - - - - - GtkAlignment - alignment5 - 0 - 0.5 - 0 - 0 - - 3 - 4 - 2 - 3 - 0 - 2 - False - False - False - False - True - True - - - - GtkSpinButton - spinbutton1 - 45 - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 - 0 - 100 - 1 - 10 - 10 - - - - - - - - GtkVBox - vbox3 - False - 8 - - 0 - True - True - - - - GtkFrame - frame7 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkTable - table2 - 8 - 2 - 2 - False - 13 - 8 - - - GtkAlignment - alignment7 - 0.5 - 1 - 1 - 0 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button6 - True - - - - - - GtkAlignment - alignment8 - 0.5 - 1 - 1 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button5 - 90 - True - - - - - - GtkVBox - vbox4 - False - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label10 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry3 - 100 - True - True - True - 0 - 10 pt. Tahoma - - 0 - False - False - - - - - - GtkVBox - vbox5 - False - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - True - False - False - False - True - True - - - - GtkLabel - label9 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry2 - 100 - True - True - True - 0 - 8 pt. Tahoma - - 0 - False - False - - - - - - - - GtkFrame - frame8 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkCheckButton - checkbutton3 - True - - False - True - - - - - - - - GtkLabel - Notebook:tab - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkHBox - hbox3 - True - 0 - - - GtkVBox - vbox6 - False - 0 - - 0 - True - True - - - - GtkFrame - frame9 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox16 - 10 - False - 0 - - - GtkVBox - vbox17 - False - 0 - - 0 - True - True - - - - GtkLabel - label21 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkScrolledWindow - scrolledwindow1 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - - - - GtkCList - clist1 - True - 1 - 80 - GTK_SELECTION_SINGLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label26 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - GtkVBox - vbox18 - False - 0 - - 0 - True - True - - - - GtkLabel - label24 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkHBox - hbox5 - True - 0 - - 0 - True - True - - - - GtkLabel - label27 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry9 - 1 - True - True - True - 0 - - - 0 - True - True - - - - - GtkLabel - label28 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry10 - 1 - True - True - True - 0 - - - 0 - True - True - - - - - - - GtkVBox - vbox19 - False - 0 - - 0 - True - True - - - - GtkLabel - label25 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkCombo - combo1 - False - True - False - True - False - - - 0 - False - False - - - - GtkEntry - GtkCombo:entry - combo-entry1 - True - True - True - 0 - - - - - - - - - GtkFrame - frame10 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkTable - table4 - 15 - 2 - 4 - True - 6 - 9 - - - GtkLabel - label29 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - True - False - False - True - True - - - - - GtkLabel - label30 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - True - False - False - True - True - - - - - GtkLabel - label31 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 2 - 3 - 0 - 1 - 0 - 0 - False - True - False - False - True - True - - - - - GtkEntry - entry11 - 1 - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry12 - 1 - True - True - True - 0 - - - 3 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry13 - 1 - True - True - True - 0 - - - 3 - 4 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - entry14 - 1 - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label32 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 2 - 3 - 1 - 2 - 0 - 0 - False - True - False - False - True - True - - - - - - - - GtkVBox - vbox7 - False - 0 - - 0 - True - True - - - - GtkFrame - frame11 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox8 - 10 - False - 0 - - - GtkVBox - vbox20 - False - 0 - - 0 - True - True - - - - GtkLabel - label33 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkScrolledWindow - scrolledwindow2 - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - - - - GtkCList - clist2 - True - 1 - 80 - GTK_SELECTION_SINGLE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label35 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - GtkVBox - vbox21 - False - 0 - - 0 - True - True - - - - GtkLabel - label34 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkHBox - hbox6 - True - 0 - - 0 - True - True - - - - GtkLabel - label36 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry15 - 1 - True - True - True - 0 - - - 0 - True - True - - - - - GtkLabel - label37 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry16 - 1 - True - True - True - 0 - - - 0 - True - True - - - - - - - - - GtkFrame - frame12 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkHBox - hbox4 - False - 10 - - - Placeholder - - - - GtkVBox - vbox9 - False - 5 - - 0 - True - True - - - - GtkAlignment - alignment9 - 0 - 1 - 0 - 0 - - 0 - True - True - - - - GtkRadioButton - radiobutton3 - True - - False - True - - - - - GtkAlignment - alignment10 - 0 - 0 - 0 - 0 - - 0 - True - True - - - - GtkRadioButton - radiobutton4 - True - - False - True - - - - - - - - - - GtkLabel - Notebook:tab - label2 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkVBox - vbox10 - 8 - False - 0 - - - GtkTable - table5 - 4 - 3 - True - 4 - 4 - - 0 - True - True - - - - GtkAlignment - alignment15 - 0 - 1 - 0 - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button11 - True - - - - - - GtkText - text10 - 50 - True - False - - - 0 - 1 - 1 - 2 - 0 - 0 - False - True - False - False - True - True - - - - - GtkText - text11 - 50 - True - False - - - 2 - 3 - 1 - 2 - 0 - 0 - True - False - False - False - True - True - - - - - GtkText - text12 - 50 - True - False - - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - - GtkText - text13 - 50 - True - False - - - 0 - 1 - 3 - 4 - 0 - 0 - False - True - False - False - True - True - - - - - GtkText - text14 - 5 - True - False - - - 1 - 2 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkText - text15 - 50 - True - False - - - 2 - 3 - 3 - 4 - 0 - 0 - False - False - False - False - True - True - - - - - GtkAlignment - alignment16 - 0.5 - 1 - 1 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - True - False - False - False - True - True - - - - GtkVBox - vbox14 - False - 0 - - - GtkLabel - label14 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry7 - True - True - True - 0 - - - 0 - False - False - - - - - - - GtkAlignment - alignment17 - 0.5 - 1 - 1 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - True - False - False - False - True - True - - - - GtkVBox - vbox15 - False - 0 - - - GtkLabel - label15 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - entry8 - True - True - True - 0 - - - 0 - False - False - - - - - - - GtkAlignment - alignment14 - 0 - 1 - 0 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button10 - True - - - - - - - GtkHBox - hbox7 - False - 0 - - 0 - False - True - - - - GtkToolbar - toolbar1 - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_ICONS - 5 - GTK_TOOLBAR_SPACE_EMPTY - GTK_RELIEF_NORMAL - True - - 0 - True - False - - - - Placeholder - - - - Placeholder - - - - Placeholder - - - - Placeholder - - - - Placeholder - - - - - - GtkCheckButton - checkbutton4 - True - - False - True - - 0 - False - False - - - - - - GtkLabel - Notebook:tab - label3 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - - diff --git a/addressbook/printing/e-contact-print.h b/addressbook/printing/e-contact-print.h deleted file mode 100644 index 28a0d14441..0000000000 --- a/addressbook/printing/e-contact-print.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef E_CONTACT_PRINT_H -#define E_CONTACT_PRINT_H - -#include -#include "e-contact-print-types.h" - -GtkWidget *e_contact_print_dialog_new(void *book, GList *shown_fields); - -#endif /* E_CONTACT_PRINT_H */ diff --git a/addressbook/printing/medbook.ecps b/addressbook/printing/medbook.ecps deleted file mode 100644 index 2031f39b92..0000000000 --- a/addressbook/printing/medbook.ecps +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/addressbook/printing/phonelist.ecps b/addressbook/printing/phonelist.ecps deleted file mode 100644 index 53ca294d36..0000000000 --- a/addressbook/printing/phonelist.ecps +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/addressbook/printing/smallbook.ecps b/addressbook/printing/smallbook.ecps deleted file mode 100644 index 5844851bfb..0000000000 --- a/addressbook/printing/smallbook.ecps +++ /dev/null @@ -1,30 +0,0 @@ - diff --git a/addressbook/printing/test-contact-print-style-editor.c b/addressbook/printing/test-contact-print-style-editor.c deleted file mode 100644 index f6a3b99596..0000000000 --- a/addressbook/printing/test-contact-print-style-editor.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-contact-print-style-editor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include -#include "e-contact-print-style-editor.h" - -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - static int count = 2; - count --; - if ( count <= 0 ) - exit(0); -} - -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Print Style Editor Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact print style editor widget" ), - NULL); - gtk_widget_show (about); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Print Style Editor Test", VERSION, argc, argv); - - glade_gnome_init (); - - app = gnome_app_new("Contact Print Style Editor Test", NULL); - - editor = e_contact_print_style_editor_new(""); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/printing/test-print.c b/addressbook/printing/test-print.c deleted file mode 100644 index 2ee396d37d..0000000000 --- a/addressbook/printing/test-print.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-print.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include -#include -#include "e-contact-print.h" - -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *print; - -static gint test_close(GnomeDialog *dialog, gpointer data) -{ - exit(0); - return 1; -} - -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Print Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact print code" ), - NULL); - gtk_widget_show (about); -} - -int main( int argc, char *argv[] ) -{ - GList *shown_fields = NULL; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Print Test", VERSION, argc, argv); - - glade_gnome_init (); - - shown_fields = g_list_append(shown_fields, "First field"); - shown_fields = g_list_append(shown_fields, "Second field"); - shown_fields = g_list_append(shown_fields, "Third field"); - shown_fields = g_list_append(shown_fields, "Fourth field"); - - print = e_contact_print_dialog_new(NULL, shown_fields); - gtk_widget_show_all(print); - gtk_signal_connect(GTK_OBJECT(print), "close", test_close, NULL); - - gtk_main(); - - /* Not reached. */ - return 0; -} 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 310e2ca970..0000000000 --- a/calendar/.cvsignore +++ /dev/null @@ -1,20 +0,0 @@ -Makefile.in -Makefile -.deps -_libs -.libs -gncal -gnomecal -getdate.c -GnomeCal-skels.c -GnomeCal-common.c -GnomeCal.h -calendar-pilot-sync -evolution-calendar-stubs.c -evolution-calendar-skels.c -evolution-calendar-common.c -evolution-calendar.h -GnomeCal-stubs.c -tlacuache -tl-test -*.lo \ No newline at end of file diff --git a/calendar/AUTHORS b/calendar/AUTHORS deleted file mode 100644 index 7e482aef97..0000000000 --- a/calendar/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Miguel de Icaza -Federico Mena -Arturo Esponosa -Russell Steinthal diff --git a/calendar/ChangeLog b/calendar/ChangeLog deleted file mode 100644 index adb2379303..0000000000 --- a/calendar/ChangeLog +++ /dev/null @@ -1,2916 +0,0 @@ -2000-02-21 Matt Loper - - * .cvsignore: Added *.lo. - -2000-02-19 Matt Loper - - * .cvsignore: Added tlacuache and tl-test. - -2000-02-18 Miguel de Icaza - - * Makefile.am (INCLUDES): Use BONOBO_VFS_GNOME_CFLAGS instead of - GNOMEUI_INCLUDES, as we use Bonobo and VFS. - -2000-02-17 Seth Alves - - * cal-backend.h: moved CalendarFormat type def here - - * cal-backend.c (cal_backend_load): if extension suggests - an ical file, attempt to load an iCal file. - (cal_get_type_from_filename): returns CAL_ICAL if file - extension is 'ics' or 'ifb', else returns CAL_VCAL - (icalendar_calendar_load): moved this here from - icalendar.c because it needs to call the static function - add_object. - -2000-02-17 Federico Mena Quintero - - * cal-client.c (cal_client_remove_object): Implemented. - - * cal.c (cal_notify_remove): Implemented. - (Cal_remove_object): Implemented. - (cal_get_epv): Fill in the remove_object field in the epv. - - * cal-backend.c (cal_backend_remove_object): Implemented. - (notify_remove): New function to notify clients that an object was - removed. - -2000-02-16 Russell Steinthal - - * calobj.[ch], eventedit.c, main.c: Change iCalObject.organizer - from char* to iCalPerson* - - * calobj.[ch]: Change iCalObject.related from list of char* to - list of iCalRelation*; assorted related fixes - - * icalendar.c: interface between libical and the gnomecal - internal representation - -2000-02-11 Federico Mena Quintero - - * cal-client.c (cal_client_update_object): Implemented. - - * cal.c (cal_notify_update): New function to notify the listener - about an updated object. - (Cal_update_object): Implemented. - (Cal_get_uids): set_release() the sequence to TRUE. - (Cal_get_events_in_range): Likewise. - - * cal-backend.c (remove_object): New function to remove objects - from a calendar backend. - (cal_backend_update_object): New public function to update an - object and notify clients about it. - - * evolution-calendar.idl (Cal): Added update_object() and - delete_object() methods. - (Listener): Removed the obj_changed method and renamed obj_added - to obj_updated. We now only have updated and removed notifiers. - - * cal-listener.[ch]: Removed the "changed" notification code. - Changed the "added" notification code to the "updated" - notification. - - * cal-client.c: Likewise. - - * tlacuache.c (create_cal_factory): Connect to "destroy" on the - factory and exit the main loop when the factory is destroyed. - - * cal-factory.c (backend_destroy_cb): New callback used when a - backend is destroyed. Removes the backend from the factory's hash - table and unrefs the factory if all backends go away. - (add_calendar_client): Free the environment. - - * cal.c (cal_new): Use bonobo_object_unref() if we fail to - initialize. - - * cal-listener.c (cal_listener_new): Likewise. - - * layout.c (layout_events): Plug li.partition memory leak. - -2000-02-10 Federico Mena Quintero - - * cal-backend.c (cal_backend_add_cal): Connect to the Cal's - destroy signal. - (cal_backend_remove_cal): Killed function now that removal of Cal - objects is done in their destroy callback. - (cal_destroy_cb): New callback to remove a Cal from the backend's - list of clients. Also, the backend destroys itself when there are - no more clients connected to it. - (save): New placeholder function to save a backend. - (destroy): New function to destroy a backend's data. - (cal_backend_destroy): Save the calendar and destroy it. - - * cal.c (cal_destroy): Reset the priv->backend to NULL. - - * cal-factory.c (add_calendar_client): There is no need to call - cal_backend_remove_cal(); we can now just destroy the Cal object. - (create_fn): Make sure we always unref the URI. - (load_fn): Move the URI unref to the end of the function for - safety. - - * cal-factory.c (add_calendar_client): Unref the Cal only if - notification of the listener was unsuccessful. Otherwise, the - calendar user agent (Listener side) keeps the reference. - - * tl-test.c (list_uids): Free the calobj. - - * cal-client.c (cal_loaded_cb): Use bonobo_object_unref() to get - rid of the listener. - (load_or_create): Likewise. - (destroy_factory): New function to get rid of the factory. - (destroy_listener): New function to get rid of the listener. - (destroy_cal): New function to get rid of the calendar client - interface object. - (cal_client_destroy): Free all resources. - (cal_client_get_object): CORBA_free() the calobj string. Boy, I - love memprof. - - * cal-listener.c (cal_listener_destroy): Reset the priv->cal to - CORBA_OBJECT_NIL. - - * cal-backend.c (cal_backend_remove_cal): Do not unref the Cal, - since the calendar user agent owns it. - (cal_backend_add_cal): Do not ref the Cal, since the calendar user - agent owns it. - - * cal-factory.c (add_calendar_client): Use bonobo_object_unref() - to get rid of the calendar client interface object. - - * calobj.c (ical_object_create_from_vobject): Duplicate the - default "PUBLIC" string. - -2000-02-09 Federico Mena Quintero - - * cal-factory.c (cal_factory_load): Added documentation comment. - (load_fn): Do not print a message if the backend could not be - loaded due to a non-fatal error. - (queue_load_create_job): Moved the stuff from cal_factory_load() - to here. Now this function serves to queue load or create - requests. - (cal_factory_load): Use queue_load_create_job(). - (cal_factory_create): Implemented; use queue_load_create_job(). - (create_fn): New job handler for creating new calendars. - (create_backend): New function to create a new backend with a new - calendar. - (add_backend): New helper function to add backends to the - factory's hash table. - (load_backend): Use add_backend() instead of adding the backend by - ourselves. - - * cal-client.c (load_or_create): Moved the functionality from - cal_client_load_calendar() to here, and added an option to create - a new calendar instead of loading an existing one. - (cal_client_load_calendar): Use load_or_create(). - (cal_client_create_calendar): Implemented. - - * cal-backend.c (cal_backend_create): Implemented. - - * evolution-calendar.idl (LoadStatus): Added an IN_USE error for - create requests. - - * cal-listener.h (CalListenerLoadStatus): Added CAL_LISTENER_LOAD_IN_USE. - - * cal-listener.c (Listener_cal_loaded): Convert the IN_USE error. - - * cal-client.h (CalClientLoadStatus): Added CAL_CLIENT_LOAD_IN_USE. - - * cal-client.c (cal_loaded_cb): Handle CAL_LISTENER_LOAD_IN_USE. - - * tl-test.c: New test program for the calendar client side; it - also exercises the server side by sending commands to it. - - * Makefile.am: Added the tl-test program. - - * tlacuache.gnorba: Updated. - - * tlacuache.c (create_cal_factory): Use the right GOAD id. - - * cal-client.c (cal_client_construct): Use the right GOAD id. - -2000-02-08 Federico Mena Quintero - - * evolution-calendar.idl (Cal): Added get_uids() method to get a - list of UIDs based on object types. - - * cal-backend.c (cal_backend_get_uids): Implemented get_uids() in - the backend. - - * cal.c (Cal_get_uids): Implemented get_uids() method. - - * cal-client.c (cal_client_get_uids): Implemented client-side - function. - - * cal-util.c (cal_obj_instance_list_free): Doh. Free the list, - not the last link. - (cal_obj_uid_list_free): New function to free a list of UIDs. - - * GnomeCal.idl (Repository): Removed unused method - get_object_by_id_list(). This is just for cleanup purposes and to - remind me exactly of what needs to be moved over to - evolution-calendar.idl. - (Repository): Removed unused get_objects() method. - - * corba-cal.c (init_calendar_repo_class): Removed the unused - get_objects method. - - * calobj.h (CalObjFindStatus): New status value enumeration for - the find function. - - * calobj.c (ical_object_find_in_string): New function to parse a - complete calendar and find a calendar object in it. This should - be used instead ical_object_new_from_string() in the future. - - * evolution-calendar.idl (CalObjInstance): Added an uid field. - Now the idea is that whenever calendar object strings are passed - around, their UIDs are passed along with them so that the actual - object can be pulled from the whole VCAL object using its UID to - identify it. - - * cal-util.h (CalObjInstance): Added uid field. - - * cal-util.c (cal_obj_instance_list_free): Free the UIDs. - - * cal-backend.c (build_event_list): Store the object's UID in the - instance structure. - - * cal.c (Cal_get_events_in_range): Copy the UID field to the CORBA - structure. - - * cal-client.c (cal_client_get_events_in_range): Copy the UID - field from the CORBA structure. - - * main.c (gnome_cal_file_menu): Removed unfinished html-month stuff. - - * Makefile.am (gnomecal_SOURCES): Removed html-month.c. - - * gnome-cal.c: #include "alarm.h" - (mail_notify): Made static. - - * alarm.h: #include "calobj.h" - - * corba-cal-factory.h (init_corba_server): Fixed prototype. - - * quick-view.c (create_items_for_event): Made static. - - * gncal-todo.c (column_resized): Made static. - - * layout.c (find_index): Made static. - -2000-02-08 Federico Mena Quintero - - * evolution-calendar.idl (CalObjInstance): New struct to wrap - instances of calendar objects for recurrencies and alarms. - (Cal::get_events_in_range): New method to get ocurring and - recurring events by time range. - - * cal-backend.c (cal_backend_get_events_in_range): New function to - get a list of event instances in a time range. - (string_from_ical_object): New internal function. - (cal_backend_get_object): Use string_from_ical_object() instead of - doing everything ourselves. - (cal_backend_get_events_in_range): New function to get a list of - the events that occur or recur in a specified time range. - - * cal-client.c (cal_client_get_events_in_range): Implemented - client-side function. - - * cal-util.h: - * cal-util.c: New files with utilities and types common to the - client and server parts. - (CalObjInstance): New structure to hold an instance of an actual - occurrence, recurrence, or alarm trigger of a calendar object. - (cal_obj_instance_list_free): New function to free a list of - calendar object instances. - - * cal.c (Cal_get_events_in_range): Implemented new method. - - * corba-cal.c (cal_repo_get_updated_objects): Free `str' with - free(), not g_free(), since calendar_get_as_vcal_string() uses - writeMemVObject(), which uses realloc(). Fixed in gnome-pim as - well. - -2000-02-04 Federico Mena Quintero - - * cal-backend.c (get_calendar_base_vobject): New function to - create the base VObject for a calendar. - (cal_backend_get_object): Create the base calendar and add the - sought object to it, then stringify it. - - * evolution-calendar.idl (Listener::obj_added - Listener::obj_changed): Now these pass in just the UIDs, not the - complete objects. - - * cal-listener.c (Listener_obj_added): Changed to pass in the uid, - not the object. - (Listener_obj_changed): Likewise. - - * cal-client.h (CalClientClass): Made the obj_added and - obj_changed signals take in the UIDs, not the full objects. - - * cal-client.c (obj_added_cb): Likewise. - (obj_changed_cb): Likewise. - -2000-02-04 Federico Mena Quintero - - * cal-backend.c (CalBackendPrivate): Renamed the event_hash field - to object_hash. Now we hash all the calendar's objects here based - on their UIDs. - (ensure_uid): New function to create UIDs for calendar objects - that don't have them. - (add_object): Ensure the object has an UID before inserting it in - the calendar. - (cal_backend_get_object): New function. - -2000-02-03 Federico Mena Quintero - - * evolution-calendar.idl (Cal): Added the get_object() method. - - * cal-client.c (cal_client_get_object): New function to get a - calendar object by its UID. - - * cal.c (Cal_get_object): Implemented. - - * cal-backend.c (cal_backend_get_object): New unfinished backend - function. We need some reorganizing of how the calendar objects - are stored. - -2000-02-02 Federico Mena Quintero - - * Makefile.am (gnomecal_SOURCES): Added the CORBA generated - sources. - -2000-02-01 Federico Mena Quintero - - * cal-client.c (cal_loaded): Handle the cal_loaded signal from the - listener. Store the calendar client interface object, and emit - our own cal_loaded signal. - (cal_client_load_calendar): Connect to the listener's signals. - (cal_client_class_init): Added the "obj_added", "obj_removed", - öbj_changed" signals. - (obj_added_cb): Handle the signal from the listener. - (obj_removed_cb): Likewise. - (obj_changed_cb): Likewise. - -2000-01-30 Federico Mena Quintero - - * Makefile.am (gnomecal_SOURCES): Added cal-client.[ch] and - cal-listener.[ch]. - -2000-01-30 Federico Mena Quintero - - * evolution-calendar.idl: Changed the namespace from - GNOME::Calendar to Evolution::Calendar. - (Listener::LoadStatus): Fixed SUCESSS -> SUCCESS typo. And I - never noticed it in the implementation. Ain't M-/ grand? - - * Makefile.am: Changed ocurrences of gnome-calendar.idl to - evolution-calendar.idl. - - * *.[ch]: Changed GNOME_Calendar_foo identifiers to - Evolution_Calendar_foo. - -2000-01-25 Federico Mena Quintero - - * cal-client.c cal-client.h: New files with the calendar client - object. - -2000-01-25 Federico Mena Quintero - - * cal-factory.c (CalFactory_load): Check that the listener is not - nil and emit and exception if it is. - - * gnome-calendar.idl (CalFactory::load CalFactory::create): Now - these raise the NilListener exception. - - * tlacuache.c (calendar_notify): Error stub for alarms. - (alarm_defaults): Stub array. - (debug_alarms): Stub variable. - (main): Initialize gnome-vfs. - -2000-01-24 Federico Mena Quintero - - * tlacuache.c: New main module for the Tlacuache personal calendar - server. - - * tlacuache.gnorba: New gnorba file for Tlacuache, the GNOME - personal calendar server. - - * Makefile.am: Added the stuff necessary to build Tlacuache. - - * cal.c (Cal_get_uri): Convert the URI to a string before - returning it. - - * cal-factory.c (CalFactory_create): Doh, this function is void. - - * job.c (job_add): Use g_idle_add(), not gtk_idle_add(). - -2000-01-24 Federico Mena Quintero - - * cal-backend.c (cal_backend_remove_cal): New function to remove a - calendar client interface object from a backend. - (cal_backend_load): Convert the URI to string and use - Parse_MIME_FromFileName(). The conversion is not very smart, - though. - - * cal-factory.c (load_backend): Moved most of the error handling - upstream to load_fn(). - (load_fn): Handle failure in case the backend could not be loaded. - (cal_factory_destroy): Free the backends and the backend hash - table. - (add_calendar_client): Implemented. We create a Cal client - interface object and attach it to the backend, and we notify the - listener. - -2000-01-22 Federico Mena Quintero - - * cal-factory.c (lookup_backend): Renamed from lookup_calendar(). - Also, return a backend instead of a Cal client object. - - * cal-backend.c (cal_backend_load): Take in a GnomeVFSURI, not a - string. - - * cal-listener.c (Listener_cal_loaded): Pass the load status to - the signal. - (cal_listener_destroy): Better error checking. - (cal_listener_new): Better error checking. - - * cal-listener.h (CalListenerLoadStatus): New enum for the load - status of a calendar. - (CalListenerClass): Added the status argument to the cal_loaded - signal. - - * gnome-calendar.idl (cal_loaded): Added a load status code. - - * cal-backend.h (CalBackendLoadStatus): Renamed from - CalBackendLoadResult. - -2000-01-18 Federico Mena Quintero - - * cal-backend.c cal-backend.h: Moved the calendar backend here. - This is the actual calendar-handling object. - (load_from_vobject): Moved over from calendar.c. Modified to use - a CalBackend instead of the old Calendar structure. - (add_object): Likewise. - - * cal.c: Now the Cal object is just a calendar client interface - object; we use it as a "viewport" onto a CalBackend. This also - lets us do correct resource management. - - * cal-common.h: New file with common forward declarations; we - can't have circular dependencies between headers. - -2000-01-18 Federico Mena Quintero - - * cal-factory.c (cal_factory_load): Queue a load job. - (load_fn): Load job handler. Lookup the calendar by URI, load it - if it is not loaded, or just report it to the new listener if it is. - - * job.c job.h: New files with a simple job queue manager. - - * gnome-calendar.idl (Listener::cal_loaded): Do not return the - whole calendar object string. The client will be able to query - the calendar for the events it needs. - - * cal-listener.c (Listener_cal_loaded): Ref the calendar GNOME - object. We unref it when the listener is destroyed. - -2000-01-17 Federico Mena Quintero - - The files from the gncal directory of the gnome-pim module on CVS - were moved here, to evolution/calendar, in preparation for the - Evolution work. The calendar is being split into a model/view - architecture. The model is a personal calendar server (PAS): it - provides storage, notification, and event generation; the - views/controllers are the calendar user agents and things like - Pilot synchronizers. - -2000-01-11 Federico Mena Quintero - - * cal.c: Removed the CORBA listener methods, adjusted for the new - IDL. - - * cal-listener.c (cal_listener_init): Create the private - structure. In it we hold a reference to the calendar the listener - is watching. - (cal_listener_destroy): Destroy the private structure and unref - the calendar. - (Listener_cal_loaded): Stuff the calendar into our private data. - (Listener_obj_added): Adjusted for new IDL. - (Listener_obj_removed): Likewise. - - * gnome-calendar.idl: New IDL for the personal calendar server. - - * cal.h cal.c: New files with the calendar object. - - * cal-listener.h cal-listener.c: New files with the calendar - listener object. - - * cal-factory.h cal-factory.c: New files with the calendar factory - object. - -2000-01-09 Eskil Heyn Olsen - - * Makefile.am: Changes to remove todo capplet stuff from distro. - -2000-01-08 Vadim Strizhevsky - - * calendar-conduit-control-applet.c: Added pilotID argument to - gpilotd_conduit_mgmt_new. - - -2000-01-05 Eskil Heyn Olsen - - * GnomeCal.idl: Added an argument to get_number_of_objects, so you - can choose which state the object should have - (any/new/modified/...). Will also add one to choose type - (event/journal etc). - - * corba-cal.c (cal_repo_get_number_of_objects): Implemented the - new version of get_number_of_objects. - - * calendar-conduit.c (pre_sync): Calls various - gnome_pilot_conduit_standard_abs_set_num_yadayda to get progress bars. - -2000-01-04 Eskil Heyn Olsen - - * calendar-conduit.c (start_calendar_server): Let's not call - g_error, but g_warning instead. - (pre_sync): Get record numbers info, total, new, deleted etc, and - tell gpilotd. - -1999-12-31 Eskil Heyn Olsen - - * eventedit.c (ee_store_recur_end_to_ical): Adds 86400 secs (1 - day) to the date chooses by the user. This ensures the recurrence - also occurs on that date. - (ee_rp_init_ending_date): And subtracts 86400 secs when about to - redisplay the box. - - * calendar.h: Added an argument to calendar_new, to enable certain - features, such as initing alarms or nor. - - * calendar.c (calendar_new): Implemented support for the - CALENDAR_INIT_ALARMS option to calendar_new. - - * corba-cal.c (cal_repo_get_updated_objects): Added - CALENDAR_INIT_ALARMS to calendar_new calls. - - * main.c: Added CALENDAR_INIT_ALARMS to calendar_new calls. This - should probably be CALENDAR_INIT_NIL, but I'm not sure, guess - steintr should check it. - - * gnome-cal.c: Added CALENDAR_INIT_ALARMS to calendar_new calls. - - * calendar-pilot-sync.c: Added CALENDAR_INIT_NIL to calendar_new calls. - -1999-12-10 Russell Steinthal - - * 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 - - * 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 - - * 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 - - * 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 - - * Makefile.am (EXTRA_DIST): Added .desktop files to EXTRA_DIST. - -1999-10-12 Clifford R. Conover - - * 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 - - * calendar-conduit.c: undef DEBUG_CALCONDUT, suppresses debug output. - -1999-12-02 Russell Steinthal - - * 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 - - * calendar-conduit.c (compare): Fixed compare bug. Also neated up - some of the if's in set_status. - -1999-11-22 Russell Steinthal - - * Merged todo list coloring patch from stable - * Added myself to AUTHORS, about box (per Miguel) - -1999-11-22 Eskil Heyn Olsen - - * calendar-conduit.c (pre_sync): Writes some warning - messages when pre_sync fails. - -1999-11-14 Eskil Heyn Olsen - - * Makefile.am: Stupid misplaced endif cause gncal to depend on an - install gnome-pilot... fixed... sorry. - -1999-11-12 Eskil Heyn Olsen - - * 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 - - * 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 - - * calendar.c (calendar_day_change): Add call to - calendar_init_alarms() to schedule another day change alarm. - -1999-11-09 Eskil Heyn Olsen - - * 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 - - * calendar-conduit-control-applet.c (readStateCfg): Commented the - code out, thus the capplet works again. - -1999-11-04 Eskil Olsen - - * 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 - - * 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 - - * calendar.c (calendar_new): Correctly initialize calendar_day_end - and calendar_day_begin *before* installing day-change alarm. - -1999-10-21 Russell Steinthal - - * 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 - - * gnome-cal.c (calendar_notify): Fix typos which were causing - invalid times in audio notification dialogs; fixes Bug #2561 - -1999-10-18 Russell Steinthal - - * 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 - - * gncal.desktop: Added swedish translation - -1999-10-13 Eskil Olsen - - * Makefile.am: Hopefully the fixes the much-hated - gnome-pilot dependency. - -1999-10-07 Eskil Olsen - - * 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 - - * *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 - - * 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 - -1999-09-27 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * 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 - - * gncal.desktop: Added Estonian translations. - -1999-09-14 Federico Mena Quintero - - * gncal-full-day.c (child_popup_menu): Set the data pointers for - all the items. - -1999-09-14 Kjartan Maraas - - * doc/C/gnomecal.sgml: Merge from gnome-pim-1-0. Synced with newest - user-guide. - -1999-09-01 Miguel de Icaza - - * eventedit.c (ee_create_buttons): Make the OK button the default - button per Russell's suggestion. - -1999-08-30 Miguel de Icaza - - * 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 - - * gnomecal.gnorba: "GenericFactoy" is wrong... - -1999-08-15 Miguel de Icaza - - * calobj.c (ical_gen_uid): Fix the hostname part. - -1999-08-07 Peter Teichman - - * 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 - - * month-view.c (month_view_init): Release points here. - -1999-08-02 Peter Teichman - - * 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 - - * calendar-pilot-sync.c (sync_object_to_pilot): The multi-day - appointment corruption bug is dead. Whoo! - -1999-07-31 Peter Teichman - - * Makefile.am: fixed this up slightly with respect to pilot conduits - -1999-07-30 Jonathan Blandford - - * Makefile.am (libcalendar_conduit_la_LIBADD): More autoconf-stuff - -1999-07-29 Jonathan Blandford - - * gnome-cal.c (setup_widgets): Add scrolling to the yearview. - -1999-07-28 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * 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 - - * timeutil.c (time_from_isodate): Handle the 'Z' parameter to the - ISO date format to convert from GMT time. - -1999-07-17 Nat Friedman - - * calendar.c (calendar_add_object): Copy the new UID into the - iCalObject structure. - -1999-07-16 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * main.c (new_calendar): Realize the toplevel widget when - --hidden is passed to gnomecal. This fixes a segfault. - -1999-06-04 Robert Brady - - * gnome-cal.h, gnome-cal.c: Fix abort() problem with the year view. - (Bug #1367). Thanks to Owen Cliffe for - helping track it down. - -1999-06-03 Miguel de Icaza - - * calobj.c (daynumberlist): One line bug fix from Sergey I Panov. - -1999-06-02 Miguel de Icaza - - * 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 - - * 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 - - * Makefile.am (install-data-local): help files be gone. They are - now installed from the Docbook stuff. - -1999-05-26 Russell Steinthal - - * 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 - - * 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 - - * year-view.c: Removed unused macro CALENDAR_HEIGHT. - -1999-05-25 Federico Mena Quintero - - * 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 - - * 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 - - * main.c (dump_todo): Add --todo flag to dump the todo contents. - -1999-04-19 Miguel de Icaza - - * gncal-todo.c (add_activated): Use same hack used in edit_activated - -1999-04-16 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * gncal-todo.c (convert_time_t_to_char): Made static. Make it use - the full year format for strftime(). - -1999-03-27 Nuno Ferreira - - * calobj.c: Include So that strings get translated. - -1999-03-26 Tomas Ogren - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * quick-view.c (QUICK_VIEW_FONTSET): Added Korean font to the - fontset string. - * mark.h (*_FONTSET): Likewise. - -1999-02-23 Miguel de Icaza - - * 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 - - * 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 - - * main.c (init_username): Made use of g_get_{user,real}_name() instead - of our own home-brew... - -1999-02-17 Sergey Panov - - * 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 - - * main.c: Use N_() macro for color settings labels in - color_props structure. - -1999-02-15 Federico Mena Quintero - - * goto.c (goto_dialog): Indentation fixes. - -1999-02-15 Tomas Ogren - - * 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 - - * 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 - - * main.c: Removed the gtk_widget_realize call. - -1999-02-06 Changwoo Ryu - - * gncal.desktop: Added Korean translations. - -1999-02-04 Federico Mena Quintero - - * eventedit.c (date_edit_new): New convenience function to create - a properly-configured date editor widget. - -1999-02-03 Federico Mena Quintero - - * 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 - - * eventedit.c (event_editor_init): Set the title of the event - editor window. - -1999-01-31 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * main.c: do gtk_widget_realize on the toplevel window.. - -1999-01-13 Federico Mena Quintero - - * 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 - - * main.c: Converted some more stuff to use the standards. - -1999-01-08 Nat Friedman - - * 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 - - * 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 - - 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 - - * 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 - - * 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 - - * eventedit.c (ee_rp_init_exceptions): Update GtkClist usage. - -1998-11-23 Andrew T. Veliath - - * 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 - - * eventedit.c: use GPOINTER_TO_INT - - * gncal-todo.c: same. - -1998-11-22 Matthew Wilson - - * 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 - - * 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 - - * calendar.c (calendar_save): Backup the old file before saving - the caledar. - -1998-11-06 Miguel de Icaza - - * calobj.c: Add ctype.h - -1998-10-31 Federico Mena Quintero - - * 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 - - * 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 - - * eventedit.c (ee_store_recur_rule_to_ical): The interval was - never being loaded from the spin button. - -1998-10-09 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * main.c (main): Replaced the 'gnome_client_new_default' call with - 'gnome_master_client'. - -1998-10-02 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * main.c: Hotkey for File/Exit should be C-q, not C-x. - -1998-09-24 Federico Mena Quintero - - * 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 - - * main.c: Added underlined shortcuts and accelerators to the main menu. - -1998-09-16 Raja R Harinath - - * gncal-week-view.c (): Include. - * gncal-week-view.h (): Include. - -1998-09-06 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * gncal.desktop: Added Portuguese translation. - -Mon Jun 22 13:01:16 1998 Havoc Pennington - - * main.c (session_save_state): Use gnome_geometry_string to get - the geometry string. - -1998-06-04 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * gncal-full-day.c (paint_back): Eliminated unnecessary border repainting. - -Sun May 17 17:55:03 1998 Havoc Pennington - - * gncal-todo.c (simple_todo_editor): Close dialog when return is pressed. - -1998-05-15 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * 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 - - * prop.c (prop_apply): Only run the apply code once. - -1998-05-03 Miguel de Icaza - - * 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 - - * prop.c (prop_apply): Do not call prop_cancel, ths is now using - GnomePropertyDialog. - -1998-04-29 Miguel de Icaza - - * 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 - - * 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 - - * 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 . - -1998-04-24 Miguel de Icaza - - * calobj.c (ical_object_create_from_vobject): Fixed alarm loading; - Load snooze time and snooze count - -1998-04-23 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * eventedit.c (ee_ok): Mark the event as non-new after accepting changes. - -1998-04-20 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * alarm.c (alarm_kill, alarm_init, alarm_add): Implement the alarm - management framework. - -1998-04-17 Federico Mena Quintero - - * 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 - - * gnome-cal.c (gnome_calendar_remove_object): Add support for - removing objects. - -1998-04-17 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * 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 - - * calobj.c (ical_foreach): Define iterator routine. - -1998-04-15 Arturo Espinosa Aldama - - * gncal-year-view.[hc]: Now using time_t for new and set. - Random fixes, as well. - -1998-04-15 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * gncal-full-day.c: #include - - * 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 - - * gncal.c (update_calendar): Say `#if 0', not `#ifdef 0'. - -1998-04-07 Federico Mena Quintero - - * 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 - - * 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 - - * eventedit.c (ee_create_ae): Make it return void. - (ee_alarm_widgets): Remove some unused variables. - (ee_store_alarm): Make it return void. - #include - - * 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 - - * versit/.cvsignore: New file. - -Fri Apr 3 22:31:54 1998 Tom Tromey - - * calendar.c: Include . - -1998-04-03 Miguel de Icaza - - * 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 - - * view-utils.c (view_utils_draw_events): The "better" format - string for strftime() wasn't better, after all :-( - -1998-04-02 Federico Mena Quintero - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * Start from scratch - -Tue Mar 31 23:46:50 1998 Tom Tromey - - * timeutil.c (format_simple_hour): `buf' now static. - -1998-03-31 Federico Mena Quintero - - * 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 - - * Now has (non working) session maangement - * Uses a clist for the dailylist like gtt - -Sat Mar 21 15:43:20 1998 Tom Tromey - - * gncal.c: Use gnome_message_box_*, not gnome_messagebox_*. - -1998-03-12 Craig Small - - * Now linked (in some horrible way) to the gtkcalendar widget. - -Sun Mar 8 16:38:10 1998 Tom Tromey - - * 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 - - * gncal.c (main): Added app_id "gncal". - -1998-02-19 Carsten Schaar - - * Makefile.am (gncal_LDADD): Added '$(INTLLIBS)' - -1998-02-18 Raja R Harinath - - * 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 - - * menus.c: Replace "Quit" with "Exit". diff --git a/calendar/GnomeCal.idl b/calendar/GnomeCal.idl deleted file mode 100644 index 3838c7c0bc..0000000000 --- a/calendar/GnomeCal.idl +++ /dev/null @@ -1,104 +0,0 @@ -#include - -module GNOME { - - module Calendar { - - interface Repository { - - exception NotFound {}; - typedef sequence 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_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_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 of a specific type in the calendar - * repository. - */ - - enum RecordStatus { - ANY, /* This means all records */ - NEW, - MODIFIED, - DELETED - }; - - long get_number_of_objects(in RecordStatus record_status); - - /* - * 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 521a95114b..0000000000 --- a/calendar/Makefile.am +++ /dev/null @@ -1,303 +0,0 @@ -SUBDIRS = doc - -idldir = $(datadir)/idl -idl_DATA = \ - GnomeCal.idl \ - evolution-calendar.idl - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = \ - gnomecal.gnorba \ - tlacuache.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 tlacuache $(extra_pilot_bins) - -ICAL_LINK_FLAGS = ../libical/src/libical/libical.la - -INCLUDES = \ - -I$(includedir) \ - $(BONOBO_VFS_GNOME_CFLAGS) \ - $(GNOME_CONDUIT_INCLUDEDIR) \ - $(PISOCK_INCLUDEDIR) \ - -I../libical/src/libical \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" - -GNOMECAL_CORBA_GENERATED = \ - GnomeCal.h \ - GnomeCal.c \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal-stubs.c - -$(GNOMECAL_CORBA_GENERATED): GnomeCal.idl - orbit-idl $(srcdir)/GnomeCal.idl - -corba-cal.c \ -corba-cal.h \ -corba-cal-factory.c \ -corba-cal-factory.h: GnomeCal.h - -EVOLUTION_CALENDAR_CORBA_GENERATED = \ - evolution-calendar.h \ - evolution-calendar-common.c \ - evolution-calendar-skels.c \ - evolution-calendar-stubs.c - -$(EVOLUTION_CALENDAR_CORBA_GENERATED): evolution-calendar.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl $(srcdir)/evolution-calendar.idl - -gnomecal_SOURCES = \ - $(EVOLUTION_CALENDAR_CORBA_GENERATED) \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal.h \ - alarm.c \ - alarm.h \ - cal-client.c \ - cal-client.h \ - cal-listener.c \ - cal-listener.h \ - cal-util.c \ - cal-util.h \ - calendar.c \ - calendar.h \ - calendar-conduit.h \ - calobj.c \ - calobj.h \ - eventedit.c \ - eventedit.h \ - corba-cal.c \ - corba-cal.h \ - corba-cal-factory.c \ - corba-cal-factory.h \ - getdate.y \ - 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 \ - goto.c \ - icalendar.c \ - icalendar.h \ - 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 - -tlacuache_SOURCES = \ - $(EVOLUTION_CALENDAR_CORBA_GENERATED) \ - alarm.c \ - alarm.h \ - cal.c \ - cal.h \ - cal-backend.c \ - cal-backend.h \ - cal-common.h \ - cal-factory.c \ - cal-factory.h \ - cal-util.c \ - cal-util.h \ - calobj.c \ - calobj.h \ - icalendar.c \ - icalendar.h \ - job.c \ - job.h \ - timeutil.c \ - timeutil.h \ - tlacuache.c - -LINK_FLAGS = \ - $(BONOBO_VFS_GNOME_LIBS) \ - $(INTLLIBS) \ - ../libversit/libversit.la \ - $(ICAL_LINK_FLAGS) - -tlacuache_INCLUDES = \ - $(INCLUDES) \ - -DG_LOG_DOMAIN=\"tlacuache\" - -tlacuache_LDADD = \ - $(BONOBO_VFS_GNOME_LIBS) \ - ../libversit/libversit.la \ - $(ICAL_LINK_FLAGS) - -calendar_pilot_sync_LDADD = \ - $(PISOCK_LIBDIR) $(PISOCK_LIBS) \ - $(LINK_FLAGS) - -noinst_PROGRAMS = tl-test - -tl_test_SOURCES = \ - $(EVOLUTION_CALENDAR_CORBA_GENERATED) \ - cal-client.c \ - cal-client.h \ - cal-listener.c \ - cal-listener.h \ - cal-util.c \ - cal-util.h \ - tl-test.c - -tl_test_INCLUDES = \ - $(INCLUDES) \ - -DG_LOG_DOMAIN=\"tl-test\" - -tl_test_LDADD = \ - $(BONOBO_VFS_GNOME_LIBS) \ - ../libversit/libversit.la - -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_INCLUDES = \ - $(INCLUDES) \ - -DG_LOG_DOMAIN=\"gnomecal\" - -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 \ - bell.xpm \ - recur.xpm \ - $(idl_DATA) \ - $(gnorba_DATA) \ - gnome-calendar-conduit.png - -# todo-conduit-control-applet.desktop \ - - -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 -#include -#include -#include -#include -#include -#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 2dc77e623b..0000000000 --- a/calendar/alarm.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef ALARM_H -#define ALARM_H - -#include -#include "calobj.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-backend.c b/calendar/cal-backend.c deleted file mode 100644 index 570c4dccdc..0000000000 --- a/calendar/cal-backend.c +++ /dev/null @@ -1,1083 +0,0 @@ -/* Evolution calendar backend - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal-backend.h" -#include "calobj.h" -#include "../libversit/vcc.h" -#include "icalendar.h" - - - -/* VCalendar product ID */ -#define PRODID "-//Helix Code//NONSGML Tlacuache//EN" - - - -/* Private part of the CalBackend structure */ -typedef struct { - /* URI where the calendar data is stored */ - GnomeVFSURI *uri; - - /* format of this calendar (ical or vcal) */ - CalendarFormat format; - - /* List of Cal objects with their listeners */ - GList *clients; - - /* All the iCalObject structures in the calendar, hashed by UID. The - * hash key *is* icalobj->uid; it is not copied, so don't free it when - * you remove an object from the hash table. - */ - GHashTable *object_hash; - - /* All events, TODOs, and journals in the calendar */ - GList *events; - GList *todos; - GList *journals; - - /* Whether a calendar has been loaded */ - guint loaded : 1; -} CalBackendPrivate; - - - -static void cal_backend_class_init (CalBackendClass *class); -static void cal_backend_init (CalBackend *backend); -static void cal_backend_destroy (GtkObject *object); - -static GtkObjectClass *parent_class; - - - -/** - * cal_backend_get_type: - * @void: - * - * Registers the #CalBackend class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalBackend class. - **/ -GtkType -cal_backend_get_type (void) -{ - static GtkType cal_backend_type = 0; - - if (!cal_backend_type) { - static const GtkTypeInfo cal_backend_info = { - "CalBackend", - sizeof (CalBackend), - sizeof (CalBackendClass), - (GtkClassInitFunc) cal_backend_class_init, - (GtkObjectInitFunc) cal_backend_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_backend_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_backend_info); - } - - return cal_backend_type; -} - -/* Class initialization function for the calendar backend */ -static void -cal_backend_class_init (CalBackendClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - object_class->destroy = cal_backend_destroy; -} - -/* Object initialization function for the calendar backend */ -static void -cal_backend_init (CalBackend *backend) -{ - CalBackendPrivate *priv; - - priv = g_new0 (CalBackendPrivate, 1); - backend->priv = priv; - - /* FIXME can be CAL_VCAL or CAL_ICAL */ - priv->format = CAL_VCAL; -} - -/* Saves a calendar */ -static void -save (CalBackend *backend) -{ - /* FIXME */ -} - -/* g_hash_table_foreach() callback to destroy an iCalObject */ -static void -free_ical_object (gpointer key, gpointer value, gpointer data) -{ - iCalObject *ico; - - ico = value; - ical_object_destroy (ico); -} - -/* Destroys a backend's data */ -static void -destroy (CalBackend *backend) -{ - CalBackendPrivate *priv; - - priv = backend->priv; - - if (priv->uri) { - gnome_vfs_uri_unref (priv->uri); - priv->uri = NULL; - } - - g_assert (priv->clients == NULL); - - if (priv->object_hash) { - g_hash_table_foreach (priv->object_hash, free_ical_object, NULL); - g_hash_table_destroy (priv->object_hash); - priv->object_hash = NULL; - } - - g_list_free (priv->events); - g_list_free (priv->todos); - g_list_free (priv->journals); - - priv->events = NULL; - priv->todos = NULL; - priv->journals = NULL; - - priv->loaded = FALSE; -} - -/* Destroy handler for the calendar backend */ -static void -cal_backend_destroy (GtkObject *object) -{ - CalBackend *backend; - CalBackendPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_BACKEND (object)); - - backend = CAL_BACKEND (object); - priv = backend->priv; - - if (priv->loaded) - save (backend); - - destroy (backend); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* iCalObject manipulation functions */ - -/* Looks up an object by its UID in the backend's object hash table */ -static iCalObject * -lookup_object (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - iCalObject *ico; - - priv = backend->priv; - ico = g_hash_table_lookup (priv->object_hash, uid); - - return ico; -} - -/* Ensures that an iCalObject has a unique identifier. If it doesn't have one, - * it will create one for it. Returns whether an UID was created or not. - */ -static gboolean -ensure_uid (iCalObject *ico) -{ - char *buf; - gulong str_time; - static guint seqno = 0; - - if (ico->uid) - return FALSE; - - str_time = (gulong) time (NULL); - - /* Is this good enough? */ - - buf = g_strdup_printf ("Evolution-Tlacuache-%d-%ld-%u", (int) getpid(), str_time, seqno++); - ico->uid = buf; - - return TRUE; -} - -/* Adds an object to the calendar backend. Does *not* perform notification to - * calendar clients. - */ -static void -add_object (CalBackend *backend, iCalObject *ico) -{ - CalBackendPrivate *priv; - - g_assert (ico != NULL); - priv = backend->priv; - -#if 0 - /* FIXME: gnomecal old code */ - ico->new = 0; -#endif - - if (ensure_uid (ico)) - /* FIXME: mark the calendar as dirty so that we can re-save it - * with the object's new UID. - */ - ; - - g_hash_table_insert (priv->object_hash, ico->uid, ico); - - switch (ico->type) { - case ICAL_EVENT: - priv->events = g_list_prepend (priv->events, ico); -#if 0 - /* FIXME: gnomecal old code */ - ical_object_try_alarms (ico); -# ifdef DEBUGGING_MAIL_ALARM - ico->malarm.trigger = 0; - calendar_notify (0, ico); -# endif -#endif - break; - - case ICAL_TODO: - priv->todos = g_list_prepend (priv->todos, ico); - break; - - case ICAL_JOURNAL: - priv->journals = g_list_prepend (priv->journals, ico); - break; - - default: - g_assert_not_reached (); - } - -#if 0 - /* FIXME: gnomecal old code */ - ico->last_mod = time (NULL); -#endif -} - -/* Removes an object from the backend's hash and lists. Does not perform - * notification on the clients. - */ -static void -remove_object (CalBackend *backend, iCalObject *ico) -{ - CalBackendPrivate *priv; - GList **list, *l; - - priv = backend->priv; - - g_assert (ico->uid != NULL); - g_hash_table_remove (priv->object_hash, ico->uid); - - switch (ico->type) { - case ICAL_EVENT: - list = &priv->events; - break; - - case ICAL_TODO: - list = &priv->todos; - break; - - case ICAL_JOURNAL: - list = &priv->journals; - break; - - default: - list = NULL; - } - - if (!list) - return; - - l = g_list_find (*list, ico); - g_assert (l != NULL); - - *list = g_list_remove_link (*list, l); - g_list_free_1 (l); - - ical_object_destroy (ico); -} - -/* Load a calendar from a VObject */ -static void -load_from_vobject (CalBackend *backend, VObject *vobject) -{ - CalBackendPrivate *priv; - VObjectIterator i; - - priv = backend->priv; - - g_assert (!priv->loaded); - g_assert (priv->object_hash == NULL); - priv->object_hash = g_hash_table_new (g_str_hash, g_str_equal); - - initPropIterator (&i, vobject); - - while (moreIteration (&i)) { - VObject *this; - iCalObject *ical; - const char *object_name; - - this = nextVObject (&i); - object_name = vObjectName (this); -#if 0 - /* FIXME? What is this used for in gnomecal? */ - if (strcmp (object_name, VCDCreatedProp) == 0) { - cal->created = time_from_isodate (str_val (this)); - continue; - } -#endif - 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); - - /* FIXME: some broken files may have duplicated UIDs. This is - * Bad(tm). Deal with it by creating new UIDs for them and - * spitting some messages to the console. - */ - - if (ical) - add_object (backend, ical); - } -} - -/* Creates a VObject with the base information of a calendar */ -static VObject * -get_calendar_base_vobject (CalBackend *backend) -{ - VObject *vobj; - time_t now; - struct tm tm; - - /* We call localtime for the side effect of setting tzname */ - - now = time (NULL); - tm = *localtime (&now); - - vobj = newVObject (VCCalProp); - - addPropValue (vobj, VCProdIdProp, PRODID); - -#if defined (HAVE_TM_ZONE) - addPropValue (vobj, VCTimeZoneProp, tm.tm_zone); -#elif defined (HAVE_TZNAME) - addPropValue (vobj, VCTimeZoneProp, tzname[0]); -#endif - - /* Per the vCalendar spec, this must be "1.0" */ - addPropValue (vobj, VCVersionProp, "1.0"); - - return vobj; -} - -/* Builds the string representation of a complete calendar object wrapping the - * specified object --- a complete calendar is needed because of the timezone - * information. The return value must be freed with free(), not g_free(), since - * the internal implementation calls writeMemVObject() from libversit, which - * uses realloc() to allocate this string. - */ -static char * -string_from_ical_object (CalBackend *backend, iCalObject *ico) -{ - VObject *vcalobj, *vobj; - char *buf; - - vcalobj = get_calendar_base_vobject (backend); - vobj = ical_object_to_vobject (ico); - addVObjectProp (vcalobj, vobj); - - buf = writeMemVObject (NULL, NULL, vcalobj); - - cleanVObject (vcalobj); - cleanStrTbl (); - - return buf; -} - - - -/** - * cal_backend_new: - * @void: - * - * Creates a new empty calendar backend. A calendar must then be loaded or - * created before the backend can be used. - * - * Return value: A newly-created calendar backend. - **/ -CalBackend * -cal_backend_new (void) -{ - return CAL_BACKEND (gtk_type_new (CAL_BACKEND_TYPE)); -} - -/** - * cal_backend_get_uri: - * @backend: A calendar backend. - * - * Queries the URI of a calendar backend, which must already have a loaded - * calendar. - * - * Return value: The URI where the calendar is stored. - **/ -GnomeVFSURI * -cal_backend_get_uri (CalBackend *backend) -{ - CalBackendPrivate *priv; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - g_assert (priv->uri != NULL); - - return priv->uri; -} - -/* Callback used when a Cal is destroyed */ -static void -cal_destroy_cb (GtkObject *object, gpointer data) -{ - Cal *cal; - Cal *lcal; - CalBackend *backend; - CalBackendPrivate *priv; - GList *l; - - cal = CAL (object); - - backend = CAL_BACKEND (data); - priv = backend->priv; - - /* Find the cal in the list of clients */ - - for (l = priv->clients; l; l = l->next) { - lcal = CAL (l->data); - - if (lcal == cal) - break; - } - - g_assert (l != NULL); - - /* Disconnect */ - - priv->clients = g_list_remove_link (priv->clients, l); - g_list_free_1 (l); - - /* When all clients go away, the backend can go away, too. Commit - * suicide here. - */ - - if (!priv->clients) - gtk_object_unref (GTK_OBJECT (backend)); -} - -/** - * cal_backend_add_cal: - * @backend: A calendar backend. - * @cal: A calendar client interface object. - * - * Adds a calendar client interface object to a calendar @backend. The calendar - * backend must already have a loaded calendar. - **/ -void -cal_backend_add_cal (CalBackend *backend, Cal *cal) -{ - CalBackendPrivate *priv; - - g_return_if_fail (backend != NULL); - g_return_if_fail (IS_CAL_BACKEND (backend)); - - priv = backend->priv; - g_return_if_fail (priv->loaded); - - g_return_if_fail (cal != NULL); - g_return_if_fail (IS_CAL (cal)); - - /* We do not keep a reference to the Cal since the calendar user agent - * owns it. - */ - - gtk_signal_connect (GTK_OBJECT (cal), "destroy", - GTK_SIGNAL_FUNC (cal_destroy_cb), - backend); - - priv->clients = g_list_prepend (priv->clients, cal); -} - - -static icalcomponent* -icalendar_parse_file (char* fname) -{ - FILE* fp; - icalcomponent* comp = NULL; - gchar* str; - struct stat st; - int n; - - fp = fopen (fname, "r"); - if (!fp) { - g_warning ("Cannot open open calendar file."); - return NULL; - } - - stat (fname, &st); - - str = g_malloc (st.st_size + 2); - - n = fread ((gchar*) str, 1, st.st_size, fp); - if (n != st.st_size) { - g_warning ("Read error."); - } - str[n] = '\0'; - - fclose (fp); - - comp = icalparser_parse_string (str); - g_free (str); - - return comp; -} - - -static void -icalendar_calendar_load (CalBackend * cal, char* fname) -{ - icalcomponent *comp; - icalcomponent *subcomp; - iCalObject *ical; - - comp = icalendar_parse_file (fname); - subcomp = icalcomponent_get_first_component (comp, - ICAL_ANY_COMPONENT); - while (subcomp) { - ical = ical_object_create_from_icalcomponent (subcomp); - if (ical->type != ICAL_EVENT && - ical->type != ICAL_TODO && - ical->type != ICAL_JOURNAL) { - g_warning ("Skipping unsupported iCalendar component."); - } else - add_object (cal, ical); - subcomp = icalcomponent_get_next_component (comp, - ICAL_ANY_COMPONENT); - } -} - - -/* -ics is to be used to designate a file containing (an arbitrary set of) -calendaring and scheduling information. - -ifb is to be used to designate a file containing free or busy time -information. - -anything else is assumed to be a vcal file. -*/ - -static CalendarFormat -cal_get_type_from_filename (char *str_uri) -{ - int len; - - if (str_uri == NULL) - return CAL_VCAL; - - len = strlen (str_uri); - if (len < 5) - return CAL_VCAL; - - if (str_uri[ len-4 ] == '.' && - str_uri[ len-3 ] == 'i' && - str_uri[ len-2 ] == 'c' && - str_uri[ len-1 ] == 's') - return CAL_ICAL; - - if (str_uri[ len-4 ] == '.' && - str_uri[ len-3 ] == 'i' && - str_uri[ len-2 ] == 'f' && - str_uri[ len-1 ] == 'b') - return CAL_ICAL; - - return CAL_VCAL; -} - - -/** - * cal_backend_load: - * @backend: A calendar backend. - * @uri: URI that contains the calendar data. - * - * Loads a calendar backend with data from a calendar stored at the specified - * URI. - * - * Return value: An operation status code. - **/ -CalBackendLoadStatus -cal_backend_load (CalBackend *backend, GnomeVFSURI *uri) -{ - CalBackendPrivate *priv; - VObject *vobject; - char *str_uri; - - g_return_val_if_fail (backend != NULL, CAL_BACKEND_LOAD_ERROR); - g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_LOAD_ERROR); - - priv = backend->priv; - g_return_val_if_fail (!priv->loaded, CAL_BACKEND_LOAD_ERROR); - - g_return_val_if_fail (uri != NULL, CAL_BACKEND_LOAD_ERROR); - - /* FIXME: this looks rather bad; maybe we should check for local files - * and fail if they are remote. - */ - - str_uri = gnome_vfs_uri_to_string (uri, - (GNOME_VFS_URI_HIDE_USER_NAME - | GNOME_VFS_URI_HIDE_PASSWORD - | GNOME_VFS_URI_HIDE_HOST_NAME - | GNOME_VFS_URI_HIDE_HOST_PORT - | GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD)); - - - /* look at the extension on the filename and decide - if this is a ical or vcal file */ - - priv->format = cal_get_type_from_filename (str_uri); - - /* load */ - - switch (priv->format) { - case CAL_VCAL: - vobject = Parse_MIME_FromFileName (str_uri); - - if (!vobject) - return CAL_BACKEND_LOAD_ERROR; - - load_from_vobject (backend, vobject); - cleanVObject (vobject); - cleanStrTbl (); - break; - case CAL_ICAL: - icalendar_calendar_load (backend, str_uri); - break; - default: - return CAL_BACKEND_LOAD_ERROR; - } - - g_free (str_uri); - - gnome_vfs_uri_ref (uri); - - priv->uri = uri; - priv->loaded = TRUE; - return CAL_BACKEND_LOAD_SUCCESS; -} - -/** - * cal_backend_create: - * @backend: A calendar backend. - * @uri: URI that will contain the calendar data. - * - * Creates a new empty calendar in a calendar backend. - **/ -void -cal_backend_create (CalBackend *backend, GnomeVFSURI *uri) -{ - CalBackendPrivate *priv; - - g_return_if_fail (backend != NULL); - g_return_if_fail (IS_CAL_BACKEND (backend)); - - priv = backend->priv; - g_return_if_fail (!priv->loaded); - - g_return_if_fail (uri != NULL); - - /* Create the new calendar information */ - - g_assert (priv->object_hash == NULL); - priv->object_hash = g_hash_table_new (g_str_hash, g_str_equal); - - /* Done */ - - gnome_vfs_uri_ref (uri); - - priv->uri = uri; - priv->loaded = TRUE; -} - -/** - * cal_backend_get_object: - * @backend: A calendar backend. - * @uid: Unique identifier for a calendar object. - * - * Queries a calendar backend for a calendar object based on its unique - * identifier. - * - * Return value: The string representation of a complete calendar wrapping the - * the sought object, or NULL if no object had the specified UID. A complete - * calendar is returned because you also need the timezone data. - **/ -char * -cal_backend_get_object (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - iCalObject *ico; - char *buf, *retval; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - - g_return_val_if_fail (uid != NULL, NULL); - - g_assert (priv->object_hash != NULL); - - ico = lookup_object (backend, uid); - - if (!ico) - return NULL; - - /* string_from_ical_object() uses writeMemVObject(), which uses - * realloc(), so we must free its result with free() instead of - * g_free(). We take a copy of the result so that callers can use the - * normal glib function to free it. - */ - - buf = string_from_ical_object (backend, ico); - retval = g_strdup (buf); - free (buf); - - return retval; -} - -struct get_uids_closure { - CalObjType type; - GList *uid_list; -}; - -/* Builds a list of UIDs for objects that match the sought type. Called from - * g_hash_table_foreach(). - */ -static void -build_uids_list (gpointer key, gpointer value, gpointer data) -{ - iCalObject *ico; - struct get_uids_closure *c; - gboolean store; - - ico = value; - c = data; - - store = FALSE; - - if (c->type & CALOBJ_TYPE_ANY) - store = TRUE; - else if (ico->type == ICAL_EVENT) - store = (c->type & CALOBJ_TYPE_EVENT) ? TRUE : FALSE; - else if (ico->type == ICAL_TODO) - store = (c->type & CALOBJ_TYPE_TODO) ? TRUE : FALSE; - else if (ico->type == ICAL_JOURNAL) - store = (c->type & CALOBJ_TYPE_JOURNAL) ? TRUE : FALSE; - else - store = (c->type & CALOBJ_TYPE_OTHER) ? TRUE : FALSE; - - if (store) - c->uid_list = g_list_prepend (c->uid_list, g_strdup (ico->uid)); -} - -/** - * cal_backend_get_uids: - * @backend: A calendar backend. - * @type: Bitmask with types of objects to return. - * - * Builds a list of unique identifiers corresponding to calendar objects whose - * type matches one of the types specified in the @type flags. - * - * Return value: A list of strings that are the sought UIDs. - **/ -GList * -cal_backend_get_uids (CalBackend *backend, CalObjType type) -{ - CalBackendPrivate *priv; - struct get_uids_closure c; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - - /* We go through the hash table instead of the lists of particular - * object types so that we can pick up CALOBJ_TYPE_OTHER objects. - */ - - c.type = type; - c.uid_list = NULL; - g_hash_table_foreach (priv->object_hash, build_uids_list, &c); - - return c.uid_list; -} - -struct build_event_list_closure { - CalBackend *backend; - GList *event_list; -}; - -/* Builds a sorted list of event object instances. Used as a callback from - * ical_object_generate_events(). - */ -static int -build_event_list (iCalObject *ico, time_t start, time_t end, void *data) -{ - CalObjInstance *icoi; - struct build_event_list_closure *c; - - c = data; - - icoi = g_new (CalObjInstance, 1); - - g_assert (ico->uid != NULL); - icoi->uid = g_strdup (ico->uid); - icoi->calobj = string_from_ical_object (c->backend, ico); - icoi->start = start; - icoi->end = end; - - c->event_list = g_list_prepend (c->event_list, icoi); - - return TRUE; -} - -/* Compares two CalObjInstance structures by their start times. Called from - * g_list_sort(). - */ -static gint -compare_instance_func (gconstpointer a, gconstpointer b) -{ - const CalObjInstance *ca, *cb; - time_t diff; - - ca = a; - cb = b; - - diff = ca->start - cb->start; - return (diff < 0) ? -1 : (diff > 0) ? 1 : 0; -} - -/** - * cal_backend_get_events_in_range: - * @backend: A calendar backend. - * @start: Start time for query. - * @end: End time for query. - * - * Builds a sorted list of calendar event object instances that occur or recur - * within the specified time range. Each object instance contains the object - * itself and the start/end times at which it occurs or recurs. - * - * Return value: A list of calendar event object instances, sorted by their - * start times. - **/ -GList * -cal_backend_get_events_in_range (CalBackend *backend, time_t start, time_t end) -{ - CalBackendPrivate *priv; - struct build_event_list_closure c; - GList *l; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - - g_return_val_if_fail (start != -1 && end != -1, NULL); - g_return_val_if_fail (start <= end, NULL); - - c.backend = backend; - c.event_list = NULL; - - for (l = priv->events; l; l = l->next) { - iCalObject *ico; - - ico = l->data; - ical_object_generate_events (ico, start, end, build_event_list, &c); - } - - c.event_list = g_list_sort (c.event_list, compare_instance_func); - return c.event_list; -} - -/* Notifies a backend's clients that an object was updated */ -static void -notify_update (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - GList *l; - - priv = backend->priv; - - for (l = priv->clients; l; l = l->next) { - Cal *cal; - - cal = CAL (l->data); - cal_notify_update (cal, uid); - } -} - -/* Notifies a backend's clients that an object was removed */ -static void -notify_remove (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - GList *l; - - priv = backend->priv; - - for (l = priv->clients; l; l = l->next) { - Cal *cal; - - cal = CAL (l->data); - cal_notify_remove (cal, uid); - } -} - -/** - * cal_backend_update_object: - * @backend: A calendar backend. - * @uid: Unique identifier of the object to update. - * @calobj: String representation of the new calendar object. - * - * Updates an object in a calendar backend. It will replace any existing object - * that has the same UID as the specified one. The backend will in turn notify - * all of its clients about the change. - * - * Return value: TRUE on success, FALSE on being passed an invalid object. - **/ -gboolean -cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj) -{ - CalBackendPrivate *priv; - iCalObject *ico, *new_ico; - CalObjFindStatus status; - - g_return_val_if_fail (backend != NULL, FALSE); - g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - g_return_val_if_fail (calobj != NULL, FALSE); - - /* Pull the object from the string */ - - status = ical_object_find_in_string (uid, calobj, &new_ico); - - if (status != CAL_OBJ_FIND_SUCCESS) - return FALSE; - - /* Update the object */ - - ico = lookup_object (backend, uid); - - if (ico) - remove_object (backend, ico); - - add_object (backend, new_ico); - - /* FIXME: do the notification asynchronously */ - - notify_update (backend, new_ico->uid); - return TRUE; -} - -/** - * cal_backend_remove_object: - * @backend: A calendar backend. - * @uid: Unique identifier of the object to remove. - * - * Removes an object in a calendar backend. The backend will notify all of its - * clients about the change. - * - * Return value: TRUE on success, FALSE on being passed an UID for an object - * that does not exist in the backend. - **/ -gboolean -cal_backend_remove_object (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - iCalObject *ico; - - g_return_val_if_fail (backend != NULL, FALSE); - g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - - ico = lookup_object (backend, uid); - if (!ico) - return FALSE; - - remove_object (backend, ico); - - /* FIXME: do the notification asynchronously */ - - notify_remove (backend, uid); - return TRUE; -} diff --git a/calendar/cal-backend.h b/calendar/cal-backend.h deleted file mode 100644 index 21c516126d..0000000000 --- a/calendar/cal-backend.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Evolution calendar backend - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_BACKEND_H -#define CAL_BACKEND_H - -#include -#include -#include "evolution-calendar.h" -#include "cal-common.h" -#include "cal.h" -#include "cal-util.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_BACKEND_TYPE (cal_backend_get_type ()) -#define CAL_BACKEND(obj) (GTK_CHECK_CAST ((obj), CAL_BACKEND_TYPE, CalBackend)) -#define CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_BACKEND_TYPE, \ - CalBackendClass)) -#define IS_CAL_BACKEND(obj) (GTK_CHECK_TYPE ((obj), CAL_BACKEND_TYPE)) -#define IS_CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_TYPE)) - -/* Load status values */ -typedef enum { - CAL_BACKEND_LOAD_SUCCESS, /* Loading OK */ - CAL_BACKEND_LOAD_ERROR /* We need better error reporting in libversit */ -} CalBackendLoadStatus; - -struct _CalBackend { - GtkObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalBackendClass { - GtkObjectClass parent_class; -}; - -typedef enum { - CAL_VCAL, - CAL_ICAL -} CalendarFormat; - -GtkType cal_backend_get_type (void); - -CalBackend *cal_backend_new (void); - -GnomeVFSURI *cal_backend_get_uri (CalBackend *backend); - -void cal_backend_add_cal (CalBackend *backend, Cal *cal); -void cal_backend_remove_cal (CalBackend *backend, Cal *cal); - -CalBackendLoadStatus cal_backend_load (CalBackend *backend, GnomeVFSURI *uri); - -void cal_backend_create (CalBackend *backend, GnomeVFSURI *uri); - -char *cal_backend_get_object (CalBackend *backend, const char *uid); - -GList *cal_backend_get_uids (CalBackend *backend, CalObjType type); - -GList *cal_backend_get_events_in_range (CalBackend *backend, time_t start, time_t end); - -gboolean cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj); - -gboolean cal_backend_remove_object (CalBackend *backend, const char *uid); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-client.c b/calendar/cal-client.c deleted file mode 100644 index ebf2b5cb31..0000000000 --- a/calendar/cal-client.c +++ /dev/null @@ -1,783 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include -#include "cal-client.h" -#include "cal-listener.h" - - - -/* Loading state for the calendar client */ -typedef enum { - LOAD_STATE_NOT_LOADED, - LOAD_STATE_LOADING, - LOAD_STATE_LOADED -} LoadState; - -/* Private part of the CalClient structure */ -typedef struct { - /* Load state to avoid multiple loads */ - LoadState load_state; - - /* The calendar factory we are contacting */ - Evolution_Calendar_CalFactory factory; - - /* Our calendar listener */ - CalListener *listener; - - /* The calendar client interface object we are contacting */ - Evolution_Calendar_Cal cal; -} CalClientPrivate; - - - -/* Signal IDs */ -enum { - CAL_LOADED, - OBJ_UPDATED, - OBJ_REMOVED, - LAST_SIGNAL -}; - -static void cal_client_class_init (CalClientClass *class); -static void cal_client_init (CalClient *client); -static void cal_client_destroy (GtkObject *object); - -static guint cal_client_signals[LAST_SIGNAL]; - -static GtkObjectClass *parent_class; - - - -/** - * cal_client_get_type: - * @void: - * - * Registers the #CalClient class if necessary, and returns the type ID assigned - * to it. - * - * Return value: The type ID of the #CalClient class. - **/ -GtkType -cal_client_get_type (void) -{ - static GtkType cal_client_type = 0; - - if (!cal_client_type) { - static const GtkTypeInfo cal_client_info = { - "CalClient", - sizeof (CalClient), - sizeof (CalClientClass), - (GtkClassInitFunc) cal_client_class_init, - (GtkObjectInitFunc) cal_client_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_client_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_client_info); - } - - return cal_client_type; -} - -/* Class initialization function for the calendar client */ -static void -cal_client_class_init (CalClientClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - cal_client_signals[CAL_LOADED] = - gtk_signal_new ("cal_loaded", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalClientClass, cal_loaded), - gtk_marshal_NONE__ENUM, - GTK_TYPE_NONE, 1, - GTK_TYPE_ENUM); - cal_client_signals[OBJ_UPDATED] = - gtk_signal_new ("obj_updated", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalClientClass, obj_updated), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - cal_client_signals[OBJ_REMOVED] = - gtk_signal_new ("obj_removed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalClientClass, obj_removed), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, cal_client_signals, LAST_SIGNAL); - - object_class->destroy = cal_client_destroy; -} - -/* Object initialization function for the calendar client */ -static void -cal_client_init (CalClient *client) -{ - CalClientPrivate *priv; - - priv = g_new0 (CalClientPrivate, 1); - client->priv = priv; - - priv->factory = CORBA_OBJECT_NIL; - priv->load_state = LOAD_STATE_NOT_LOADED; -} - -/* Gets rid of the factory that a client knows about */ -static void -destroy_factory (CalClient *client) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - int result; - - priv = client->priv; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (priv->factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("destroy_factory(): could not see if the factory was nil"); - priv->factory = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) - return; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("destroy_factory(): could not release the factory"); - - CORBA_exception_free (&ev); - priv->factory = CORBA_OBJECT_NIL; -} - -/* Gets rid of the listener that a client knows about */ -static void -destroy_listener (CalClient *client) -{ - CalClientPrivate *priv; - - priv = client->priv; - - if (!priv->listener) - return; - - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; -} - -/* Gets rid of the calendar client interface object that a client knows about */ -static void -destroy_cal (CalClient *client) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - int result; - - priv = client->priv; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (priv->cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("destroy_cal(): could not see if the " - "calendar client interface object was nil"); - priv->cal = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) - return; - - CORBA_exception_init (&ev); - Evolution_Calendar_Cal_unref (priv->cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("destroy_cal(): could not unref the calendar client interface object"); - - CORBA_exception_free (&ev); - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("destroy_cal(): could not release the calendar client interface object"); - - CORBA_exception_free (&ev); - priv->cal = CORBA_OBJECT_NIL; - -} - -/* Destroy handler for the calendar client */ -static void -cal_client_destroy (GtkObject *object) -{ - CalClient *client; - CalClientPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_CLIENT (object)); - - client = CAL_CLIENT (object); - priv = client->priv; - - destroy_factory (client); - destroy_listener (client); - destroy_cal (client); - - priv->load_state = LOAD_STATE_NOT_LOADED; - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* Signal handlers for the listener's signals */ - -/* Handle the cal_loaded signal from the listener */ -static void -cal_loaded_cb (CalListener *listener, - CalListenerLoadStatus status, - Evolution_Calendar_Cal cal, - gpointer data) -{ - CalClient *client; - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_Cal cal_copy; - CalClientLoadStatus client_status; - - client = CAL_CLIENT (data); - priv = client->priv; - - g_assert (priv->load_state == LOAD_STATE_LOADING); - - client_status = CAL_CLIENT_LOAD_ERROR; - - switch (status) { - case CAL_LISTENER_LOAD_SUCCESS: - CORBA_exception_init (&ev); - cal_copy = CORBA_Object_duplicate (cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_loaded(): could not duplicate the calendar client interface"); - CORBA_exception_free (&ev); - goto error; - } - CORBA_exception_free (&ev); - - priv->cal = cal_copy; - priv->load_state = LOAD_STATE_LOADED; - - client_status = CAL_CLIENT_LOAD_SUCCESS; - goto out; - - case CAL_LISTENER_LOAD_ERROR: - client_status = CAL_CLIENT_LOAD_ERROR; - goto error; - - case CAL_LISTENER_LOAD_IN_USE: - client_status = CAL_CLIENT_LOAD_IN_USE; - goto error; - - default: - g_assert_not_reached (); - } - - error: - - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; - priv->load_state = LOAD_STATE_NOT_LOADED; - - out: - - g_assert (priv->load_state != LOAD_STATE_LOADING); - - gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_LOADED], - client_status); -} - -/* Handle the obj_updated signal from the listener */ -static void -obj_updated_cb (CalListener *listener, const Evolution_Calendar_CalObjUID uid, gpointer data) -{ - CalClient *client; - - client = CAL_CLIENT (data); - gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_UPDATED], uid); -} - -/* Handle the obj_removed signal from the listener */ -static void -obj_removed_cb (CalListener *listener, const Evolution_Calendar_CalObjUID uid, gpointer data) -{ - CalClient *client; - - client = CAL_CLIENT (data); - gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_REMOVED], uid); -} - - - -/** - * cal_client_construct: - * @client: A calendar client. - * - * Constructs a calendar client object by contacting the calendar factory of the - * calendar server. - * - * Return value: The same object as the @client argument, or NULL if the - * calendar factory could not be contacted. - **/ -CalClient * -cal_client_construct (CalClient *client) -{ - CalClientPrivate *priv; - Evolution_Calendar_CalFactory factory, factory_copy; - CORBA_Environment ev; - int result; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - - factory = (Evolution_Calendar_CalFactory) goad_server_activate_with_id ( - NULL, - "evolution:calendar-factory", - GOAD_ACTIVATE_REMOTE, - NULL); - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_construct(): could not see if the factory is NIL"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - if (result) { - g_message ("cal_client_construct(): could not contact Tlacuache, " - "the personal calendar server"); - return NULL; - } - - CORBA_exception_init (&ev); - factory_copy = CORBA_Object_duplicate (factory, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_construct(): could not duplicate the calendar factory"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - priv->factory = factory_copy; - return client; -} - -/** - * cal_client_new: - * @void: - * - * Creates a new calendar client. It should be initialized by calling - * cal_client_load_calendar() or cal_client_create_calendar(). - * - * Return value: A newly-created calendar client, or NULL if the client could - * not be constructed because it could not contact the calendar server. - **/ -CalClient * -cal_client_new (void) -{ - CalClient *client; - - client = gtk_type_new (CAL_CLIENT_TYPE); - - if (!cal_client_construct (client)) { - g_message ("cal_client_new(): could not construct the calendar client"); - gtk_object_unref (GTK_OBJECT (client)); - return NULL; - } - - return client; -} - -/* Issues a load or create request */ -static gboolean -load_or_create (CalClient *client, const char *str_uri, gboolean load) -{ - CalClientPrivate *priv; - Evolution_Calendar_Listener corba_listener; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_NOT_LOADED, FALSE); - - g_return_val_if_fail (str_uri != NULL, FALSE); - - priv->listener = cal_listener_new (); - if (!priv->listener) { - g_message ("load_or_create(): could not create the listener"); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (priv->listener), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), - client); - gtk_signal_connect (GTK_OBJECT (priv->listener), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated_cb), - client); - gtk_signal_connect (GTK_OBJECT (priv->listener), "obj_removed", - GTK_SIGNAL_FUNC (obj_removed_cb), - client); - - corba_listener = (Evolution_Calendar_Listener) bonobo_object_corba_objref ( - BONOBO_OBJECT (priv->listener)); - - CORBA_exception_init (&ev); - - priv->load_state = LOAD_STATE_LOADING; - - if (load) - Evolution_Calendar_CalFactory_load (priv->factory, str_uri, corba_listener, &ev); - else - Evolution_Calendar_CalFactory_create (priv->factory, str_uri, corba_listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("load_or_create(): load/create request failed"); - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; - priv->load_state = LOAD_STATE_NOT_LOADED; - CORBA_exception_free (&ev); - return FALSE; - } - CORBA_exception_free (&ev); - - return TRUE; -} - -/** - * cal_client_load_calendar: - * @client: A calendar client. - * @str_uri: URI of calendar to load. - * - * Makes a calendar client initiate a request to load a calendar. The calendar - * client will emit the "cal_loaded" signal when the response from the server is - * received. - * - * Return value: TRUE on success, FALSE on failure to issue the load request. - **/ -gboolean -cal_client_load_calendar (CalClient *client, const char *str_uri) -{ - return load_or_create (client, str_uri, TRUE); -} - -/** - * cal_client_create_calendar: - * @client: A calendar client. - * @str_uri: URI that will contain the calendar data. - * - * Makes a calendar client initiate a request to create a new calendar. The - * calendar client will emit the "cal_loaded" signal when the response from the - * server is received. - * - * Return value: TRUE on success, FALSE on failure to issue the create request. - **/ -gboolean -cal_client_create_calendar (CalClient *client, const char *str_uri) -{ - return load_or_create (client, str_uri, FALSE); -} - -/** - * cal_client_get_object: - * @client: A calendar client. - * @uid: Unique identifier for a calendar object. - * - * Queries a calendar for a calendar object based on its unique identifier. - * - * Return value: The string representation of a complete calendar wrapping the - * sought object, or NULL if no object had the specified UID. A complete - * calendar is returned because you also need the timezone data. - **/ -char * -cal_client_get_object (CalClient *client, const char *uid) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_CalObj calobj; - char *retval; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); - - g_return_val_if_fail (uid != NULL, NULL); - - retval = NULL; - - CORBA_exception_init (&ev); - calobj = Evolution_Calendar_Cal_get_object (priv->cal, uid, &ev); - - if (ev._major == CORBA_USER_EXCEPTION - && strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_NotFound) == 0) - goto out; - else if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_get_object(): could not get the object"); - goto out; - } - - retval = g_strdup (calobj); - CORBA_free (calobj); - - out: - CORBA_exception_free (&ev); - return retval; -} - -/** - * cal_client_get_uids: - * @client: A calendar client. - * @type: Bitmask with types of objects to return. - * - * Queries a calendar for a list of unique identifiers corresponding to calendar - * objects whose type matches one of the types specified in the @type flags. - * - * Return value: A list of strings that are the sought UIDs. - **/ -GList * -cal_client_get_uids (CalClient *client, CalObjType type) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_CalObjUIDSeq *seq; - int t; - GList *uids; - int i; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); - - t = (((type & CALOBJ_TYPE_EVENT) ? Evolution_Calendar_TYPE_EVENT : 0) - | ((type & CALOBJ_TYPE_TODO) ? Evolution_Calendar_TYPE_TODO : 0) - | ((type & CALOBJ_TYPE_JOURNAL) ? Evolution_Calendar_TYPE_JOURNAL : 0) - | ((type & CALOBJ_TYPE_OTHER) ? Evolution_Calendar_TYPE_OTHER : 0) - | ((type & CALOBJ_TYPE_ANY) ? Evolution_Calendar_TYPE_ANY : 0)); - - CORBA_exception_init (&ev); - - seq = Evolution_Calendar_Cal_get_uids (priv->cal, t, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_get_uids(): could not get the list of UIDs"); - CORBA_exception_free (&ev); - return NULL; - } - - /* Create the list */ - - uids = NULL; - - for (i = 0; i < seq->_length; i++) - uids = g_list_prepend (uids, g_strdup (seq->_buffer[i])); - - CORBA_free (seq); - - return uids; -} - -/** - * cal_client_get_events_in_range: - * @client: A calendar client. - * @start: Start time for query. - * @end: End time for query. - * - * Queries a calendar for the events that occur or recur in the specified range - * of time. - * - * Return value: A list of #CalObjInstance structures. - **/ -GList * -cal_client_get_events_in_range (CalClient *client, time_t start, time_t end) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_CalObjInstanceSeq *seq; - GList *elist; - int i; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); - - g_return_val_if_fail (start != -1 && end != -1, NULL); - g_return_val_if_fail (start <= end, NULL); - - priv = client->priv; - - CORBA_exception_init (&ev); - - seq = Evolution_Calendar_Cal_get_events_in_range (priv->cal, start, end, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_get_events_in_range(): could not get the event range"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - /* Create the list in reverse order */ - - elist = NULL; - - for (i = 0; i < seq->_length; i++) { - Evolution_Calendar_CalObjInstance *corba_icoi; - CalObjInstance *icoi; - - corba_icoi = &seq->_buffer[i]; - icoi = g_new (CalObjInstance, 1); - - icoi->uid = g_strdup (corba_icoi->uid); - icoi->calobj = g_strdup (corba_icoi->calobj); - icoi->start = corba_icoi->start; - icoi->end = corba_icoi->end; - - elist = g_list_prepend (elist, icoi); - } - - CORBA_free (seq); - elist = g_list_reverse (elist); - - return elist; -} - -/** - * cal_client_update_object: - * @client: A calendar client. - * @uid: Unique identifier of object to update. - * @calobj: String representation of the new calendar object. - * - * Asks a calendar to update an object based on its UID. Any existing object - * with the specified UID will be replaced. The client program should not - * assume that the object is actually in the server's storage until it has - * received the "obj_updated" notification signal. - * - * Return value: TRUE on success, FALSE on specifying an invalid object. - **/ -gboolean -cal_client_update_object (CalClient *client, const char *uid, const char *calobj) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - gboolean retval; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - g_return_val_if_fail (calobj != NULL, FALSE); - - retval = FALSE; - - CORBA_exception_init (&ev); - Evolution_Calendar_Cal_update_object (priv->cal, uid, calobj, &ev); - - if (ev._major == CORBA_USER_EXCEPTION && - strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_InvalidObject) == 0) - goto out; - else if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_update_object(): could not update the object"); - goto out; - } - - retval = TRUE; - - out: - CORBA_exception_free (&ev); - return retval; -} - -gboolean -cal_client_remove_object (CalClient *client, const char *uid) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - gboolean retval; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - - retval = FALSE; - - CORBA_exception_init (&ev); - Evolution_Calendar_Cal_remove_object (priv->cal, uid, &ev); - - if (ev._major == CORBA_USER_EXCEPTION && - strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_NotFound) == 0) - goto out; - else if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_remove_object(): could not remove the object"); - goto out; - } - - retval = TRUE; - - out: - CORBA_exception_free (&ev); - return retval; -} diff --git a/calendar/cal-client.h b/calendar/cal-client.h deleted file mode 100644 index 7b5c66e510..0000000000 --- a/calendar/cal-client.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_CLIENT_H -#define CAL_CLIENT_H - -#include -#include -#include "cal-util.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_CLIENT_TYPE (cal_client_get_type ()) -#define CAL_CLIENT(obj) (GTK_CHECK_CAST ((obj), CAL_CLIENT_TYPE, CalClient)) -#define CAL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_CLIENT_TYPE, CalClientClass)) -#define IS_CAL_CLIENT(obj) (GTK_CHECK_TYPE ((obj), CAL_CLIENT_TYPE)) -#define IS_CAL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_TYPE)) - -typedef struct _CalClient CalClient; -typedef struct _CalClientClass CalClientClass; - -/* Load status for the cal_loaded signal */ -typedef enum { - CAL_CLIENT_LOAD_SUCCESS, - CAL_CLIENT_LOAD_ERROR, - CAL_CLIENT_LOAD_IN_USE -} CalClientLoadStatus; - -struct _CalClient { - GtkObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalClientClass { - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* cal_loaded) (CalClient *client, CalClientLoadStatus status); - - void (* obj_updated) (CalClient *client, const char *uid); - void (* obj_removed) (CalClient *client, const char *uid); -}; - -GtkType cal_client_get_type (void); - -CalClient *cal_client_construct (CalClient *client); - -CalClient *cal_client_new (void); - -gboolean cal_client_load_calendar (CalClient *client, const char *str_uri); -gboolean cal_client_create_calendar (CalClient *client, const char *str_uri); - -char *cal_client_get_object (CalClient *client, const char *uid); - -GList *cal_client_get_uids (CalClient *client, CalObjType type); - -GList *cal_client_get_events_in_range (CalClient *client, time_t start, time_t end); - -gboolean cal_client_update_object (CalClient *client, const char *uid, const char *calobj); - -gboolean cal_client_remove_object (CalClient *client, const char *uid); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c deleted file mode 100644 index ebf2b5cb31..0000000000 --- a/calendar/cal-client/cal-client.c +++ /dev/null @@ -1,783 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include -#include "cal-client.h" -#include "cal-listener.h" - - - -/* Loading state for the calendar client */ -typedef enum { - LOAD_STATE_NOT_LOADED, - LOAD_STATE_LOADING, - LOAD_STATE_LOADED -} LoadState; - -/* Private part of the CalClient structure */ -typedef struct { - /* Load state to avoid multiple loads */ - LoadState load_state; - - /* The calendar factory we are contacting */ - Evolution_Calendar_CalFactory factory; - - /* Our calendar listener */ - CalListener *listener; - - /* The calendar client interface object we are contacting */ - Evolution_Calendar_Cal cal; -} CalClientPrivate; - - - -/* Signal IDs */ -enum { - CAL_LOADED, - OBJ_UPDATED, - OBJ_REMOVED, - LAST_SIGNAL -}; - -static void cal_client_class_init (CalClientClass *class); -static void cal_client_init (CalClient *client); -static void cal_client_destroy (GtkObject *object); - -static guint cal_client_signals[LAST_SIGNAL]; - -static GtkObjectClass *parent_class; - - - -/** - * cal_client_get_type: - * @void: - * - * Registers the #CalClient class if necessary, and returns the type ID assigned - * to it. - * - * Return value: The type ID of the #CalClient class. - **/ -GtkType -cal_client_get_type (void) -{ - static GtkType cal_client_type = 0; - - if (!cal_client_type) { - static const GtkTypeInfo cal_client_info = { - "CalClient", - sizeof (CalClient), - sizeof (CalClientClass), - (GtkClassInitFunc) cal_client_class_init, - (GtkObjectInitFunc) cal_client_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_client_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_client_info); - } - - return cal_client_type; -} - -/* Class initialization function for the calendar client */ -static void -cal_client_class_init (CalClientClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - cal_client_signals[CAL_LOADED] = - gtk_signal_new ("cal_loaded", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalClientClass, cal_loaded), - gtk_marshal_NONE__ENUM, - GTK_TYPE_NONE, 1, - GTK_TYPE_ENUM); - cal_client_signals[OBJ_UPDATED] = - gtk_signal_new ("obj_updated", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalClientClass, obj_updated), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - cal_client_signals[OBJ_REMOVED] = - gtk_signal_new ("obj_removed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalClientClass, obj_removed), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, cal_client_signals, LAST_SIGNAL); - - object_class->destroy = cal_client_destroy; -} - -/* Object initialization function for the calendar client */ -static void -cal_client_init (CalClient *client) -{ - CalClientPrivate *priv; - - priv = g_new0 (CalClientPrivate, 1); - client->priv = priv; - - priv->factory = CORBA_OBJECT_NIL; - priv->load_state = LOAD_STATE_NOT_LOADED; -} - -/* Gets rid of the factory that a client knows about */ -static void -destroy_factory (CalClient *client) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - int result; - - priv = client->priv; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (priv->factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("destroy_factory(): could not see if the factory was nil"); - priv->factory = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) - return; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("destroy_factory(): could not release the factory"); - - CORBA_exception_free (&ev); - priv->factory = CORBA_OBJECT_NIL; -} - -/* Gets rid of the listener that a client knows about */ -static void -destroy_listener (CalClient *client) -{ - CalClientPrivate *priv; - - priv = client->priv; - - if (!priv->listener) - return; - - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; -} - -/* Gets rid of the calendar client interface object that a client knows about */ -static void -destroy_cal (CalClient *client) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - int result; - - priv = client->priv; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (priv->cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("destroy_cal(): could not see if the " - "calendar client interface object was nil"); - priv->cal = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) - return; - - CORBA_exception_init (&ev); - Evolution_Calendar_Cal_unref (priv->cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("destroy_cal(): could not unref the calendar client interface object"); - - CORBA_exception_free (&ev); - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("destroy_cal(): could not release the calendar client interface object"); - - CORBA_exception_free (&ev); - priv->cal = CORBA_OBJECT_NIL; - -} - -/* Destroy handler for the calendar client */ -static void -cal_client_destroy (GtkObject *object) -{ - CalClient *client; - CalClientPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_CLIENT (object)); - - client = CAL_CLIENT (object); - priv = client->priv; - - destroy_factory (client); - destroy_listener (client); - destroy_cal (client); - - priv->load_state = LOAD_STATE_NOT_LOADED; - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* Signal handlers for the listener's signals */ - -/* Handle the cal_loaded signal from the listener */ -static void -cal_loaded_cb (CalListener *listener, - CalListenerLoadStatus status, - Evolution_Calendar_Cal cal, - gpointer data) -{ - CalClient *client; - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_Cal cal_copy; - CalClientLoadStatus client_status; - - client = CAL_CLIENT (data); - priv = client->priv; - - g_assert (priv->load_state == LOAD_STATE_LOADING); - - client_status = CAL_CLIENT_LOAD_ERROR; - - switch (status) { - case CAL_LISTENER_LOAD_SUCCESS: - CORBA_exception_init (&ev); - cal_copy = CORBA_Object_duplicate (cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_loaded(): could not duplicate the calendar client interface"); - CORBA_exception_free (&ev); - goto error; - } - CORBA_exception_free (&ev); - - priv->cal = cal_copy; - priv->load_state = LOAD_STATE_LOADED; - - client_status = CAL_CLIENT_LOAD_SUCCESS; - goto out; - - case CAL_LISTENER_LOAD_ERROR: - client_status = CAL_CLIENT_LOAD_ERROR; - goto error; - - case CAL_LISTENER_LOAD_IN_USE: - client_status = CAL_CLIENT_LOAD_IN_USE; - goto error; - - default: - g_assert_not_reached (); - } - - error: - - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; - priv->load_state = LOAD_STATE_NOT_LOADED; - - out: - - g_assert (priv->load_state != LOAD_STATE_LOADING); - - gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_LOADED], - client_status); -} - -/* Handle the obj_updated signal from the listener */ -static void -obj_updated_cb (CalListener *listener, const Evolution_Calendar_CalObjUID uid, gpointer data) -{ - CalClient *client; - - client = CAL_CLIENT (data); - gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_UPDATED], uid); -} - -/* Handle the obj_removed signal from the listener */ -static void -obj_removed_cb (CalListener *listener, const Evolution_Calendar_CalObjUID uid, gpointer data) -{ - CalClient *client; - - client = CAL_CLIENT (data); - gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_REMOVED], uid); -} - - - -/** - * cal_client_construct: - * @client: A calendar client. - * - * Constructs a calendar client object by contacting the calendar factory of the - * calendar server. - * - * Return value: The same object as the @client argument, or NULL if the - * calendar factory could not be contacted. - **/ -CalClient * -cal_client_construct (CalClient *client) -{ - CalClientPrivate *priv; - Evolution_Calendar_CalFactory factory, factory_copy; - CORBA_Environment ev; - int result; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - - factory = (Evolution_Calendar_CalFactory) goad_server_activate_with_id ( - NULL, - "evolution:calendar-factory", - GOAD_ACTIVATE_REMOTE, - NULL); - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_construct(): could not see if the factory is NIL"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - if (result) { - g_message ("cal_client_construct(): could not contact Tlacuache, " - "the personal calendar server"); - return NULL; - } - - CORBA_exception_init (&ev); - factory_copy = CORBA_Object_duplicate (factory, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_construct(): could not duplicate the calendar factory"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - priv->factory = factory_copy; - return client; -} - -/** - * cal_client_new: - * @void: - * - * Creates a new calendar client. It should be initialized by calling - * cal_client_load_calendar() or cal_client_create_calendar(). - * - * Return value: A newly-created calendar client, or NULL if the client could - * not be constructed because it could not contact the calendar server. - **/ -CalClient * -cal_client_new (void) -{ - CalClient *client; - - client = gtk_type_new (CAL_CLIENT_TYPE); - - if (!cal_client_construct (client)) { - g_message ("cal_client_new(): could not construct the calendar client"); - gtk_object_unref (GTK_OBJECT (client)); - return NULL; - } - - return client; -} - -/* Issues a load or create request */ -static gboolean -load_or_create (CalClient *client, const char *str_uri, gboolean load) -{ - CalClientPrivate *priv; - Evolution_Calendar_Listener corba_listener; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_NOT_LOADED, FALSE); - - g_return_val_if_fail (str_uri != NULL, FALSE); - - priv->listener = cal_listener_new (); - if (!priv->listener) { - g_message ("load_or_create(): could not create the listener"); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (priv->listener), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), - client); - gtk_signal_connect (GTK_OBJECT (priv->listener), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated_cb), - client); - gtk_signal_connect (GTK_OBJECT (priv->listener), "obj_removed", - GTK_SIGNAL_FUNC (obj_removed_cb), - client); - - corba_listener = (Evolution_Calendar_Listener) bonobo_object_corba_objref ( - BONOBO_OBJECT (priv->listener)); - - CORBA_exception_init (&ev); - - priv->load_state = LOAD_STATE_LOADING; - - if (load) - Evolution_Calendar_CalFactory_load (priv->factory, str_uri, corba_listener, &ev); - else - Evolution_Calendar_CalFactory_create (priv->factory, str_uri, corba_listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("load_or_create(): load/create request failed"); - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; - priv->load_state = LOAD_STATE_NOT_LOADED; - CORBA_exception_free (&ev); - return FALSE; - } - CORBA_exception_free (&ev); - - return TRUE; -} - -/** - * cal_client_load_calendar: - * @client: A calendar client. - * @str_uri: URI of calendar to load. - * - * Makes a calendar client initiate a request to load a calendar. The calendar - * client will emit the "cal_loaded" signal when the response from the server is - * received. - * - * Return value: TRUE on success, FALSE on failure to issue the load request. - **/ -gboolean -cal_client_load_calendar (CalClient *client, const char *str_uri) -{ - return load_or_create (client, str_uri, TRUE); -} - -/** - * cal_client_create_calendar: - * @client: A calendar client. - * @str_uri: URI that will contain the calendar data. - * - * Makes a calendar client initiate a request to create a new calendar. The - * calendar client will emit the "cal_loaded" signal when the response from the - * server is received. - * - * Return value: TRUE on success, FALSE on failure to issue the create request. - **/ -gboolean -cal_client_create_calendar (CalClient *client, const char *str_uri) -{ - return load_or_create (client, str_uri, FALSE); -} - -/** - * cal_client_get_object: - * @client: A calendar client. - * @uid: Unique identifier for a calendar object. - * - * Queries a calendar for a calendar object based on its unique identifier. - * - * Return value: The string representation of a complete calendar wrapping the - * sought object, or NULL if no object had the specified UID. A complete - * calendar is returned because you also need the timezone data. - **/ -char * -cal_client_get_object (CalClient *client, const char *uid) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_CalObj calobj; - char *retval; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); - - g_return_val_if_fail (uid != NULL, NULL); - - retval = NULL; - - CORBA_exception_init (&ev); - calobj = Evolution_Calendar_Cal_get_object (priv->cal, uid, &ev); - - if (ev._major == CORBA_USER_EXCEPTION - && strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_NotFound) == 0) - goto out; - else if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_get_object(): could not get the object"); - goto out; - } - - retval = g_strdup (calobj); - CORBA_free (calobj); - - out: - CORBA_exception_free (&ev); - return retval; -} - -/** - * cal_client_get_uids: - * @client: A calendar client. - * @type: Bitmask with types of objects to return. - * - * Queries a calendar for a list of unique identifiers corresponding to calendar - * objects whose type matches one of the types specified in the @type flags. - * - * Return value: A list of strings that are the sought UIDs. - **/ -GList * -cal_client_get_uids (CalClient *client, CalObjType type) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_CalObjUIDSeq *seq; - int t; - GList *uids; - int i; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); - - t = (((type & CALOBJ_TYPE_EVENT) ? Evolution_Calendar_TYPE_EVENT : 0) - | ((type & CALOBJ_TYPE_TODO) ? Evolution_Calendar_TYPE_TODO : 0) - | ((type & CALOBJ_TYPE_JOURNAL) ? Evolution_Calendar_TYPE_JOURNAL : 0) - | ((type & CALOBJ_TYPE_OTHER) ? Evolution_Calendar_TYPE_OTHER : 0) - | ((type & CALOBJ_TYPE_ANY) ? Evolution_Calendar_TYPE_ANY : 0)); - - CORBA_exception_init (&ev); - - seq = Evolution_Calendar_Cal_get_uids (priv->cal, t, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_get_uids(): could not get the list of UIDs"); - CORBA_exception_free (&ev); - return NULL; - } - - /* Create the list */ - - uids = NULL; - - for (i = 0; i < seq->_length; i++) - uids = g_list_prepend (uids, g_strdup (seq->_buffer[i])); - - CORBA_free (seq); - - return uids; -} - -/** - * cal_client_get_events_in_range: - * @client: A calendar client. - * @start: Start time for query. - * @end: End time for query. - * - * Queries a calendar for the events that occur or recur in the specified range - * of time. - * - * Return value: A list of #CalObjInstance structures. - **/ -GList * -cal_client_get_events_in_range (CalClient *client, time_t start, time_t end) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - Evolution_Calendar_CalObjInstanceSeq *seq; - GList *elist; - int i; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL); - - g_return_val_if_fail (start != -1 && end != -1, NULL); - g_return_val_if_fail (start <= end, NULL); - - priv = client->priv; - - CORBA_exception_init (&ev); - - seq = Evolution_Calendar_Cal_get_events_in_range (priv->cal, start, end, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_get_events_in_range(): could not get the event range"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - /* Create the list in reverse order */ - - elist = NULL; - - for (i = 0; i < seq->_length; i++) { - Evolution_Calendar_CalObjInstance *corba_icoi; - CalObjInstance *icoi; - - corba_icoi = &seq->_buffer[i]; - icoi = g_new (CalObjInstance, 1); - - icoi->uid = g_strdup (corba_icoi->uid); - icoi->calobj = g_strdup (corba_icoi->calobj); - icoi->start = corba_icoi->start; - icoi->end = corba_icoi->end; - - elist = g_list_prepend (elist, icoi); - } - - CORBA_free (seq); - elist = g_list_reverse (elist); - - return elist; -} - -/** - * cal_client_update_object: - * @client: A calendar client. - * @uid: Unique identifier of object to update. - * @calobj: String representation of the new calendar object. - * - * Asks a calendar to update an object based on its UID. Any existing object - * with the specified UID will be replaced. The client program should not - * assume that the object is actually in the server's storage until it has - * received the "obj_updated" notification signal. - * - * Return value: TRUE on success, FALSE on specifying an invalid object. - **/ -gboolean -cal_client_update_object (CalClient *client, const char *uid, const char *calobj) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - gboolean retval; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - g_return_val_if_fail (calobj != NULL, FALSE); - - retval = FALSE; - - CORBA_exception_init (&ev); - Evolution_Calendar_Cal_update_object (priv->cal, uid, calobj, &ev); - - if (ev._major == CORBA_USER_EXCEPTION && - strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_InvalidObject) == 0) - goto out; - else if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_update_object(): could not update the object"); - goto out; - } - - retval = TRUE; - - out: - CORBA_exception_free (&ev); - return retval; -} - -gboolean -cal_client_remove_object (CalClient *client, const char *uid) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - gboolean retval; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - - retval = FALSE; - - CORBA_exception_init (&ev); - Evolution_Calendar_Cal_remove_object (priv->cal, uid, &ev); - - if (ev._major == CORBA_USER_EXCEPTION && - strcmp (CORBA_exception_id (&ev), ex_Evolution_Calendar_Cal_NotFound) == 0) - goto out; - else if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_client_remove_object(): could not remove the object"); - goto out; - } - - retval = TRUE; - - out: - CORBA_exception_free (&ev); - return retval; -} diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h deleted file mode 100644 index 7b5c66e510..0000000000 --- a/calendar/cal-client/cal-client.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_CLIENT_H -#define CAL_CLIENT_H - -#include -#include -#include "cal-util.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_CLIENT_TYPE (cal_client_get_type ()) -#define CAL_CLIENT(obj) (GTK_CHECK_CAST ((obj), CAL_CLIENT_TYPE, CalClient)) -#define CAL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_CLIENT_TYPE, CalClientClass)) -#define IS_CAL_CLIENT(obj) (GTK_CHECK_TYPE ((obj), CAL_CLIENT_TYPE)) -#define IS_CAL_CLIENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_TYPE)) - -typedef struct _CalClient CalClient; -typedef struct _CalClientClass CalClientClass; - -/* Load status for the cal_loaded signal */ -typedef enum { - CAL_CLIENT_LOAD_SUCCESS, - CAL_CLIENT_LOAD_ERROR, - CAL_CLIENT_LOAD_IN_USE -} CalClientLoadStatus; - -struct _CalClient { - GtkObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalClientClass { - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* cal_loaded) (CalClient *client, CalClientLoadStatus status); - - void (* obj_updated) (CalClient *client, const char *uid); - void (* obj_removed) (CalClient *client, const char *uid); -}; - -GtkType cal_client_get_type (void); - -CalClient *cal_client_construct (CalClient *client); - -CalClient *cal_client_new (void); - -gboolean cal_client_load_calendar (CalClient *client, const char *str_uri); -gboolean cal_client_create_calendar (CalClient *client, const char *str_uri); - -char *cal_client_get_object (CalClient *client, const char *uid); - -GList *cal_client_get_uids (CalClient *client, CalObjType type); - -GList *cal_client_get_events_in_range (CalClient *client, time_t start, time_t end); - -gboolean cal_client_update_object (CalClient *client, const char *uid, const char *calobj); - -gboolean cal_client_remove_object (CalClient *client, const char *uid); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c deleted file mode 100644 index 2c875c4c38..0000000000 --- a/calendar/cal-client/cal-listener.c +++ /dev/null @@ -1,421 +0,0 @@ -/* Evolution calendar listener - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal-listener.h" - - - -/* Private part of the CalListener structure */ -typedef struct { - /* The calendar this listener refers to */ - Evolution_Calendar_Cal cal; -} CalListenerPrivate; - - - -/* Signal IDs */ -enum { - CAL_LOADED, - OBJ_UPDATED, - OBJ_REMOVED, - LAST_SIGNAL -}; - -static void cal_listener_class_init (CalListenerClass *class); -static void cal_listener_init (CalListener *listener); -static void cal_listener_destroy (GtkObject *object); - -static void marshal_cal_loaded (GtkObject *object, GtkSignalFunc func, gpointer data, GtkArg *args); - -static POA_Evolution_Calendar_Listener__vepv cal_listener_vepv; - -static guint cal_listener_signals[LAST_SIGNAL]; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_listener_get_type: - * @void: - * - * Registers the #CalListener class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalListener class. - **/ -GtkType -cal_listener_get_type (void) -{ - static GtkType cal_listener_type = 0; - - if (!cal_listener_type) { - static const GtkTypeInfo cal_listener_info = { - "CalListener", - sizeof (CalListener), - sizeof (CalListenerClass), - (GtkClassInitFunc) cal_listener_class_init, - (GtkObjectInitFunc) cal_listener_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_listener_type = gtk_type_unique (bonobo_object_get_type (), &cal_listener_info); - } - - return cal_listener_type; -} - -/* CORBA class initialization function for the calendar listener */ -static void -init_cal_listener_corba_class (void) -{ - cal_listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_listener_vepv.Evolution_Calendar_Listener_epv = cal_listener_get_epv (); -} - -/* Class initialization function for the calendar listener */ -static void -cal_listener_class_init (CalListenerClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - cal_listener_signals[CAL_LOADED] = - gtk_signal_new ("cal_loaded", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalListenerClass, cal_loaded), - marshal_cal_loaded, - GTK_TYPE_NONE, 2, - GTK_TYPE_ENUM, - GTK_TYPE_POINTER); - cal_listener_signals[OBJ_UPDATED] = - gtk_signal_new ("obj_updated", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalListenerClass, obj_updated), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - cal_listener_signals[OBJ_REMOVED] = - gtk_signal_new ("obj_removed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalListenerClass, obj_removed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, cal_listener_signals, LAST_SIGNAL); - - object_class->destroy = cal_listener_destroy; - - init_cal_listener_corba_class (); -} - -/* Object initialization function for the calendar listener */ -static void -cal_listener_init (CalListener *listener) -{ - CalListenerPrivate *priv; - - priv = g_new0 (CalListenerPrivate, 1); - listener->priv = priv; - - priv->cal = CORBA_OBJECT_NIL; -} - -/* Destroy handler for the calendar listener */ -static void -cal_listener_destroy (GtkObject *object) -{ - CalListener *listener; - CalListenerPrivate *priv; - CORBA_Environment ev; - gboolean result; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_LISTENER (object)); - - listener = CAL_LISTENER (object); - priv = listener->priv; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (priv->cal, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_listener_destroy(): could not see if the calendar was NIL"); - else if (!result) { - CORBA_exception_free (&ev); - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->cal, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_listener_destroy(): could not release the calendar"); - - priv->cal = CORBA_OBJECT_NIL; - } - CORBA_exception_free (&ev); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* Marshalers */ - -typedef void (* CalLoadedFunc) (GtkObject *object, gint status, gpointer cal, gpointer data); - -static void -marshal_cal_loaded (GtkObject *object, GtkSignalFunc func, gpointer data, GtkArg *args) -{ - CalLoadedFunc rfunc; - - rfunc = (CalLoadedFunc) func; - (* rfunc) (object, GTK_VALUE_ENUM (args[0]), GTK_VALUE_POINTER (args[1]), data); -} - - - -/* CORBA servant implementation */ - -/* Listener::cal_loaded method */ -static void -Listener_cal_loaded (PortableServer_Servant servant, - Evolution_Calendar_Listener_LoadStatus status, - Evolution_Calendar_Cal cal, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - CORBA_Environment aev; - Evolution_Calendar_Cal cal_copy; - CalListenerLoadStatus load_status; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (priv->cal != CORBA_OBJECT_NIL) { - g_message ("Listener_cal_loaded(): calendar was already loaded!"); - return; - } - - CORBA_exception_init (&aev); - cal_copy = CORBA_Object_duplicate (cal, &aev); - - if (aev._major != CORBA_NO_EXCEPTION) { - g_message ("Listener_cal_loaded(): could not duplicate the calendar"); - CORBA_exception_free (&aev); - return; - } - CORBA_exception_free (&aev); - - priv->cal = cal_copy; - - switch (status) { - case Evolution_Calendar_Listener_SUCCESS: - load_status = CAL_LISTENER_LOAD_SUCCESS; - break; - - case Evolution_Calendar_Listener_ERROR: - load_status = CAL_LISTENER_LOAD_ERROR; - break; - - case Evolution_Calendar_Listener_IN_USE: - load_status = CAL_LISTENER_LOAD_IN_USE; - break; - - default: - load_status = CAL_LISTENER_LOAD_ERROR; /* keep gcc happy */ - g_assert_not_reached (); - } - - gtk_signal_emit (GTK_OBJECT (listener), cal_listener_signals[CAL_LOADED], - load_status, cal); -} - -/* Listener::obj_updated method */ -static void -Listener_obj_updated (PortableServer_Servant servant, - Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - CalListener *listener; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - gtk_signal_emit (GTK_OBJECT (listener), cal_listener_signals[OBJ_UPDATED], - uid); -} - -/* Listener::obj_removed method */ -static void -Listener_obj_removed (PortableServer_Servant servant, - Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - CalListener *listener; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - gtk_signal_emit (GTK_OBJECT (listener), cal_listener_signals[OBJ_REMOVED], - uid); -} - -/** - * cal_listener_get_epv: - * @void: - * - * Creates an EPV for the Listener CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_Listener__epv * -cal_listener_get_epv (void) -{ - POA_Evolution_Calendar_Listener__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_Listener__epv, 1); - epv->cal_loaded = Listener_cal_loaded; - epv->obj_updated = Listener_obj_updated; - epv->obj_removed = Listener_obj_removed; - return epv; -} - - - -/** - * cal_listener_construct: - * @listener: A calendar listener. - * @corba_listener: CORBA object for the calendar listener. - * - * Constructs a calendar listener by binding the corresponding CORBA object to - * it. - * - * Return value: the same object as the @listener argument. - **/ -CalListener * -cal_listener_construct (CalListener *listener, Evolution_Calendar_Listener corba_listener) -{ - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (IS_CAL_LISTENER (listener), NULL); - - bonobo_object_construct (BONOBO_OBJECT (listener), corba_listener); - return listener; -} - -/** - * cal_listener_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar listener @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_Listener -cal_listener_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_Listener *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL_LISTENER (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_Listener *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_listener_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_Listener__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_Listener) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_listener_new: - * @void: - * - * Creates a new #CalListener object. - * - * Return value: A newly-created #CalListener, or NULL if its corresponding - * CORBA object could not be created. - **/ -CalListener * -cal_listener_new (void) -{ - CalListener *listener; - CORBA_Environment ev; - Evolution_Calendar_Listener corba_listener; - gboolean result; - - listener = gtk_type_new (CAL_LISTENER_TYPE); - - corba_listener = cal_listener_corba_object_create (BONOBO_OBJECT (listener)); - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (corba_listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION || result) { - g_message ("cal_listener_new(): could not create the CORBA listener"); - bonobo_object_unref (BONOBO_OBJECT (listener)); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - return cal_listener_construct (listener, corba_listener); -} - -/** - * cal_listener_get_calendar: - * @listener: A calendar listener. - * - * Queries the calendar that a listener is watching. - * - * Return value: The calendar that the listener is watching. - **/ -Evolution_Calendar_Cal -cal_listener_get_calendar (CalListener *listener) -{ - CalListenerPrivate *priv; - - g_return_val_if_fail (listener != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL_LISTENER (listener), CORBA_OBJECT_NIL); - - priv = listener->priv; - return priv->cal; -} diff --git a/calendar/cal-client/cal-listener.h b/calendar/cal-client/cal-listener.h deleted file mode 100644 index 23590e6ff8..0000000000 --- a/calendar/cal-client/cal-listener.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Evolution calendar listener - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_LISTENER_H -#define CAL_LISTENER_H - -#include -#include -#include "evolution-calendar.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_LISTENER_TYPE (cal_listener_get_type ()) -#define CAL_LISTENER(obj) (GTK_CHECK_CAST ((obj), CAL_LISTENER_TYPE, CalListener)) -#define CAL_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_LISTENER_TYPE, \ - CalListenerClass)) -#define IS_CAL_LISTENER(obj) (GTK_CHECK_TYPE ((obj), CAL_LISTENER_TYPE)) -#define IS_CAL_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_LISTENER_TYPE)) - -typedef struct _CalListener CalListener; -typedef struct _CalListenerClass CalListenerClass; - -/* Load status for the cal_loaded signal. We need better error reporting. */ -typedef enum { - CAL_LISTENER_LOAD_SUCCESS, - CAL_LISTENER_LOAD_ERROR, - CAL_LISTENER_LOAD_IN_USE -} CalListenerLoadStatus; - -struct _CalListener { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalListenerClass { - BonoboObjectClass parent_class; - - /* Notification signals */ - - void (* cal_loaded) (CalListener *listener, - CalListenerLoadStatus status, - Evolution_Calendar_Cal cal); - void (* obj_updated) (CalListener *listener, const Evolution_Calendar_CalObjUID uid); - void (* obj_removed) (CalListener *listener, const Evolution_Calendar_CalObjUID uid); -}; - -GtkType cal_listener_get_type (void); - -CalListener *cal_listener_construct (CalListener *listener, - Evolution_Calendar_Listener corba_listener); - -Evolution_Calendar_Listener cal_listener_corba_object_create (BonoboObject *object); - -CalListener *cal_listener_new (void); - -Evolution_Calendar_Cal cal_listener_get_calendar (CalListener *listener); - -POA_Evolution_Calendar_Listener__epv *cal_listener_get_epv (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-client/cal-util.c b/calendar/cal-client/cal-util.c deleted file mode 100644 index f3054af958..0000000000 --- a/calendar/cal-client/cal-util.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal-util.h" - - - -/** - * cal_obj_instance_list_free: - * @list: List of CalObjInstance structures. - * - * Frees a list of CalObjInstance structures. - **/ -void -cal_obj_instance_list_free (GList *list) -{ - CalObjInstance *i; - GList *l; - - for (l = list; l; l = l->next) { - i = l->data; - - g_assert (i != NULL); - g_assert (i->uid != NULL); - g_assert (i->calobj != NULL); - - g_free (i->uid); - g_free (i->calobj); - g_free (i); - } - - g_list_free (list); -} - -/** - * cal_obj_uid_list_free: - * @list: List of strings with unique identifiers. - * - * Frees a list of unique identifiers for calendar objects. - **/ -void -cal_obj_uid_list_free (GList *list) -{ - GList *l; - - for (l = list; l; l = l->next) { - char *uid; - - uid = l->data; - g_free (uid); - } - - g_list_free (list); -} diff --git a/calendar/cal-client/cal-util.h b/calendar/cal-client/cal-util.h deleted file mode 100644 index 45be343a28..0000000000 --- a/calendar/cal-client/cal-util.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_UTIL_H -#define CAL_UTIL_H - -#include -#include -#include -#include "calobj.h" - -BEGIN_GNOME_DECLS - - - -/* Instance of a calendar object. This can be an actual occurrence, a - * recurrence, or an alarm trigger of a `real' calendar object. - */ -typedef struct { - char *uid; /* Identifier for the object wrapped in calobj */ - char *calobj; /* String representation of calendar object */ - time_t start; /* Start time of instance */ - time_t end; /* End time of instance */ -} CalObjInstance; - -void cal_obj_instance_list_free (GList *list); - -/* Used for multiple UID queries */ -typedef enum { - CALOBJ_TYPE_EVENT = 1 << 0, - CALOBJ_TYPE_TODO = 1 << 1, - CALOBJ_TYPE_JOURNAL = 1 << 2, - CALOBJ_TYPE_OTHER = 1 << 3, - CALOBJ_TYPE_ANY = 0x0f -} CalObjType; - -void cal_obj_uid_list_free (GList *list); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-client/client-test.c b/calendar/cal-client/client-test.c deleted file mode 100644 index d2374db275..0000000000 --- a/calendar/cal-client/client-test.c +++ /dev/null @@ -1,160 +0,0 @@ -#include -#include -#include -#include "cal-client.h" - -static CalClient *client1; -static CalClient *client2; - -/* Prints a message with a client identifier */ -static void -cl_printf (CalClient *client, const char *format, ...) -{ - va_list args; - - va_start (args, format); - printf ("Client %s: ", - client == client1 ? "1" : - client == client2 ? "2" : - "UNKNOWN"); - vprintf (format, args); - va_end (args); -} - -/* Lists the UIDs of objects in a calendar, called as an idle handler */ -static gboolean -list_uids (gpointer data) -{ - CalClient *client; - GList *uids; - GList *l; - - client = CAL_CLIENT (data); - - uids = cal_client_get_uids (client, CALOBJ_TYPE_ANY); - - cl_printf (client, "UIDs: "); - - if (!uids) - printf ("none\n"); - else { - for (l = uids; l; l = l->next) { - char *uid; - - uid = l->data; - printf ("`%s' ", uid); - } - - printf ("\n"); - - for (l = uids; l; l = l->next) { - char *uid; - char *calobj; - - uid = l->data; - calobj = cal_client_get_object (client, uid); - - printf ("------------------------------\n%s", calobj); - printf ("------------------------------\n"); - - cal_client_update_object (client, uid, calobj); - - g_free (calobj); - } - } - - cal_obj_uid_list_free (uids); - -/* gtk_object_unref (GTK_OBJECT (client)); */ - - return FALSE; -} - -/* Callback used when a calendar is loaded */ -static void -cal_loaded (CalClient *client, CalClientLoadStatus status, gpointer data) -{ - cl_printf (client, "Load/create %s\n", - ((status == CAL_CLIENT_LOAD_SUCCESS) ? "success" : - (status == CAL_CLIENT_LOAD_ERROR) ? "error" : - (status == CAL_CLIENT_LOAD_IN_USE) ? "in use" : - "unknown status value")); - - if (status == CAL_CLIENT_LOAD_SUCCESS) - g_idle_add (list_uids, client); - else - gtk_object_unref (GTK_OBJECT (client)); -} - -/* Callback used when an object is updated */ -static void -obj_updated (CalClient *client, const char *uid, gpointer data) -{ - cl_printf (client, "Object updated: %s\n", uid); -} - -/* Creates a calendar client and tries to load the specified URI into it */ -static CalClient * -create_client (const char *uri, gboolean load) -{ - CalClient *client; - gboolean result; - - client = cal_client_new (); - if (!client) { - g_message ("create_client(): could not create the client"); - exit (1); - } - - gtk_signal_connect (GTK_OBJECT (client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded), - NULL); - gtk_signal_connect (GTK_OBJECT (client), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated), - NULL); - - printf ("Calendar loading `%s'...\n", uri); - - if (load) - result = cal_client_load_calendar (client, uri); - else - result = cal_client_load_calendar (client, uri); - - if (!result) { - g_message ("create_client(): failure when issuing calendar load/create request `%s'", - uri); - exit (1); - } - - return client; -} - -int -main (int argc, char **argv) -{ - CORBA_Environment ev; - - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); - - CORBA_exception_init (&ev); - gnome_CORBA_init ("tl-test", VERSION, &argc, argv, 0, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("main(): could not initialize the ORB"); - CORBA_exception_free (&ev); - exit (1); - } - CORBA_exception_free (&ev); - - if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - g_message ("main(): could not initialize Bonobo"); - exit (1); - } - - client1 = create_client ("/cvs/evolution/calendar/test2.vcf", TRUE); - client2 = create_client ("/cvs/evolution/calendar/test2.vcf", FALSE); - - bonobo_main (); - - return 0; -} diff --git a/calendar/cal-common.h b/calendar/cal-common.h deleted file mode 100644 index e51ddf1bdd..0000000000 --- a/calendar/cal-common.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Evolution calendar server - common declarations - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_COMMON_H -#define CAL_COMMON_H - -#include - -BEGIN_GNOME_DECLS - - - -typedef struct _CalBackend CalBackend; -typedef struct _CalBackendClass CalBackendClass; - -typedef struct _Cal Cal; -typedef struct _CalClass CalClass; - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-factory.c b/calendar/cal-factory.c deleted file mode 100644 index a170718678..0000000000 --- a/calendar/cal-factory.c +++ /dev/null @@ -1,681 +0,0 @@ -/* Evolution calendar factory - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal.h" -#include "cal-backend.h" -#include "cal-factory.h" -#include "job.h" - - - -/* Private part of the CalFactory structure */ -typedef struct { - /* Hash table from GnomeVFSURI structures to CalBackend objects */ - GHashTable *backends; -} CalFactoryPrivate; - - - -static void cal_factory_class_init (CalFactoryClass *class); -static void cal_factory_init (CalFactory *factory); -static void cal_factory_destroy (GtkObject *object); - -static POA_Evolution_Calendar_CalFactory__vepv cal_factory_vepv; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_factory_get_type: - * @void: - * - * Registers the #CalFactory class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalFactory class. - **/ -GtkType -cal_factory_get_type (void) -{ - static GtkType cal_factory_type = 0; - - if (!cal_factory_type) { - static const GtkTypeInfo cal_factory_info = { - "CalFactory", - sizeof (CalFactory), - sizeof (CalFactoryClass), - (GtkClassInitFunc) cal_factory_class_init, - (GtkObjectInitFunc) cal_factory_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_factory_type = gtk_type_unique (bonobo_object_get_type (), &cal_factory_info); - } - - return cal_factory_type; -} - -/* CORBA class initialization function for the calendar factory */ -static void -init_cal_factory_corba_class (void) -{ - cal_factory_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_factory_vepv.Evolution_Calendar_CalFactory_epv = cal_factory_get_epv (); -} - -/* Class initialization function for the calendar factory */ -static void -cal_factory_class_init (CalFactoryClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = cal_factory_destroy; - - init_cal_factory_corba_class (); -} - -/* Object initialization function for the calendar factory */ -static void -cal_factory_init (CalFactory *factory) -{ - CalFactoryPrivate *priv; - - priv = g_new0 (CalFactoryPrivate, 1); - factory->priv = priv; - - priv->backends = g_hash_table_new (gnome_vfs_uri_hash, gnome_vfs_uri_hequal); -} - -/* Frees a uri/backend pair from the backends hash table */ -static void -free_backend (gpointer key, gpointer value, gpointer data) -{ - GnomeVFSURI *uri; - CalBackend *backend; - - uri = key; - backend = value; - - gnome_vfs_uri_unref (uri); - gtk_object_unref (GTK_OBJECT (backend)); -} - -/* Destroy handler for the calendar */ -static void -cal_factory_destroy (GtkObject *object) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_FACTORY (object)); - - factory = CAL_FACTORY (object); - priv = factory->priv; - - /* Should we assert that there are no more backends? */ - - g_hash_table_foreach (priv->backends, free_backend, NULL); - g_hash_table_destroy (priv->backends); - priv->backends = NULL; - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* CORBA servant implementation */ - -/* CalFactory::load method */ -static void -CalFactory_load (PortableServer_Servant servant, - const CORBA_char *uri, - Evolution_Calendar_Listener listener, - CORBA_Environment *ev) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - CORBA_Environment ev2; - gboolean result; - - factory = CAL_FACTORY (bonobo_object_from_servant (servant)); - priv = factory->priv; - - CORBA_exception_init (&ev2); - result = CORBA_Object_is_nil (listener, &ev2); - - if (ev2._major != CORBA_NO_EXCEPTION || result) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_CalFactory_NilListener, - NULL); - - CORBA_exception_free (&ev2); - return; - } - CORBA_exception_free (&ev2); - - cal_factory_load (factory, uri, listener); -} - -/* CalFactory::create method */ -static void -CalFactory_create (PortableServer_Servant servant, - const CORBA_char *uri, - Evolution_Calendar_Listener listener, - CORBA_Environment *ev) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - - factory = CAL_FACTORY (bonobo_object_from_servant (servant)); - priv = factory->priv; - - cal_factory_create (factory, uri, listener); -} - -/** - * cal_factory_get_epv: - * @void: - * - * Creates an EPV for the CalFactory CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_CalFactory__epv * -cal_factory_get_epv (void) -{ - POA_Evolution_Calendar_CalFactory__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_CalFactory__epv, 1); - epv->load = CalFactory_load; - epv->create = CalFactory_create; - - return epv; -} - - - -/* Loading and creating calendars */ - -/* Job data */ -typedef struct { - CalFactory *factory; - char *uri; - Evolution_Calendar_Listener listener; -} LoadCreateJobData; - -/* Looks up a calendar backend in a factory's hash table of uri->cal */ -static CalBackend * -lookup_backend (CalFactory *factory, GnomeVFSURI *uri) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - - priv = factory->priv; - - backend = g_hash_table_lookup (priv->backends, uri); - return backend; -} - -/* Callback used when a backend is destroyed */ -static void -backend_destroy_cb (GtkObject *object, gpointer data) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - CalBackend *backend; - GnomeVFSURI *uri; - gpointer orig_key; - gboolean result; - GnomeVFSURI *orig_uri; - - factory = CAL_FACTORY (data); - priv = factory->priv; - - /* Remove the backend from the hash table */ - - backend = CAL_BACKEND (object); - uri = cal_backend_get_uri (backend); - g_assert (uri != NULL); - - result = g_hash_table_lookup_extended (priv->backends, uri, &orig_key, NULL); - g_assert (result != FALSE); - - orig_uri = orig_key; - - g_hash_table_remove (priv->backends, orig_uri); - gnome_vfs_uri_unref (orig_uri); - - /* If there are no more backends, then the factory can go away */ - - if (g_hash_table_size (priv->backends) == 0) - bonobo_object_unref (BONOBO_OBJECT (factory)); -} - -/* Adds a backend to the calendar factory's hash table */ -static void -add_backend (CalFactory *factory, GnomeVFSURI *uri, CalBackend *backend) -{ - CalFactoryPrivate *priv; - - priv = factory->priv; - - gnome_vfs_uri_ref (uri); - g_hash_table_insert (priv->backends, uri, backend); - - gtk_signal_connect (GTK_OBJECT (backend), "destroy", - GTK_SIGNAL_FUNC (backend_destroy_cb), - factory); -} - -/* Loads a calendar backend and puts it in the factory's backend hash table */ -static CalBackend * -load_backend (CalFactory *factory, GnomeVFSURI *uri) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - CalBackendLoadStatus status; - - priv = factory->priv; - - backend = cal_backend_new (); - if (!backend) { - g_message ("load_backend(): could not create the backend"); - return NULL; - } - - status = cal_backend_load (backend, uri); - - switch (status) { - case CAL_BACKEND_LOAD_SUCCESS: - add_backend (factory, uri, backend); - return backend; - - case CAL_BACKEND_LOAD_ERROR: - gtk_object_unref (GTK_OBJECT (backend)); - return NULL; - - default: - g_assert_not_reached (); - return NULL; - } -} - -/* Creates a calendar backend and puts it in the factory's backend hash table */ -static CalBackend * -create_backend (CalFactory *factory, GnomeVFSURI *uri) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - - priv = factory->priv; - - backend = cal_backend_new (); - if (!backend) { - g_message ("create_backend(): could not create the backend"); - return NULL; - } - - cal_backend_create (backend, uri); - add_backend (factory, uri, backend); - - return backend; -} - -/* Adds a listener to a calendar backend by creating a calendar client interface - * object. - */ -static void -add_calendar_client (CalFactory *factory, CalBackend *backend, Evolution_Calendar_Listener listener) -{ - Cal *cal; - CORBA_Environment ev; - - cal = cal_new (backend, listener); - if (!cal) { - g_message ("add_calendar_client(): could not create the calendar client interface"); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("add_calendar_client(): could not notify the listener"); - - CORBA_exception_free (&ev); - return; - } - - cal_backend_add_cal (backend, cal); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_SUCCESS, - bonobo_object_corba_objref (BONOBO_OBJECT (cal)), - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("add_calendar_client(): could not notify the listener"); - bonobo_object_unref (BONOBO_OBJECT (cal)); - } - - CORBA_exception_free (&ev); -} - -/* Job handler for the load calendar command */ -static void -load_fn (gpointer data) -{ - LoadCreateJobData *jd; - CalFactory *factory; - GnomeVFSURI *uri; - Evolution_Calendar_Listener listener; - CalBackend *backend; - CORBA_Environment ev; - - jd = data; - - /* Look up the calendar */ - - uri = gnome_vfs_uri_new (jd->uri); - g_free (jd->uri); - - factory = jd->factory; - listener = jd->listener; - g_free (jd); - - /* Look up the backend and create it if needed */ - - backend = lookup_backend (factory, uri); - - if (!backend) - backend = load_backend (factory, uri); - - if (!backend) { - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("load_fn(): could not notify the listener"); - - CORBA_exception_free (&ev); - goto out; - } - - add_calendar_client (factory, backend, listener); - - out: - - gnome_vfs_uri_unref (uri); - - CORBA_exception_init (&ev); - CORBA_Object_release (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("load_fn(): could not release the listener"); - - CORBA_exception_free (&ev); -} - -/* Job handler for the create calendar command */ -static void -create_fn (gpointer data) -{ - LoadCreateJobData *jd; - CalFactory *factory; - GnomeVFSURI *uri; - Evolution_Calendar_Listener listener; - CalBackend *backend; - CORBA_Environment ev; - - jd = data; - factory = jd->factory; - - uri = gnome_vfs_uri_new (jd->uri); - g_free (jd->uri); - - factory = jd->factory; - listener = jd->listener; - g_free (jd); - - /* Check that the backend is not in use */ - - backend = lookup_backend (factory, uri); - - if (backend) { - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_IN_USE, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("create_fn(): could not notify the listener"); - - CORBA_exception_free (&ev); - goto out; - } - - /* Create the backend */ - - backend = create_backend (factory, uri); - - if (!backend) { - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("create_fn(): could not notify the listener"); - - CORBA_exception_free (&ev); - goto out; - } - - add_calendar_client (factory, backend, listener); - - out: - - gnome_vfs_uri_unref (uri); - - CORBA_exception_init (&ev); - CORBA_Object_release (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("create_fn(): could not release the listener"); - - CORBA_exception_free (&ev); -} - - - -/** - * cal_factory_construct: - * @factory: A calendar factory. - * @corba_factory: CORBA object for the calendar factory. - * - * Constructs a calendar factory by binding the corresponding CORBA object to - * it. - * - * Return value: The same object as the @factory argument. - **/ -CalFactory * -cal_factory_construct (CalFactory *factory, Evolution_Calendar_CalFactory corba_factory) -{ - g_return_val_if_fail (factory != NULL, NULL); - g_return_val_if_fail (IS_CAL_FACTORY (factory), NULL); - - bonobo_object_construct (BONOBO_OBJECT (factory), corba_factory); - return factory; -} - -/** - * cal_factory_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar factory @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_CalFactory -cal_factory_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_CalFactory *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL_FACTORY (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_CalFactory *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_factory_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_CalFactory__init ((PortableServer_Servant) servant, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_factory_corba_object_create(): could not init the servant"); - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_CalFactory) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_factory_new: - * @void: - * - * Creates a new #CalFactory object. - * - * Return value: A newly-created #CalFactory, or NULL if its corresponding CORBA - * object could not be created. - **/ -CalFactory * -cal_factory_new (void) -{ - CalFactory *factory; - CORBA_Environment ev; - Evolution_Calendar_CalFactory corba_factory; - gboolean retval; - - factory = gtk_type_new (CAL_FACTORY_TYPE); - - corba_factory = cal_factory_corba_object_create (BONOBO_OBJECT (factory)); - - CORBA_exception_init (&ev); - retval = CORBA_Object_is_nil (corba_factory, &ev); - - if (ev._major != CORBA_NO_EXCEPTION || retval) { - g_message ("cal_factory_new(): could not create the CORBA factory"); - bonobo_object_unref (BONOBO_OBJECT (factory)); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - return cal_factory_construct (factory, corba_factory); -} - -/* Queues a load or create request */ -static void -queue_load_create_job (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener, - JobFunc func) -{ - LoadCreateJobData *jd; - CORBA_Environment ev; - Evolution_Calendar_Listener listener_copy; - gboolean result; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("queue_load_create_job(): could not see if the listener was NIL"); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) { - g_message ("queue_load_create_job(): cannot operate on a NIL listener!"); - return; - } - - listener_copy = CORBA_Object_duplicate (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("queue_load_create_job(): could not duplicate the listener"); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - jd = g_new (LoadCreateJobData, 1); - jd->factory = factory; - jd->uri = g_strdup (uri); - jd->listener = listener_copy; - - job_add (func, jd); -} - -/** - * cal_factory_load: - * @factory: A calendar factory. - * @uri: URI of calendar to load. - * @listener: Listener for notification of the load result. - * - * Initiates a load request in a calendar factory. A calendar will be loaded - * asynchronously and the result code will be reported to the specified - * listener. - **/ -void -cal_factory_load (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener) -{ - queue_load_create_job (factory, uri, listener, load_fn); -} - -void -cal_factory_create (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener) -{ - queue_load_create_job (factory, uri, listener, create_fn); -} diff --git a/calendar/cal-factory.h b/calendar/cal-factory.h deleted file mode 100644 index 9d5fd57e2c..0000000000 --- a/calendar/cal-factory.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Evolution calendar factory - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_FACTORY_H -#define CAL_FACTORY_H - -#include -#include -#include "evolution-calendar.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_FACTORY_TYPE (cal_factory_get_type ()) -#define CAL_FACTORY(obj) (GTK_CHECK_CAST ((obj), CAL_FACTORY_TYPE, CalFactory)) -#define CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_FACTORY_TYPE, \ - CalFactoryClass)) -#define IS_CAL_FACTORY(obj) (GTK_CHECK_TYPE ((obj), CAL_FACTORY_TYPE)) -#define IS_CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_FACTORY_TYPE)) - -typedef struct _CalFactory CalFactory; -typedef struct _CalFactoryClass CalFactoryClass; - -struct _CalFactory { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalFactoryClass { - BonoboObjectClass parent_class; -}; - -GtkType cal_factory_get_type (void); - -CalFactory *cal_factory_construct (CalFactory *factory, Evolution_Calendar_CalFactory corba_factory); -Evolution_Calendar_CalFactory cal_factory_corba_object_create (BonoboObject *object); - -CalFactory *cal_factory_new (void); - -void cal_factory_load (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener); -void cal_factory_create (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener); - -POA_Evolution_Calendar_CalFactory__epv *cal_factory_get_epv (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-listener.c b/calendar/cal-listener.c deleted file mode 100644 index 2c875c4c38..0000000000 --- a/calendar/cal-listener.c +++ /dev/null @@ -1,421 +0,0 @@ -/* Evolution calendar listener - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal-listener.h" - - - -/* Private part of the CalListener structure */ -typedef struct { - /* The calendar this listener refers to */ - Evolution_Calendar_Cal cal; -} CalListenerPrivate; - - - -/* Signal IDs */ -enum { - CAL_LOADED, - OBJ_UPDATED, - OBJ_REMOVED, - LAST_SIGNAL -}; - -static void cal_listener_class_init (CalListenerClass *class); -static void cal_listener_init (CalListener *listener); -static void cal_listener_destroy (GtkObject *object); - -static void marshal_cal_loaded (GtkObject *object, GtkSignalFunc func, gpointer data, GtkArg *args); - -static POA_Evolution_Calendar_Listener__vepv cal_listener_vepv; - -static guint cal_listener_signals[LAST_SIGNAL]; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_listener_get_type: - * @void: - * - * Registers the #CalListener class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalListener class. - **/ -GtkType -cal_listener_get_type (void) -{ - static GtkType cal_listener_type = 0; - - if (!cal_listener_type) { - static const GtkTypeInfo cal_listener_info = { - "CalListener", - sizeof (CalListener), - sizeof (CalListenerClass), - (GtkClassInitFunc) cal_listener_class_init, - (GtkObjectInitFunc) cal_listener_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_listener_type = gtk_type_unique (bonobo_object_get_type (), &cal_listener_info); - } - - return cal_listener_type; -} - -/* CORBA class initialization function for the calendar listener */ -static void -init_cal_listener_corba_class (void) -{ - cal_listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_listener_vepv.Evolution_Calendar_Listener_epv = cal_listener_get_epv (); -} - -/* Class initialization function for the calendar listener */ -static void -cal_listener_class_init (CalListenerClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - cal_listener_signals[CAL_LOADED] = - gtk_signal_new ("cal_loaded", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalListenerClass, cal_loaded), - marshal_cal_loaded, - GTK_TYPE_NONE, 2, - GTK_TYPE_ENUM, - GTK_TYPE_POINTER); - cal_listener_signals[OBJ_UPDATED] = - gtk_signal_new ("obj_updated", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalListenerClass, obj_updated), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - cal_listener_signals[OBJ_REMOVED] = - gtk_signal_new ("obj_removed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalListenerClass, obj_removed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, cal_listener_signals, LAST_SIGNAL); - - object_class->destroy = cal_listener_destroy; - - init_cal_listener_corba_class (); -} - -/* Object initialization function for the calendar listener */ -static void -cal_listener_init (CalListener *listener) -{ - CalListenerPrivate *priv; - - priv = g_new0 (CalListenerPrivate, 1); - listener->priv = priv; - - priv->cal = CORBA_OBJECT_NIL; -} - -/* Destroy handler for the calendar listener */ -static void -cal_listener_destroy (GtkObject *object) -{ - CalListener *listener; - CalListenerPrivate *priv; - CORBA_Environment ev; - gboolean result; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_LISTENER (object)); - - listener = CAL_LISTENER (object); - priv = listener->priv; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (priv->cal, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_listener_destroy(): could not see if the calendar was NIL"); - else if (!result) { - CORBA_exception_free (&ev); - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->cal, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_listener_destroy(): could not release the calendar"); - - priv->cal = CORBA_OBJECT_NIL; - } - CORBA_exception_free (&ev); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* Marshalers */ - -typedef void (* CalLoadedFunc) (GtkObject *object, gint status, gpointer cal, gpointer data); - -static void -marshal_cal_loaded (GtkObject *object, GtkSignalFunc func, gpointer data, GtkArg *args) -{ - CalLoadedFunc rfunc; - - rfunc = (CalLoadedFunc) func; - (* rfunc) (object, GTK_VALUE_ENUM (args[0]), GTK_VALUE_POINTER (args[1]), data); -} - - - -/* CORBA servant implementation */ - -/* Listener::cal_loaded method */ -static void -Listener_cal_loaded (PortableServer_Servant servant, - Evolution_Calendar_Listener_LoadStatus status, - Evolution_Calendar_Cal cal, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - CORBA_Environment aev; - Evolution_Calendar_Cal cal_copy; - CalListenerLoadStatus load_status; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (priv->cal != CORBA_OBJECT_NIL) { - g_message ("Listener_cal_loaded(): calendar was already loaded!"); - return; - } - - CORBA_exception_init (&aev); - cal_copy = CORBA_Object_duplicate (cal, &aev); - - if (aev._major != CORBA_NO_EXCEPTION) { - g_message ("Listener_cal_loaded(): could not duplicate the calendar"); - CORBA_exception_free (&aev); - return; - } - CORBA_exception_free (&aev); - - priv->cal = cal_copy; - - switch (status) { - case Evolution_Calendar_Listener_SUCCESS: - load_status = CAL_LISTENER_LOAD_SUCCESS; - break; - - case Evolution_Calendar_Listener_ERROR: - load_status = CAL_LISTENER_LOAD_ERROR; - break; - - case Evolution_Calendar_Listener_IN_USE: - load_status = CAL_LISTENER_LOAD_IN_USE; - break; - - default: - load_status = CAL_LISTENER_LOAD_ERROR; /* keep gcc happy */ - g_assert_not_reached (); - } - - gtk_signal_emit (GTK_OBJECT (listener), cal_listener_signals[CAL_LOADED], - load_status, cal); -} - -/* Listener::obj_updated method */ -static void -Listener_obj_updated (PortableServer_Servant servant, - Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - CalListener *listener; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - gtk_signal_emit (GTK_OBJECT (listener), cal_listener_signals[OBJ_UPDATED], - uid); -} - -/* Listener::obj_removed method */ -static void -Listener_obj_removed (PortableServer_Servant servant, - Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - CalListener *listener; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - gtk_signal_emit (GTK_OBJECT (listener), cal_listener_signals[OBJ_REMOVED], - uid); -} - -/** - * cal_listener_get_epv: - * @void: - * - * Creates an EPV for the Listener CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_Listener__epv * -cal_listener_get_epv (void) -{ - POA_Evolution_Calendar_Listener__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_Listener__epv, 1); - epv->cal_loaded = Listener_cal_loaded; - epv->obj_updated = Listener_obj_updated; - epv->obj_removed = Listener_obj_removed; - return epv; -} - - - -/** - * cal_listener_construct: - * @listener: A calendar listener. - * @corba_listener: CORBA object for the calendar listener. - * - * Constructs a calendar listener by binding the corresponding CORBA object to - * it. - * - * Return value: the same object as the @listener argument. - **/ -CalListener * -cal_listener_construct (CalListener *listener, Evolution_Calendar_Listener corba_listener) -{ - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (IS_CAL_LISTENER (listener), NULL); - - bonobo_object_construct (BONOBO_OBJECT (listener), corba_listener); - return listener; -} - -/** - * cal_listener_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar listener @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_Listener -cal_listener_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_Listener *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL_LISTENER (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_Listener *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_listener_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_Listener__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_Listener) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_listener_new: - * @void: - * - * Creates a new #CalListener object. - * - * Return value: A newly-created #CalListener, or NULL if its corresponding - * CORBA object could not be created. - **/ -CalListener * -cal_listener_new (void) -{ - CalListener *listener; - CORBA_Environment ev; - Evolution_Calendar_Listener corba_listener; - gboolean result; - - listener = gtk_type_new (CAL_LISTENER_TYPE); - - corba_listener = cal_listener_corba_object_create (BONOBO_OBJECT (listener)); - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (corba_listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION || result) { - g_message ("cal_listener_new(): could not create the CORBA listener"); - bonobo_object_unref (BONOBO_OBJECT (listener)); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - return cal_listener_construct (listener, corba_listener); -} - -/** - * cal_listener_get_calendar: - * @listener: A calendar listener. - * - * Queries the calendar that a listener is watching. - * - * Return value: The calendar that the listener is watching. - **/ -Evolution_Calendar_Cal -cal_listener_get_calendar (CalListener *listener) -{ - CalListenerPrivate *priv; - - g_return_val_if_fail (listener != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL_LISTENER (listener), CORBA_OBJECT_NIL); - - priv = listener->priv; - return priv->cal; -} diff --git a/calendar/cal-listener.h b/calendar/cal-listener.h deleted file mode 100644 index 23590e6ff8..0000000000 --- a/calendar/cal-listener.h +++ /dev/null @@ -1,86 +0,0 @@ -/* Evolution calendar listener - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_LISTENER_H -#define CAL_LISTENER_H - -#include -#include -#include "evolution-calendar.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_LISTENER_TYPE (cal_listener_get_type ()) -#define CAL_LISTENER(obj) (GTK_CHECK_CAST ((obj), CAL_LISTENER_TYPE, CalListener)) -#define CAL_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_LISTENER_TYPE, \ - CalListenerClass)) -#define IS_CAL_LISTENER(obj) (GTK_CHECK_TYPE ((obj), CAL_LISTENER_TYPE)) -#define IS_CAL_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_LISTENER_TYPE)) - -typedef struct _CalListener CalListener; -typedef struct _CalListenerClass CalListenerClass; - -/* Load status for the cal_loaded signal. We need better error reporting. */ -typedef enum { - CAL_LISTENER_LOAD_SUCCESS, - CAL_LISTENER_LOAD_ERROR, - CAL_LISTENER_LOAD_IN_USE -} CalListenerLoadStatus; - -struct _CalListener { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalListenerClass { - BonoboObjectClass parent_class; - - /* Notification signals */ - - void (* cal_loaded) (CalListener *listener, - CalListenerLoadStatus status, - Evolution_Calendar_Cal cal); - void (* obj_updated) (CalListener *listener, const Evolution_Calendar_CalObjUID uid); - void (* obj_removed) (CalListener *listener, const Evolution_Calendar_CalObjUID uid); -}; - -GtkType cal_listener_get_type (void); - -CalListener *cal_listener_construct (CalListener *listener, - Evolution_Calendar_Listener corba_listener); - -Evolution_Calendar_Listener cal_listener_corba_object_create (BonoboObject *object); - -CalListener *cal_listener_new (void); - -Evolution_Calendar_Cal cal_listener_get_calendar (CalListener *listener); - -POA_Evolution_Calendar_Listener__epv *cal_listener_get_epv (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-util.c b/calendar/cal-util.c deleted file mode 100644 index f3054af958..0000000000 --- a/calendar/cal-util.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal-util.h" - - - -/** - * cal_obj_instance_list_free: - * @list: List of CalObjInstance structures. - * - * Frees a list of CalObjInstance structures. - **/ -void -cal_obj_instance_list_free (GList *list) -{ - CalObjInstance *i; - GList *l; - - for (l = list; l; l = l->next) { - i = l->data; - - g_assert (i != NULL); - g_assert (i->uid != NULL); - g_assert (i->calobj != NULL); - - g_free (i->uid); - g_free (i->calobj); - g_free (i); - } - - g_list_free (list); -} - -/** - * cal_obj_uid_list_free: - * @list: List of strings with unique identifiers. - * - * Frees a list of unique identifiers for calendar objects. - **/ -void -cal_obj_uid_list_free (GList *list) -{ - GList *l; - - for (l = list; l; l = l->next) { - char *uid; - - uid = l->data; - g_free (uid); - } - - g_list_free (list); -} diff --git a/calendar/cal-util.h b/calendar/cal-util.h deleted file mode 100644 index 45be343a28..0000000000 --- a/calendar/cal-util.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_UTIL_H -#define CAL_UTIL_H - -#include -#include -#include -#include "calobj.h" - -BEGIN_GNOME_DECLS - - - -/* Instance of a calendar object. This can be an actual occurrence, a - * recurrence, or an alarm trigger of a `real' calendar object. - */ -typedef struct { - char *uid; /* Identifier for the object wrapped in calobj */ - char *calobj; /* String representation of calendar object */ - time_t start; /* Start time of instance */ - time_t end; /* End time of instance */ -} CalObjInstance; - -void cal_obj_instance_list_free (GList *list); - -/* Used for multiple UID queries */ -typedef enum { - CALOBJ_TYPE_EVENT = 1 << 0, - CALOBJ_TYPE_TODO = 1 << 1, - CALOBJ_TYPE_JOURNAL = 1 << 2, - CALOBJ_TYPE_OTHER = 1 << 3, - CALOBJ_TYPE_ANY = 0x0f -} CalObjType; - -void cal_obj_uid_list_free (GList *list); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c deleted file mode 100644 index ce0d330303..0000000000 --- a/calendar/cal-util/calobj.c +++ /dev/null @@ -1,1608 +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 -#include -#include -#include -#include -#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_new0 (iCalPerson, 1); - ico->organizer->addr = 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; -} - -#if 0 - -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; -} - -#endif - -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; - - /* FIXME!!!!! The UID needs to change!!! */ - - 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 = g_strdup ("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_new0 (iCalPerson, 1); - ical->organizer->addr = g_strdup (str_val (vo)); - free (the_str); - } - - /* related */ - if (has (o, VCRelatedToProp)){ - char *str; - char *s; - iCalRelation *rel; - str = str_val (vo); - for (s = strtok (str, ";"); s; s = strtok (NULL, ";")) { - rel = g_new0 (iCalRelation, 1); - rel->uid = g_strdup (s); - rel->reltype = g_strdup ("PARENT"); - ical->related = g_list_prepend (ical->related, rel); - } - 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_rel_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 (((iCalRelation*)(l->data))->uid) + 1; - - result = g_malloc (len); - - for (p = result, l = values; l; l = l->next) { - int len = strlen (((iCalRelation*)(l->data))->uid); - - strcpy (p, ((iCalRelation*)(l->data))->uid); - - 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)); - - /* Owner/organizer */ - if (ical->organizer && ical->organizer->addr) - addPropValue (o, VCOrgNameProp, ical->organizer->addr); - - /* related */ - if (ical->related) - store_rel_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 (¤t); - - 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 (¤t); - 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 (¤t); - - 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; -} - -/** - * ical_object_find_in_string: - * @uid: Unique identifier of the sought object. - * @vcalobj: String representation of a complete calendar object. - * @ico: The resulting #iCalObject is stored here. - * - * Parses a complete vCalendar object string and tries to find the calendar - * object that matches the specified @uid. If found, it stores the resulting - * #iCalObject in the @ico parameter. - * - * Return value: A result code depending on whether the parse and search were - * successful. - **/ -CalObjFindStatus -ical_object_find_in_string (const char *uid, const char *vcalobj, iCalObject **ico) -{ - VObject *vcal; - VObjectIterator i; - CalObjFindStatus status; - - g_return_val_if_fail (uid != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - g_return_val_if_fail (vcalobj != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - g_return_val_if_fail (ico != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - - *ico = NULL; - status = CAL_OBJ_FIND_NOT_FOUND; - - vcal = Parse_MIME (vcalobj, strlen (vcalobj)); - - if (!vcal) - return CAL_OBJ_FIND_SYNTAX_ERROR; - - initPropIterator (&i, vcal); - - while (moreIteration (&i)) { - VObject *vobj; - VObject *uid_prop; - char *the_str; - - vobj = nextVObject (&i); - - uid_prop = isAPropertyOf (vobj, VCUniqueStringProp); - if (!uid_prop) - continue; - - /* str_val() sets the_str to the string representation of the - * property. - */ - str_val (uid_prop); - - if (strcmp (the_str, uid) == 0) { - const char *object_name; - - object_name = vObjectName (vobj); - *ico = ical_object_create_from_vobject (vobj, object_name); - - if (*ico) - status = CAL_OBJ_FIND_SUCCESS; - } - - free (the_str); - - if (status == CAL_OBJ_FIND_SUCCESS) - break; - } - - cleanVObject (vcal); - cleanStrTbl (); - - return status; -} diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h deleted file mode 100644 index 38d9598298..0000000000 --- a/calendar/cal-util/calobj.h +++ /dev/null @@ -1,263 +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 -#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; /* not used for iCalendar alarms */ - - /* the following pointers are used for iCalendar alarms */ - - char *attach; /* AUDIO, EMAIL, PROC */ - char *desc; /* DISPLAY, EMAIL, PROC */ - char *summary; /* EMAIL */ - char *attendee; /* EMAIL */ - - /* 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 struct { - char *uid; - char *reltype; -} iCalRelation; - -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; - -/* - NOTE: iCalPerson is used for various property values which specify - people (e.g. ATTENDEE, ORGANIZER, etc. Not all fields are valid - under RFC 2445 for all property values, but iCalPerson can store - them anyway. Enforcing the RFC is a job for the parser. -*/ - -typedef struct { - char *addr; - char *name; - char *role; - char *partstat; - gboolean rsvp; - char *cutype; /* calendar user type */ - GList *member; /* group memberships */ - GList *deleg_to; - GList *deleg_from; - char *sent_by; - char *directory; - GList *altrep; /* list of char* URI's */ -} iCalPerson; - -#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 (list of iCalPerson) */ - 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 */ - char *desc; - time_t dtstamp; - time_t dtstart; - time_t dtend; /* also duedate for todo's */ - gboolean date_only; /* set if the start/end times were - specified using dates, not times (internal use, not stored to disk) */ - GList *exdate; /* type: one or more time_t's */ - GList *exrule; /* type: one or more RECUR */ - iCalGeo geo; - time_t last_mod; - char *location; - iCalPerson *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; - - GList *alarms; - - 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); - -typedef enum { - CAL_OBJ_FIND_SUCCESS, - CAL_OBJ_FIND_SYNTAX_ERROR, - CAL_OBJ_FIND_NOT_FOUND -} CalObjFindStatus; - -CalObjFindStatus ical_object_find_in_string (const char *uid, const char *vcalobj, 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.c b/calendar/cal.c deleted file mode 100644 index 8263bfe491..0000000000 --- a/calendar/cal.c +++ /dev/null @@ -1,559 +0,0 @@ -/* Evolution calendar client interface object - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include "cal.h" -#include "cal-backend.h" - - - -/* Private part of the Cal structure */ -typedef struct { - /* Our backend */ - CalBackend *backend; - - /* Listener on the client we notify */ - Evolution_Calendar_Listener listener; -} CalPrivate; - - - -static void cal_class_init (CalClass *class); -static void cal_init (Cal *cal); -static void cal_destroy (GtkObject *object); - -static POA_Evolution_Calendar_Cal__vepv cal_vepv; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_get_type: - * @void: - * - * Registers the #Cal class if necessary, and returns the type ID associated to - * it. - * - * Return value: The type ID of the #Cal class. - **/ -GtkType -cal_get_type (void) -{ - static GtkType cal_type = 0; - - if (!cal_type) { - static const GtkTypeInfo cal_info = { - "Cal", - sizeof (Cal), - sizeof (CalClass), - (GtkClassInitFunc) cal_class_init, - (GtkObjectInitFunc) cal_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_type = gtk_type_unique (BONOBO_OBJECT_TYPE, &cal_info); - } - - return cal_type; -} - -/* CORBA class initialzation function for the calendar */ -static void -init_cal_corba_class (void) -{ - cal_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_vepv.Evolution_Calendar_Cal_epv = cal_get_epv (); -} - -/* Class initialization function for the calendar */ -static void -cal_class_init (CalClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (BONOBO_OBJECT_TYPE); - - object_class->destroy = cal_destroy; - - init_cal_corba_class (); -} - -/* Object initialization function for the calendar */ -static void -cal_init (Cal *cal) -{ - CalPrivate *priv; - - priv = g_new0 (CalPrivate, 1); - cal->priv = priv; - - priv->listener = CORBA_OBJECT_NIL; -} - -/* Destroy handler for the calendar */ -static void -cal_destroy (GtkObject *object) -{ - Cal *cal; - CalPrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL (object)); - - cal = CAL (object); - priv = cal->priv; - - priv->backend = NULL; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_destroy(): could not release the listener"); - - CORBA_exception_free (&ev); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* CORBA servant implementation */ - -/* Cal::get_uri method */ -static CORBA_char * -Cal_get_uri (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - GnomeVFSURI *uri; - char *str_uri; - CORBA_char *str_uri_copy; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - uri = cal_backend_get_uri (priv->backend); - str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); - str_uri_copy = CORBA_string_dup (str_uri); - g_free (str_uri); - - return str_uri_copy; - -} - -/* Cal::get_object method */ -static Evolution_Calendar_CalObj -Cal_get_object (PortableServer_Servant servant, - const Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - char *calobj; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - calobj = cal_backend_get_object (priv->backend, uid); - - if (calobj) { - CORBA_char *calobj_copy; - - calobj_copy = CORBA_string_dup (calobj); - g_free (calobj); - return calobj_copy; - } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_NotFound, - NULL); - return NULL; - } -} - -/* Cal::get_uids method */ -static Evolution_Calendar_CalObjUIDSeq * -Cal_get_uids (PortableServer_Servant servant, - const Evolution_Calendar_CalObjType type, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - GList *uids, *l; - Evolution_Calendar_CalObjUIDSeq *seq; - int t; - int n, i; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - /* Translate the CORBA flags to our own flags */ - - t = (((type & Evolution_Calendar_TYPE_EVENT) ? CALOBJ_TYPE_EVENT : 0) - | ((type & Evolution_Calendar_TYPE_TODO) ? CALOBJ_TYPE_TODO : 0) - | ((type & Evolution_Calendar_TYPE_JOURNAL) ? CALOBJ_TYPE_JOURNAL : 0) - | ((type & Evolution_Calendar_TYPE_OTHER) ? CALOBJ_TYPE_OTHER : 0) - | ((type & Evolution_Calendar_TYPE_ANY) ? CALOBJ_TYPE_ANY : 0)); - - uids = cal_backend_get_uids (priv->backend, t); - n = g_list_length (uids); - - seq = Evolution_Calendar_CalObjUIDSeq__alloc (); - CORBA_sequence_set_release (seq, TRUE); - seq->_length = n; - seq->_buffer = CORBA_sequence_Evolution_Calendar_CalObjUID_allocbuf (n); - - /* Fill the sequence */ - - for (i = 0, l = uids; l; i++, l = l->next) { - char *uid; - - uid = l->data; - - seq->_buffer[i] = CORBA_string_dup (uid); - } - - /* Done */ - - cal_obj_uid_list_free (uids); - - return seq; -} - -/* Cal::get_events_in_range method */ -static Evolution_Calendar_CalObjInstanceSeq * -Cal_get_events_in_range (PortableServer_Servant servant, - const Evolution_Calendar_Time_t start, - const Evolution_Calendar_Time_t end, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - time_t t_start, t_end; - Evolution_Calendar_CalObjInstanceSeq *seq; - GList *elist, *l; - int n, i; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - t_start = (time_t) start; - t_end = (time_t) end; - - if (t_start > t_end || t_start == -1 || t_end == -1) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_InvalidRange, - NULL); - return NULL; - } - - /* Figure out the list and allocate the sequence */ - - elist = cal_backend_get_events_in_range (priv->backend, t_start, t_end); - n = g_list_length (elist); - - seq = Evolution_Calendar_CalObjInstanceSeq__alloc (); - CORBA_sequence_set_release (seq, TRUE); - seq->_length = n; - seq->_buffer = CORBA_sequence_Evolution_Calendar_CalObjInstance_allocbuf (n); - - /* Fill the sequence */ - - for (i = 0, l = elist; l; i++, l = l->next) { - CalObjInstance *icoi; - Evolution_Calendar_CalObjInstance *corba_icoi; - - icoi = l->data; - corba_icoi = &seq->_buffer[i]; - - corba_icoi->uid = CORBA_string_dup (icoi->uid); - corba_icoi->calobj = CORBA_string_dup (icoi->calobj); - corba_icoi->start = icoi->start; - corba_icoi->end = icoi->end; - } - - /* Done */ - - cal_obj_instance_list_free (elist); - - return seq; -} - -/* Cal::update_object method */ -static void -Cal_update_object (PortableServer_Servant servant, - const Evolution_Calendar_CalObjUID uid, - const Evolution_Calendar_CalObj calobj, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - if (!cal_backend_update_object (priv->backend, uid, calobj)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_InvalidObject, - NULL); -} - -/* Cal::remove_object method */ -static void -Cal_remove_object (PortableServer_Servant servant, - const Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - if (!cal_backend_remove_object (priv->backend, uid)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_NotFound, - NULL); -} - -/** - * cal_get_epv: - * @void: - * - * Creates an EPV for the Cal CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_Cal__epv * -cal_get_epv (void) -{ - POA_Evolution_Calendar_Cal__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_Cal__epv, 1); - epv->_get_uri = Cal_get_uri; - epv->get_object = Cal_get_object; - epv->get_uids = Cal_get_uids; - epv->get_events_in_range = Cal_get_events_in_range; - epv->update_object = Cal_update_object; - epv->remove_object = Cal_remove_object; - - return epv; -} - - - -/** - * cal_construct: - * @cal: A calendar client interface. - * @corba_cal: CORBA object for the calendar. - * @backend: Calendar backend that this @cal presents an interface to. - * @listener: Calendar listener for notification. - * - * Constructs a calendar client interface object by binding the corresponding - * CORBA object to it. The calendar interface is bound to the specified - * @backend, and will notify the @listener about changes to the calendar. - * - * Return value: The same object as the @cal argument. - **/ -Cal * -cal_construct (Cal *cal, - Evolution_Calendar_Cal corba_cal, - CalBackend *backend, - Evolution_Calendar_Listener listener) -{ - CalPrivate *priv; - CORBA_Environment ev; - - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (IS_CAL (cal), NULL); - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = cal->priv; - - CORBA_exception_init (&ev); - priv->listener = CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_construct: could not duplicate the listener"); - priv->listener = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - priv->backend = backend; - - bonobo_object_construct (BONOBO_OBJECT (cal), corba_cal); - return cal; -} - -/** - * cal_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar client interface @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_Cal -cal_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_Cal *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_Cal *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_Cal__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_corba_object_create(): could not init the servant"); - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_Cal) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_new: - * @backend: A calendar backend. - * @listener: A calendar listener. - * - * Creates a new calendar client interface object and binds it to the specified - * @backend and @listener objects. - * - * Return value: A newly-created #Cal calendar client interface object, or NULL - * if its corresponding CORBA object could not be created. - **/ -Cal * -cal_new (CalBackend *backend, Evolution_Calendar_Listener listener) -{ - Cal *cal, *retval; - Evolution_Calendar_Cal corba_cal; - CORBA_Environment ev; - gboolean ret; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - cal = CAL (gtk_type_new (CAL_TYPE)); - corba_cal = cal_corba_object_create (BONOBO_OBJECT (cal)); - - CORBA_exception_init (&ev); - ret = CORBA_Object_is_nil ((CORBA_Object) corba_cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION || ret) { - g_message ("cal_new(): could not create the CORBA object"); - bonobo_object_unref (BONOBO_OBJECT (cal)); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - retval = cal_construct (cal, corba_cal, backend, listener); - if (!retval) { - g_message ("cal_new(): could not construct the calendar client interface"); - bonobo_object_unref (BONOBO_OBJECT (cal)); - return NULL; - } - - return retval; -} - -/** - * cal_notify_update: - * @cal: A calendar client interface. - * @uid: UID of object that was updated. - * - * Notifies a listener attached to a calendar client interface object about an - * update to a calendar object. - **/ -void -cal_notify_update (Cal *cal, const char *uid) -{ - CalPrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (cal != NULL); - g_return_if_fail (IS_CAL (cal)); - g_return_if_fail (uid != NULL); - - priv = cal->priv; - g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_obj_updated (priv->listener, uid, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_notify_update(): could not notify the listener " - "about an updated object"); - - CORBA_exception_free (&ev); -} - -/** - * cal_notify_remove: - * @cal: A calendar client interface. - * @uid: UID of object that was removed. - * - * Notifies a listener attached to a calendar client interface object about a - * calendar object that was removed. - **/ -void -cal_notify_remove (Cal *cal, const char *uid) -{ - CalPrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (cal != NULL); - g_return_if_fail (IS_CAL (cal)); - g_return_if_fail (uid != NULL); - - priv = cal->priv; - g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_obj_removed (priv->listener, uid, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_notify_remove(): could not notify the listener " - "about a removed object"); - - CORBA_exception_free (&ev); -} diff --git a/calendar/cal.h b/calendar/cal.h deleted file mode 100644 index 508f36d56c..0000000000 --- a/calendar/cal.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Evolution calendar client interface object - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_H -#define CAL_H - -#include -#include -#include "evolution-calendar.h" -#include "cal-common.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_TYPE (cal_get_type ()) -#define CAL(obj) (GTK_CHECK_CAST ((obj), CAL_TYPE, Cal)) -#define CAL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_TYPE, CalClass)) -#define IS_CAL(obj) (GTK_CHECK_TYPE ((obj), CAL_TYPE)) -#define IS_CAL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_TYPE)) - -struct _Cal { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalClass { - BonoboObjectClass parent_class; -}; - -GtkType cal_get_type (void); - -Cal *cal_construct (Cal *cal, - Evolution_Calendar_Cal corba_cal, - CalBackend *backend, - Evolution_Calendar_Listener listener); -Evolution_Calendar_Cal cal_corba_object_create (BonoboObject *object); - -Cal *cal_new (CalBackend *backend, Evolution_Calendar_Listener listener); - -void cal_notify_update (Cal *cal, const char *uid); -void cal_notify_remove (Cal *cal, const char *uid); - -POA_Evolution_Calendar_Cal__epv *cal_get_epv (void); - - - -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 2d6fb60ef5..0000000000 --- a/calendar/calendar-conduit-control-applet.c +++ /dev/null @@ -1,360 +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 -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#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"),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; isync_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); - - /* 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 */ - conduit = gpilotd_conduit_mgmt_new("calendar_conduit",pilotId); - 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 9c758b3263..0000000000 --- a/calendar/calendar-conduit.c +++ /dev/null @@ -1,1416 +0,0 @@ -/* $Id$ */ - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#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.11" -#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) - -#define catch_ret_val(_env,ret) \ - if (_env._major != CORBA_NO_EXCEPTION) { \ - g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE,"%s:%d: Caught exception",__FILE__,__LINE__); \ - g_warning ("Exception: %s\n", CORBA_exception_id (&(_env))); \ - CORBA_exception_free(&(_env)); \ - return ret; \ - } - -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_warning ("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_length;i++) { - result = g_slist_prepend(result,g_strdup(uids->_buffer[i])); - } - } else { - INFO ("No entries found"); - } - - CORBA_free(uids); - - return result; -} - -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, - GNOME_Calendar_Repository_ANY, - &(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(GNOME_PILOT_CONDUIT_STANDARD(c)); - } - } -} - -static gint -pre_sync(GnomePilotConduit *c, - GnomePilotDBInfo *dbi, - GCalConduitContext *ctxt) -{ - int l; - gint num_records; - 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")); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("Could not start gnomecal server")); - return -1; - } - - /* Set the counters for the progress bar crap */ - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_ANY, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_MODIFIED, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_updated_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_NEW, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_new_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_DELETED, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_deleted_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - - 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")); - WARN("dlp_ReadAppBlock(...) = %d",l); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("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;xlength;x+=32) { - for(y=x;yrecord[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<ical->recur->weekday & (1<ical->recur->weekday &! (1<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 -#include -#include -#include -#include - -#include "GnomeCal.h" -#include "calobj.h" -#include "calendar.h" -#include "timeutil.h" - -#include -#include - -/* 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 5039bb37b7..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 -#include -#include -#include -#include -#include -#include -#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",CALENDAR_INIT_NIL); - 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 ("\n"); - sync_pilot (repository, link); - printf ("\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 172ef3390e..0000000000 --- a/calendar/calendar.c +++ /dev/null @@ -1,663 +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 -#include -#include -#include -#include -#include "calendar.h" -#include "alarm.h" -#include "timeutil.h" -#include "../libversit/vcc.h" -#include "icalendar.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,CalendarNewOptions options) -{ - Calendar *cal; - - cal = g_new0 (Calendar, 1); - - cal->title = g_strdup (title); - if (options & CALENDAR_USE_ICAL) - cal->format = CAL_ICAL; - else - cal->format = CAL_VCAL; - - 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); - - if (options & CALENDAR_INIT_ALARMS) { - 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); - - stat (fname, &s); - cal->file_time = s.st_mtime; - - calendar_set_day (); - - switch (cal->format) { - case CAL_VCAL: - vcal = Parse_MIME_FromFileName (fname); - if (!vcal) - return "Could not load the calendar"; - calendar_load_from_vobject (cal, vcal); - cleanVObject (vcal); - cleanStrTbl (); - break; - /* - case CAL_ICAL: - icalendar_calendar_load (cal, fname); - break; - */ - default: - return "Unknown calendar format"; - } - - 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_INIT_NIL); - 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 4e077ddd58..0000000000 --- a/calendar/calendar.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef CALENDAR_H -#define CALENDAR_H - -#include "calobj.h" -#include "cal-backend.h" - -BEGIN_GNOME_DECLS - -typedef struct { - /* This calendar's title */ - char *title; - - /* backing store for this calendar object */ - char *filename; - CalendarFormat format; - - /* The list of events; todo's and journal entries */ - GList *events; - GList *todo; - GList *journal; - GList *timezones; /* required for iCalendar */ - - 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; - -typedef enum { - CALENDAR_INIT_NIL = 0, - CALENDAR_INIT_ALARMS = 1 << 0, - CALENDAR_USE_ICAL = 1 << 1 -} CalendarNewOptions; - -Calendar *calendar_new (char *title,CalendarNewOptions options); -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 ce0d330303..0000000000 --- a/calendar/calobj.c +++ /dev/null @@ -1,1608 +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 -#include -#include -#include -#include -#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_new0 (iCalPerson, 1); - ico->organizer->addr = 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; -} - -#if 0 - -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; -} - -#endif - -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; - - /* FIXME!!!!! The UID needs to change!!! */ - - 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 = g_strdup ("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_new0 (iCalPerson, 1); - ical->organizer->addr = g_strdup (str_val (vo)); - free (the_str); - } - - /* related */ - if (has (o, VCRelatedToProp)){ - char *str; - char *s; - iCalRelation *rel; - str = str_val (vo); - for (s = strtok (str, ";"); s; s = strtok (NULL, ";")) { - rel = g_new0 (iCalRelation, 1); - rel->uid = g_strdup (s); - rel->reltype = g_strdup ("PARENT"); - ical->related = g_list_prepend (ical->related, rel); - } - 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_rel_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 (((iCalRelation*)(l->data))->uid) + 1; - - result = g_malloc (len); - - for (p = result, l = values; l; l = l->next) { - int len = strlen (((iCalRelation*)(l->data))->uid); - - strcpy (p, ((iCalRelation*)(l->data))->uid); - - 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)); - - /* Owner/organizer */ - if (ical->organizer && ical->organizer->addr) - addPropValue (o, VCOrgNameProp, ical->organizer->addr); - - /* related */ - if (ical->related) - store_rel_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 (¤t); - - 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 (¤t); - 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 (¤t); - - 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; -} - -/** - * ical_object_find_in_string: - * @uid: Unique identifier of the sought object. - * @vcalobj: String representation of a complete calendar object. - * @ico: The resulting #iCalObject is stored here. - * - * Parses a complete vCalendar object string and tries to find the calendar - * object that matches the specified @uid. If found, it stores the resulting - * #iCalObject in the @ico parameter. - * - * Return value: A result code depending on whether the parse and search were - * successful. - **/ -CalObjFindStatus -ical_object_find_in_string (const char *uid, const char *vcalobj, iCalObject **ico) -{ - VObject *vcal; - VObjectIterator i; - CalObjFindStatus status; - - g_return_val_if_fail (uid != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - g_return_val_if_fail (vcalobj != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - g_return_val_if_fail (ico != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - - *ico = NULL; - status = CAL_OBJ_FIND_NOT_FOUND; - - vcal = Parse_MIME (vcalobj, strlen (vcalobj)); - - if (!vcal) - return CAL_OBJ_FIND_SYNTAX_ERROR; - - initPropIterator (&i, vcal); - - while (moreIteration (&i)) { - VObject *vobj; - VObject *uid_prop; - char *the_str; - - vobj = nextVObject (&i); - - uid_prop = isAPropertyOf (vobj, VCUniqueStringProp); - if (!uid_prop) - continue; - - /* str_val() sets the_str to the string representation of the - * property. - */ - str_val (uid_prop); - - if (strcmp (the_str, uid) == 0) { - const char *object_name; - - object_name = vObjectName (vobj); - *ico = ical_object_create_from_vobject (vobj, object_name); - - if (*ico) - status = CAL_OBJ_FIND_SUCCESS; - } - - free (the_str); - - if (status == CAL_OBJ_FIND_SUCCESS) - break; - } - - cleanVObject (vcal); - cleanStrTbl (); - - return status; -} diff --git a/calendar/calobj.h b/calendar/calobj.h deleted file mode 100644 index 38d9598298..0000000000 --- a/calendar/calobj.h +++ /dev/null @@ -1,263 +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 -#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; /* not used for iCalendar alarms */ - - /* the following pointers are used for iCalendar alarms */ - - char *attach; /* AUDIO, EMAIL, PROC */ - char *desc; /* DISPLAY, EMAIL, PROC */ - char *summary; /* EMAIL */ - char *attendee; /* EMAIL */ - - /* 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 struct { - char *uid; - char *reltype; -} iCalRelation; - -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; - -/* - NOTE: iCalPerson is used for various property values which specify - people (e.g. ATTENDEE, ORGANIZER, etc. Not all fields are valid - under RFC 2445 for all property values, but iCalPerson can store - them anyway. Enforcing the RFC is a job for the parser. -*/ - -typedef struct { - char *addr; - char *name; - char *role; - char *partstat; - gboolean rsvp; - char *cutype; /* calendar user type */ - GList *member; /* group memberships */ - GList *deleg_to; - GList *deleg_from; - char *sent_by; - char *directory; - GList *altrep; /* list of char* URI's */ -} iCalPerson; - -#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 (list of iCalPerson) */ - 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 */ - char *desc; - time_t dtstamp; - time_t dtstart; - time_t dtend; /* also duedate for todo's */ - gboolean date_only; /* set if the start/end times were - specified using dates, not times (internal use, not stored to disk) */ - GList *exdate; /* type: one or more time_t's */ - GList *exrule; /* type: one or more RECUR */ - iCalGeo geo; - time_t last_mod; - char *location; - iCalPerson *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; - - GList *alarms; - - 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); - -typedef enum { - CAL_OBJ_FIND_SUCCESS, - CAL_OBJ_FIND_SYNTAX_ERROR, - CAL_OBJ_FIND_NOT_FOUND -} CalObjFindStatus; - -CalObjFindStatus ical_object_find_in_string (const char *uid, const char *vcalobj, 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 2d6fb60ef5..0000000000 --- a/calendar/conduits/calendar/calendar-conduit-control-applet.c +++ /dev/null @@ -1,360 +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 -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#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"),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; isync_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); - - /* 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 */ - conduit = gpilotd_conduit_mgmt_new("calendar_conduit",pilotId); - 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 9c758b3263..0000000000 --- a/calendar/conduits/calendar/calendar-conduit.c +++ /dev/null @@ -1,1416 +0,0 @@ -/* $Id$ */ - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#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.11" -#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) - -#define catch_ret_val(_env,ret) \ - if (_env._major != CORBA_NO_EXCEPTION) { \ - g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE,"%s:%d: Caught exception",__FILE__,__LINE__); \ - g_warning ("Exception: %s\n", CORBA_exception_id (&(_env))); \ - CORBA_exception_free(&(_env)); \ - return ret; \ - } - -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_warning ("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_length;i++) { - result = g_slist_prepend(result,g_strdup(uids->_buffer[i])); - } - } else { - INFO ("No entries found"); - } - - CORBA_free(uids); - - return result; -} - -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, - GNOME_Calendar_Repository_ANY, - &(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(GNOME_PILOT_CONDUIT_STANDARD(c)); - } - } -} - -static gint -pre_sync(GnomePilotConduit *c, - GnomePilotDBInfo *dbi, - GCalConduitContext *ctxt) -{ - int l; - gint num_records; - 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")); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("Could not start gnomecal server")); - return -1; - } - - /* Set the counters for the progress bar crap */ - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_ANY, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_MODIFIED, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_updated_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_NEW, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_new_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_DELETED, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_deleted_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - - 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")); - WARN("dlp_ReadAppBlock(...) = %d",l); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("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;xlength;x+=32) { - for(y=x;yrecord[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<ical->recur->weekday & (1<ical->recur->weekday &! (1<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 -#include -#include -#include -#include - -#include "GnomeCal.h" -#include "calobj.h" -#include "calendar.h" -#include "timeutil.h" - -#include -#include - -/* 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 -#include -#include -#include - -#include -#include - -#include -#include -#include - -#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"),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 -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include - -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 a86af3c238..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 -#include -#include -#include -#include "gnome-cal.h" -#include "main.h" -#include "alarm.h" -#include "timeutil.h" -#include "../libversit/vcc.h" -#include -#include -#include "GnomeCal.h" -#include "corba-cal-factory.h" -#include "corba-cal.h" - -CORBA_ORB orb; -PortableServer_POA poa; -PortableServer_POAManager poa_manager; - -static POA_Bonobo_GenericFactory__epv calendar_epv; -static POA_Bonobo_GenericFactory__vepv calendar_vepv; - -/* - * Servant and Object Factory - */ -static POA_Bonobo_GenericFactory calendar_servant; -static Bonobo_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_Bonobo_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_Bonobo_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.Bonobo_GenericFactory_epv = &calendar_epv; - calendar_epv.supports = calendar_supports; - calendar_epv.create_object = calendar_create_object; - - calendar_servant.vepv = &calendar_vepv; - POA_Bonobo_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 096baef012..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 init_corba_server (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 6d848ddb87..0000000000 --- a/calendar/corba-cal.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * corba-cal.c: Service that provides access to the calendar repository - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ - -#include -#include -#include -#include -#include "calendar.h" -#include "gnome-cal.h" -#include "alarm.h" -#include "timeutil.h" -#include "../libversit/vcc.h" -#include -#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_long -cal_repo_get_number_of_objects (PortableServer_Servant servant, - GNOME_Calendar_Repository_RecordStatus record_status, - CORBA_Environment *ev) -{ - GnomeCalendar *gcal = gnomecal_from_servant (servant); - CORBA_long res; - GList *l; - iCalPilotState real_record_status; - - if (record_status == GNOME_Calendar_Repository_ANY) { - return g_list_length(gcal->cal->events); - } - - switch (record_status) { - case GNOME_Calendar_Repository_NEW: - real_record_status = ICAL_PILOT_SYNC_MOD; - break; - case GNOME_Calendar_Repository_MODIFIED: - real_record_status = ICAL_PILOT_SYNC_MOD; - break; - case GNOME_Calendar_Repository_DELETED: - real_record_status = ICAL_PILOT_SYNC_DEL; - break; - } - - res = 0; - - for (l = gcal->cal->events; l; l = l->next){ - iCalObject *obj = l->data; - - if (obj->pilot_status == real_record_status) - res ++; - } - - return res; -} - -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",CALENDAR_INIT_NIL); - - 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); - free (str); /* calendar_get_as_vcal_string() uses writeMemVObject(), which uses realloc() */ - 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_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 @@ - - - - - GNOME calendar user's manual - - - Dave Mason - -
- dcm@redhat.com -
-
-
- - Miguel de Icaza - Amozurrutia - -
- miguel@gnu.org -
-
-
-
- - 1998, 1999 Miguel de Icaza, Dave Mason - - - 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. - - 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 - - For more details see the file COPYING in the source - distribution of GNOME. - -
- - - - - Command line options - - - The following command line options are recognized by the - gnomecal 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. - - - - - - - - --events. Displays the events for the - date specified (or today, if no date is specified). - - - - - - --from DATE. 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. - - - - - - --to DATE. 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 - --from option. - - - - - - --file FILE. Set the calendar to the - FILE specified on the command line. - - - - - - --todo. Dumps the to-do values to - standard output. - - - - - - --userfile. 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. - - - - - - --geometry. Used to specity the - startup geometry of the application (location and size). - - - - - - --view VIEWMODE. Use this to specify - the startup view that should be used. - VIEWMODE is one of: dayview, - weekview, monthview, yearview. - - - - - - - - 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". - - - - - Technical information about the GNOME calendar - - - 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. - - - In the future the GNOME calendar will support the upcoming - iCalendar specification as well. - - - If you want to know more about the vCal specification, you can - check the Internet - Mail Consortium (http://www.imc.org) for the details. - - - - - The GNOME Calendar - - Introduction - - - - GNOME Calendar - - - - - Calendar - - - 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 Applications submenu of - the Main Menu. - - - 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. - -
- The GNOME Calendar - - The GNOME Calendar - - - -
-
- Setting Up the GNOME Calendar - - 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 - Preferences menu item from the - Settings menu. -
- The GNOME Calendar Preferences - - The GNOME Calendar Preferences. - - - -
-
- - The Calendar Preferences dialog is broken up into three tabs, Time display, - Colors, and Todo list. - - - Time - This tab is broken up into three main sections: Time format, Weeks - start on, and Day range. - - - Time format - This allows you to choose between a 12 or 24 hour format - clock. - - - 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. - - - 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. - - - 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. - - - 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. - - - Once you have made the changes to the Calendar Preferences you may press the - Apply button to apply them. - -
- - Using the GNOME Calendar - - 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. - - - The Day View - - 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 . - -
- The Day View - - The Day View - - - -
- - TIP - - 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. - - - - 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. - - - 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 Add 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 - Edit and Delete 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 - Delete button. - -
- - The Week View - - 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 - New appointment menu item from the - pop-up 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. - -
- The Week View - - The Week View - - - -
- - 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. - -
- - The Month View - - 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 - . 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 New Appointment in this day item from the - pop-up menu. You may use the items in the - pop-up menu to navigate in the Day, Week, and Year views - by selecting either Jump to this day, - Jump to this week, orJump to this - Year. - -
- The Month View - - The Month View - - - -
-
- - The Year View - - 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 . 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 - New Appointment in this day item from the - pop-up menu. You may use the items in the - pop-up menu to navigate in the Day, Week, and Month - views by selecting either Jump to this day, - Jump to this week, or Jump to this - Month. - -
- The Year View - - The Year View - - - -
-
-
- - Making a New Appointment - - There are many methods for making a new appointment in the GNOME Calendar, - the easiest is by pressing the New 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. - - - 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. - - - - 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. - - - - - 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. - - - - - 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. - - - - - - - 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 Add button. - - -
-
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 Binary files a/calendar/doc/C/images/cal-props.gif and /dev/null differ diff --git a/calendar/doc/C/images/calday.gif b/calendar/doc/C/images/calday.gif deleted file mode 100644 index d708cbb2e7..0000000000 Binary files a/calendar/doc/C/images/calday.gif and /dev/null differ diff --git a/calendar/doc/C/images/calmonth.gif b/calendar/doc/C/images/calmonth.gif deleted file mode 100644 index be20d3255c..0000000000 Binary files a/calendar/doc/C/images/calmonth.gif and /dev/null differ diff --git a/calendar/doc/C/images/calweek.gif b/calendar/doc/C/images/calweek.gif deleted file mode 100644 index 04820f9470..0000000000 Binary files a/calendar/doc/C/images/calweek.gif and /dev/null differ diff --git a/calendar/doc/C/images/calyear.gif b/calendar/doc/C/images/calyear.gif deleted file mode 100644 index 6e2333f419..0000000000 Binary files a/calendar/doc/C/images/calyear.gif and /dev/null 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 a3ec95da07..0000000000 --- a/calendar/eventedit.c +++ /dev/null @@ -1,1584 +0,0 @@ -/* - * EventEditor widget - * Copyright (C) 1998 the Free Software Foundation - * - * Authors: Miguel de Icaza (miguel@kernel.org) - * Federico Mena (quartic@gimp.org) - */ -#include -#include -#include -#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 */ - /* Also here, to ensure that the event is used, we add 86400 secs to get - get next day, in accordance to the RFC */ - ical->recur->_enddate = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ed_end_on)) + 86400; - 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->addr ? - ee->ical->organizer->addr : _("?")); - 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) { - /* Shorten by one day, as we store end-on date a day ahead */ - enddate = ee->ical->recur->enddate - 86400; - } 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 - -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/evolution-calendar.idl b/calendar/evolution-calendar.idl deleted file mode 100644 index bc4266c3ae..0000000000 --- a/calendar/evolution-calendar.idl +++ /dev/null @@ -1,127 +0,0 @@ -/* Evolution calendar interface - * - * Copyright (C) 2000 Eskil Heyn Olsen - * Copyright (C) 2000 Helix Code, Inc. - * - * Authors: Eskil Heyn Olsen - * Federico Mena-Quintero - */ - -#ifndef _EVOLUTION_CALENDAR_IDL_ -#define _EVOLUTION_CALENDAR_IDL_ - -#include - -module Evolution { - -module Calendar { - /* A calendar object (event/todo/journal/etc), represented as an - * iCalendar string. - */ - typedef string CalObj; - - /* An unique identifier for a calendar object */ - typedef string CalObjUID; - - /* Sequence of unique identifiers */ - typedef sequence CalObjUIDSeq; - - /* Flags for getting UID sequences */ - typedef long CalObjType; - const CalObjType TYPE_EVENT = 1 << 0; - const CalObjType TYPE_TODO = 1 << 1; - const CalObjType TYPE_JOURNAL = 1 << 2; - const CalObjType TYPE_OTHER = 1 << 3; - const CalObjType TYPE_ANY = 0x0f; - - /* Used to store a time_t */ - typedef unsigned long Time_t; - - /* An instance of a calendar object that actually occurs. These are - * "virtual" objects in that they are used to represent instances of - * recurring events and alarms. "Real" objects just contain the - * information required to figure out the times at which they recur or - * trigger. - */ - struct CalObjInstance { - CalObjUID uid; - CalObj calobj; - Time_t start; - Time_t end; - }; - - typedef sequence CalObjInstanceSeq; - - interface Listener; - - /* Calendar client interface */ - interface Cal : Bonobo::Unknown { - exception NotFound {}; - exception InvalidRange {}; - exception InvalidObject {}; - - /* A calendar is identified by its URI */ - readonly attribute string uri; - - /* Gets an object based on its URI */ - CalObj get_object (in CalObjUID uid) - raises (NotFound); - - /* Gets a list of UIDs based on object type */ - CalObjUIDSeq get_uids (in CalObjType type); - - /* Gets the events that occur or recur in the specified time range */ - CalObjInstanceSeq get_events_in_range (in Time_t start, in Time_t end) - raises (InvalidRange); - - /* Updates an object by adding it if it does not exist or by - * changing an existing one. - */ - void update_object (in CalObjUID uid, in CalObj calobj) - raises (InvalidObject); - - /* Removes an object */ - void remove_object (in CalObjUID uid) - raises (NotFound); - }; - - /* Listener for changes in a calendar */ - interface Listener : Bonobo::Unknown { - /* Return status when loading a calendar; we need better error reporting */ - enum LoadStatus { - SUCCESS, /* All OK */ - ERROR, /* Generic error */ - IN_USE /* Requested create while a calendar - * with the same URI was in use. - */ - }; - - /* Called from a CalFactory when a calendar is initially loaded - * or created. The listener must remember the cal object. - */ - void cal_loaded (in LoadStatus status, in Cal cal); - - /* Called from a Calendar when an object is added or changed */ - void obj_updated (in CalObjUID uid); - - /* Called from a Calendar when an object is removed */ - void obj_removed (in CalObjUID uid); - }; - - /* A calendar factory, can load and create calendars */ - interface CalFactory : Bonobo::Unknown { - exception NilListener {}; - - /* Load a calendar from an URI */ - void load (in string uri, in Listener listener) - raises (NilListener); - - /* Create a new calendar at the specified URI */ - void create (in string uri, in Listener listener) - raises (NilListener); - }; -}; - -}; - -#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 while -** at the University of North Carolina at Chapel Hill. Later tweaked by -** a couple of people on Usenet. Completely overhauled by Rich $alz -** and Jim Berets 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 -#include - -/* 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 -#include - -/* 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 if that will be used. */ - -#if defined(vms) - -#include -#include - -#else - -#include - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else -#ifdef HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif - -#ifdef timezone -#undef timezone /* needed for sgi */ -#endif - -#if defined(HAVE_SYS_TIMEB_H) -#include -#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 -#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 -#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 tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT -%type tSEC_UNIT tSNUMBER tUNUMBER tZONE -%type 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 - */ - -#include -#include -#include -#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 - */ - -#ifndef GNCAL_DAY_PANEL_H -#define GNCAL_DAY_PANEL_H - -#include -#include -#include -#include -#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 22a0859069..0000000000 --- a/calendar/gncal-day-view.c +++ /dev/null @@ -1,411 +0,0 @@ -/* Day view widget for gncal - * - * Copyright (C) 1998 The Free Software Foundation - * - * Authors: Federico Mena - * Miguel de Icaza - */ - -#include -#include "gncal-day-view.h" -#include "timeutil.h" -#include "view-utils.h" -#include "main.h" -#include "eventedit.h" -#include "popup-menu.h" -#include "quick-view.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); - -#if 0 - else if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - time_t day_begin_time, day_end_time; - GList *list; - GtkWidget *qv; - char date_str [256]; - - strftime (date_str, sizeof (date_str), _("%a %b %d %Y"), - localtime (&dayview->lower)); - qv = quick_view_new (dayview->calendar, date_str, dayview->events); - quick_view_do_popup (QUICK_VIEW (qv), event); - gtk_widget_destroy (qv); - } -#endif - - 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 - */ - -#ifndef GNCAL_DAY_VIEW_H -#define GNCAL_DAY_VIEW_H - - -#include -#include -#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 - * Miguel de Icaza - */ -#include -#include -#include -#include -#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 - */ - -#ifndef GNCAL_FULL_DAY_H -#define GNCAL_FULL_DAY_H - - -#include -#include -#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 64ea8d0638..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 - */ - -#include -#include -#include -#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 - */ -static 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(¤t_time_val); - memcpy(¤t_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 - */ - -#ifndef GNCAL_TODO_H -#define GNCAL_TODO_H - -#include -#include -#include -#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 - * Miguel de Icaza - */ - -#include -#include -#include -#include -#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 - */ - -#ifndef WEEK_VIEW_H -#define WEEK_VIEW_H - - -#include -#include -#include -#include -#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 9ee2a2db9b..0000000000 --- a/calendar/gncal.desktop +++ /dev/null @@ -1,37 +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[gl]=Axenda -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[gl]=Axenda de 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 0e3c475fdf..0000000000 --- a/calendar/gnome-cal.c +++ /dev/null @@ -1,616 +0,0 @@ -/* - * GnomeCalendar widget - * Copyright (C) 1998 the Free Software Foundation - * - * Author: Miguel de Icaza (miguel@kernel.org) - */ -#include -#include -#include -#include -#include -#include -#include "alarm.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, CALENDAR_INIT_ALARMS); - 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); -} - -static 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); - gtk_window_set_modal (GTK_WINDOW (w), FALSE); - 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); - gtk_window_set_modal (GTK_WINDOW (w), FALSE); - 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 - -#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 @@ - - - -

GNOME Calendar Documentation

-

-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). - -

- - -

Command line options

- -Several options are available on the command line, they are: -
    -
  • --events Displays the events for the date - specified (or today, if no date is specified). - -
  • --from DATE 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. - -
  • --to DATE 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 --from option. - -
  • --file FILE Set the calendar to the FILE - specified on the command line. - -
  • --todo Dumps the to-do values to standard output. -
- -

- -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". - - - diff --git a/calendar/gnome-calendar-conduit.png b/calendar/gnome-calendar-conduit.png deleted file mode 100644 index e867ba90b2..0000000000 Binary files a/calendar/gnome-calendar-conduit.png and /dev/null 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 - */ - -#include -#include -#include -#include -#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 - */ - -#ifndef GNOME_MONTH_ITEM_H -#define GNOME_MONTH_ITEM_H - -#include -#include /* why the hell is GtkAnchorType here and not in gtkenums.h? */ -#include - - -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 - */ - -#include -#include -#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 3838c7c0bc..0000000000 --- a/calendar/gui/GnomeCal.idl +++ /dev/null @@ -1,104 +0,0 @@ -#include - -module GNOME { - - module Calendar { - - interface Repository { - - exception NotFound {}; - typedef sequence 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_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_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 of a specific type in the calendar - * repository. - */ - - enum RecordStatus { - ANY, /* This means all records */ - NEW, - MODIFIED, - DELETED - }; - - long get_number_of_objects(in RecordStatus record_status); - - /* - * 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 521a95114b..0000000000 --- a/calendar/gui/Makefile.am +++ /dev/null @@ -1,303 +0,0 @@ -SUBDIRS = doc - -idldir = $(datadir)/idl -idl_DATA = \ - GnomeCal.idl \ - evolution-calendar.idl - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = \ - gnomecal.gnorba \ - tlacuache.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 tlacuache $(extra_pilot_bins) - -ICAL_LINK_FLAGS = ../libical/src/libical/libical.la - -INCLUDES = \ - -I$(includedir) \ - $(BONOBO_VFS_GNOME_CFLAGS) \ - $(GNOME_CONDUIT_INCLUDEDIR) \ - $(PISOCK_INCLUDEDIR) \ - -I../libical/src/libical \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" - -GNOMECAL_CORBA_GENERATED = \ - GnomeCal.h \ - GnomeCal.c \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal-stubs.c - -$(GNOMECAL_CORBA_GENERATED): GnomeCal.idl - orbit-idl $(srcdir)/GnomeCal.idl - -corba-cal.c \ -corba-cal.h \ -corba-cal-factory.c \ -corba-cal-factory.h: GnomeCal.h - -EVOLUTION_CALENDAR_CORBA_GENERATED = \ - evolution-calendar.h \ - evolution-calendar-common.c \ - evolution-calendar-skels.c \ - evolution-calendar-stubs.c - -$(EVOLUTION_CALENDAR_CORBA_GENERATED): evolution-calendar.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl $(srcdir)/evolution-calendar.idl - -gnomecal_SOURCES = \ - $(EVOLUTION_CALENDAR_CORBA_GENERATED) \ - GnomeCal-common.c \ - GnomeCal-skels.c \ - GnomeCal.h \ - alarm.c \ - alarm.h \ - cal-client.c \ - cal-client.h \ - cal-listener.c \ - cal-listener.h \ - cal-util.c \ - cal-util.h \ - calendar.c \ - calendar.h \ - calendar-conduit.h \ - calobj.c \ - calobj.h \ - eventedit.c \ - eventedit.h \ - corba-cal.c \ - corba-cal.h \ - corba-cal-factory.c \ - corba-cal-factory.h \ - getdate.y \ - 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 \ - goto.c \ - icalendar.c \ - icalendar.h \ - 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 - -tlacuache_SOURCES = \ - $(EVOLUTION_CALENDAR_CORBA_GENERATED) \ - alarm.c \ - alarm.h \ - cal.c \ - cal.h \ - cal-backend.c \ - cal-backend.h \ - cal-common.h \ - cal-factory.c \ - cal-factory.h \ - cal-util.c \ - cal-util.h \ - calobj.c \ - calobj.h \ - icalendar.c \ - icalendar.h \ - job.c \ - job.h \ - timeutil.c \ - timeutil.h \ - tlacuache.c - -LINK_FLAGS = \ - $(BONOBO_VFS_GNOME_LIBS) \ - $(INTLLIBS) \ - ../libversit/libversit.la \ - $(ICAL_LINK_FLAGS) - -tlacuache_INCLUDES = \ - $(INCLUDES) \ - -DG_LOG_DOMAIN=\"tlacuache\" - -tlacuache_LDADD = \ - $(BONOBO_VFS_GNOME_LIBS) \ - ../libversit/libversit.la \ - $(ICAL_LINK_FLAGS) - -calendar_pilot_sync_LDADD = \ - $(PISOCK_LIBDIR) $(PISOCK_LIBS) \ - $(LINK_FLAGS) - -noinst_PROGRAMS = tl-test - -tl_test_SOURCES = \ - $(EVOLUTION_CALENDAR_CORBA_GENERATED) \ - cal-client.c \ - cal-client.h \ - cal-listener.c \ - cal-listener.h \ - cal-util.c \ - cal-util.h \ - tl-test.c - -tl_test_INCLUDES = \ - $(INCLUDES) \ - -DG_LOG_DOMAIN=\"tl-test\" - -tl_test_LDADD = \ - $(BONOBO_VFS_GNOME_LIBS) \ - ../libversit/libversit.la - -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_INCLUDES = \ - $(INCLUDES) \ - -DG_LOG_DOMAIN=\"gnomecal\" - -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 \ - bell.xpm \ - recur.xpm \ - $(idl_DATA) \ - $(gnorba_DATA) \ - gnome-calendar-conduit.png - -# todo-conduit-control-applet.desktop \ - - -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 -#include -#include -#include -#include -#include -#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 2dc77e623b..0000000000 --- a/calendar/gui/alarm-notify/alarm.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef ALARM_H -#define ALARM_H - -#include -#include "calobj.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 -#include -#include -#include -#include -#include -#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 2dc77e623b..0000000000 --- a/calendar/gui/alarm.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef ALARM_H -#define ALARM_H - -#include -#include "calobj.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 2d6fb60ef5..0000000000 --- a/calendar/gui/calendar-conduit-control-applet.c +++ /dev/null @@ -1,360 +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 -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#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"),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; isync_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); - - /* 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 */ - conduit = gpilotd_conduit_mgmt_new("calendar_conduit",pilotId); - 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 9c758b3263..0000000000 --- a/calendar/gui/calendar-conduit.c +++ /dev/null @@ -1,1416 +0,0 @@ -/* $Id$ */ - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#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.11" -#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) - -#define catch_ret_val(_env,ret) \ - if (_env._major != CORBA_NO_EXCEPTION) { \ - g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE,"%s:%d: Caught exception",__FILE__,__LINE__); \ - g_warning ("Exception: %s\n", CORBA_exception_id (&(_env))); \ - CORBA_exception_free(&(_env)); \ - return ret; \ - } - -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_warning ("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_length;i++) { - result = g_slist_prepend(result,g_strdup(uids->_buffer[i])); - } - } else { - INFO ("No entries found"); - } - - CORBA_free(uids); - - return result; -} - -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, - GNOME_Calendar_Repository_ANY, - &(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(GNOME_PILOT_CONDUIT_STANDARD(c)); - } - } -} - -static gint -pre_sync(GnomePilotConduit *c, - GnomePilotDBInfo *dbi, - GCalConduitContext *ctxt) -{ - int l; - gint num_records; - 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")); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("Could not start gnomecal server")); - return -1; - } - - /* Set the counters for the progress bar crap */ - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_ANY, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_MODIFIED, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_updated_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_NEW, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_new_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - num_records = GNOME_Calendar_Repository_get_number_of_objects (ctxt->calendar, GNOME_Calendar_Repository_DELETED, &(ctxt->ev)); - catch_ret_val(ctxt->ev,-1); - gnome_pilot_conduit_standard_abs_set_num_deleted_local_records(GNOME_PILOT_CONDUIT_STANDARD_ABS(c), - num_records); - - 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")); - WARN("dlp_ReadAppBlock(...) = %d",l); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("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;xlength;x+=32) { - for(y=x;yrecord[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<ical->recur->weekday & (1<ical->recur->weekday &! (1<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 -#include -#include -#include -#include - -#include "GnomeCal.h" -#include "calobj.h" -#include "calendar.h" -#include "timeutil.h" - -#include -#include - -/* 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 5039bb37b7..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 -#include -#include -#include -#include -#include -#include -#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",CALENDAR_INIT_NIL); - 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 ("\n"); - sync_pilot (repository, link); - printf ("\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 172ef3390e..0000000000 --- a/calendar/gui/calendar.c +++ /dev/null @@ -1,663 +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 -#include -#include -#include -#include -#include "calendar.h" -#include "alarm.h" -#include "timeutil.h" -#include "../libversit/vcc.h" -#include "icalendar.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,CalendarNewOptions options) -{ - Calendar *cal; - - cal = g_new0 (Calendar, 1); - - cal->title = g_strdup (title); - if (options & CALENDAR_USE_ICAL) - cal->format = CAL_ICAL; - else - cal->format = CAL_VCAL; - - 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); - - if (options & CALENDAR_INIT_ALARMS) { - 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); - - stat (fname, &s); - cal->file_time = s.st_mtime; - - calendar_set_day (); - - switch (cal->format) { - case CAL_VCAL: - vcal = Parse_MIME_FromFileName (fname); - if (!vcal) - return "Could not load the calendar"; - calendar_load_from_vobject (cal, vcal); - cleanVObject (vcal); - cleanStrTbl (); - break; - /* - case CAL_ICAL: - icalendar_calendar_load (cal, fname); - break; - */ - default: - return "Unknown calendar format"; - } - - 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_INIT_NIL); - 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 4e077ddd58..0000000000 --- a/calendar/gui/calendar.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef CALENDAR_H -#define CALENDAR_H - -#include "calobj.h" -#include "cal-backend.h" - -BEGIN_GNOME_DECLS - -typedef struct { - /* This calendar's title */ - char *title; - - /* backing store for this calendar object */ - char *filename; - CalendarFormat format; - - /* The list of events; todo's and journal entries */ - GList *events; - GList *todo; - GList *journal; - GList *timezones; /* required for iCalendar */ - - 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; - -typedef enum { - CALENDAR_INIT_NIL = 0, - CALENDAR_INIT_ALARMS = 1 << 0, - CALENDAR_USE_ICAL = 1 << 1 -} CalendarNewOptions; - -Calendar *calendar_new (char *title,CalendarNewOptions options); -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 a86af3c238..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 -#include -#include -#include -#include "gnome-cal.h" -#include "main.h" -#include "alarm.h" -#include "timeutil.h" -#include "../libversit/vcc.h" -#include -#include -#include "GnomeCal.h" -#include "corba-cal-factory.h" -#include "corba-cal.h" - -CORBA_ORB orb; -PortableServer_POA poa; -PortableServer_POAManager poa_manager; - -static POA_Bonobo_GenericFactory__epv calendar_epv; -static POA_Bonobo_GenericFactory__vepv calendar_vepv; - -/* - * Servant and Object Factory - */ -static POA_Bonobo_GenericFactory calendar_servant; -static Bonobo_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_Bonobo_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_Bonobo_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.Bonobo_GenericFactory_epv = &calendar_epv; - calendar_epv.supports = calendar_supports; - calendar_epv.create_object = calendar_create_object; - - calendar_servant.vepv = &calendar_vepv; - POA_Bonobo_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 096baef012..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 init_corba_server (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 6d848ddb87..0000000000 --- a/calendar/gui/corba-cal.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * corba-cal.c: Service that provides access to the calendar repository - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ - -#include -#include -#include -#include -#include "calendar.h" -#include "gnome-cal.h" -#include "alarm.h" -#include "timeutil.h" -#include "../libversit/vcc.h" -#include -#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_long -cal_repo_get_number_of_objects (PortableServer_Servant servant, - GNOME_Calendar_Repository_RecordStatus record_status, - CORBA_Environment *ev) -{ - GnomeCalendar *gcal = gnomecal_from_servant (servant); - CORBA_long res; - GList *l; - iCalPilotState real_record_status; - - if (record_status == GNOME_Calendar_Repository_ANY) { - return g_list_length(gcal->cal->events); - } - - switch (record_status) { - case GNOME_Calendar_Repository_NEW: - real_record_status = ICAL_PILOT_SYNC_MOD; - break; - case GNOME_Calendar_Repository_MODIFIED: - real_record_status = ICAL_PILOT_SYNC_MOD; - break; - case GNOME_Calendar_Repository_DELETED: - real_record_status = ICAL_PILOT_SYNC_DEL; - break; - } - - res = 0; - - for (l = gcal->cal->events; l; l = l->next){ - iCalObject *obj = l->data; - - if (obj->pilot_status == real_record_status) - res ++; - } - - return res; -} - -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",CALENDAR_INIT_NIL); - - 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); - free (str); /* calendar_get_as_vcal_string() uses writeMemVObject(), which uses realloc() */ - 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_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 a3ec95da07..0000000000 --- a/calendar/gui/eventedit.c +++ /dev/null @@ -1,1584 +0,0 @@ -/* - * EventEditor widget - * Copyright (C) 1998 the Free Software Foundation - * - * Authors: Miguel de Icaza (miguel@kernel.org) - * Federico Mena (quartic@gimp.org) - */ -#include -#include -#include -#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 */ - /* Also here, to ensure that the event is used, we add 86400 secs to get - get next day, in accordance to the RFC */ - ical->recur->_enddate = gnome_date_edit_get_date (GNOME_DATE_EDIT (ee->recur_ed_end_on)) + 86400; - 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->addr ? - ee->ical->organizer->addr : _("?")); - 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) { - /* Shorten by one day, as we store end-on date a day ahead */ - enddate = ee->ical->recur->enddate - 86400; - } 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 - -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 while -** at the University of North Carolina at Chapel Hill. Later tweaked by -** a couple of people on Usenet. Completely overhauled by Rich $alz -** and Jim Berets 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 -#include - -/* 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 -#include - -/* 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 if that will be used. */ - -#if defined(vms) - -#include -#include - -#else - -#include - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else -#ifdef HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif - -#ifdef timezone -#undef timezone /* needed for sgi */ -#endif - -#if defined(HAVE_SYS_TIMEB_H) -#include -#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 -#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 -#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 tDAY tDAYZONE tMINUTE_UNIT tMONTH tMONTH_UNIT -%type tSEC_UNIT tSNUMBER tUNUMBER tZONE -%type 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 - */ - -#include -#include -#include -#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 - */ - -#ifndef GNCAL_DAY_PANEL_H -#define GNCAL_DAY_PANEL_H - -#include -#include -#include -#include -#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 22a0859069..0000000000 --- a/calendar/gui/gncal-day-view.c +++ /dev/null @@ -1,411 +0,0 @@ -/* Day view widget for gncal - * - * Copyright (C) 1998 The Free Software Foundation - * - * Authors: Federico Mena - * Miguel de Icaza - */ - -#include -#include "gncal-day-view.h" -#include "timeutil.h" -#include "view-utils.h" -#include "main.h" -#include "eventedit.h" -#include "popup-menu.h" -#include "quick-view.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); - -#if 0 - else if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - time_t day_begin_time, day_end_time; - GList *list; - GtkWidget *qv; - char date_str [256]; - - strftime (date_str, sizeof (date_str), _("%a %b %d %Y"), - localtime (&dayview->lower)); - qv = quick_view_new (dayview->calendar, date_str, dayview->events); - quick_view_do_popup (QUICK_VIEW (qv), event); - gtk_widget_destroy (qv); - } -#endif - - 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 - */ - -#ifndef GNCAL_DAY_VIEW_H -#define GNCAL_DAY_VIEW_H - - -#include -#include -#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 - * Miguel de Icaza - */ -#include -#include -#include -#include -#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 - */ - -#ifndef GNCAL_FULL_DAY_H -#define GNCAL_FULL_DAY_H - - -#include -#include -#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 64ea8d0638..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 - */ - -#include -#include -#include -#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 - */ -static 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(¤t_time_val); - memcpy(¤t_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 - */ - -#ifndef GNCAL_TODO_H -#define GNCAL_TODO_H - -#include -#include -#include -#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 - * Miguel de Icaza - */ - -#include -#include -#include -#include -#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 - */ - -#ifndef WEEK_VIEW_H -#define WEEK_VIEW_H - - -#include -#include -#include -#include -#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 9ee2a2db9b..0000000000 --- a/calendar/gui/gncal.desktop +++ /dev/null @@ -1,37 +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[gl]=Axenda -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[gl]=Axenda de 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 0e3c475fdf..0000000000 --- a/calendar/gui/gnome-cal.c +++ /dev/null @@ -1,616 +0,0 @@ -/* - * GnomeCalendar widget - * Copyright (C) 1998 the Free Software Foundation - * - * Author: Miguel de Icaza (miguel@kernel.org) - */ -#include -#include -#include -#include -#include -#include -#include "alarm.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, CALENDAR_INIT_ALARMS); - 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); -} - -static 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); - gtk_window_set_modal (GTK_WINDOW (w), FALSE); - 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); - gtk_window_set_modal (GTK_WINDOW (w), FALSE); - 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 - -#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 @@ - - - -

GNOME Calendar Documentation

-

-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). - -

- - -

Command line options

- -Several options are available on the command line, they are: -
    -
  • --events Displays the events for the date - specified (or today, if no date is specified). - -
  • --from DATE 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. - -
  • --to DATE 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 --from option. - -
  • --file FILE Set the calendar to the FILE - specified on the command line. - -
  • --todo Dumps the to-do values to standard output. -
- -

- -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". - - - diff --git a/calendar/gui/gnome-calendar-conduit.png b/calendar/gui/gnome-calendar-conduit.png deleted file mode 100644 index e867ba90b2..0000000000 Binary files a/calendar/gui/gnome-calendar-conduit.png and /dev/null 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 - */ - -#include -#include -#include -#include -#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 - */ - -#ifndef GNOME_MONTH_ITEM_H -#define GNOME_MONTH_ITEM_H - -#include -#include /* why the hell is GtkAnchorType here and not in gtkenums.h? */ -#include - - -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 - */ - -#include -#include -#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 4195c464ae..0000000000 --- a/calendar/gui/layout.c +++ /dev/null @@ -1,288 +0,0 @@ -/* Event layout engine for Gnomecal - * - * Copyright (C) 1998 The Free Software Foundation - * - * Authors: Miguel de Icaza - * Federico Mena - */ - -#include -#include -#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 */ -static 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.partition); - 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 - * Federico Mena - */ - -#ifndef LAYOUT_H -#define LAYOUT_H - -#include -#include - - -/* 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 eb1823fc6f..0000000000 --- a/calendar/gui/main.c +++ /dev/null @@ -1,1044 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#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); -} - -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, - - 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, CALENDAR_INIT_ALARMS); - 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, CALENDAR_INIT_ALARMS); - 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->addr, 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 - */ - -#include -#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 - */ - -#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 - */ - -#include -#include -#include -#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 - */ - -#ifndef MONTH_VIEW_H -#define MONTH_VIEW_H - -#include -#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 - */ - -#include -#include -#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 - */ - -#ifndef POPUP_MENU_H -#define POPUP_MENU_H - -#include -#include - - -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 8e91f4d730..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 - * Federico Mena - */ -#include -#ifdef HAVE_LANGINGO_H -#include -#else -#include -#endif -#include -#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 42da747259..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 -#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. - */ -static 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 -#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/test2.vcf b/calendar/gui/test2.vcf deleted file mode 100644 index 6446507989..0000000000 --- a/calendar/gui/test2.vcf +++ /dev/null @@ -1,133 +0,0 @@ -BEGIN:VCALENDAR -PRODID:-//GNOME//NONSGML GnomeCalendar//EN -TZ:MST -VERSION:0.13 -BEGIN:VEVENT -UID:KOrganizer - 8469308861 -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 - 8469308862 -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 - 8469308863 -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 - 18042893834 -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 - 18042893835 -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 - 8469308866 -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 - 18042893837 -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 - 18042893838 -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 -#include -#include -#include - -#include -#include - -#include -#include -#include - -#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"),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 -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include - -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 - * Miguel de Icaza - */ - -#include -#include "view-utils.h" -#include - -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 - */ - -#ifndef VIEW_UTILS_H -#define VIEW_UTILS_H - - -#include -#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 - */ - -#include -#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 - */ - -#ifndef WEEK_VIEW_H -#define WEEK_VIEW_H - -#include -#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 - * Federico Mena - */ - -#include -#include -#include -#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 - * Federico Mena - */ - -#ifndef YEAR_VIEW_H -#define YEAR_VIEW_H - -#include -#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/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/icalendar.c b/calendar/icalendar.c deleted file mode 100644 index 30d91f6858..0000000000 --- a/calendar/icalendar.c +++ /dev/null @@ -1,658 +0,0 @@ -/* - * icalendar server for gnomecal - * - * This module interfaces between libical and the gnomecal internal - * representation - * - * Copyright (C) 1999 The Free Software Foundation - * Authors: - * Russell Steinthal (rms39@columbia.edu) - * - */ - -#include -#include -#include -#include "icalendar.h" -#include "cal-backend.h" - -static time_t icaltime_to_timet (struct icaltimetype* i); -static CalendarAlarm* parse_alarm (icalproperty *prop); -static iCalPerson* parse_person (icalproperty *prop, gchar *value); -static iCalRelation* parse_related (icalproperty *prop); - -/* Duplicate a string without memory leaks */ -static gchar* copy_str (gchar** store, gchar* src) -{ - if (*store) - g_free (*store); - return (*store = g_strdup (src)); -} - -static GList* -copy_to_list (GList** store, gchar* src) -{ - *store = g_list_prepend (*store, g_strdup (src)); - return *store; -} - - -iCalObject * -ical_object_create_from_icalcomponent (icalcomponent* comp) -{ - iCalObject *ical = NULL; - iCalPerson *person; - icalcomponent *subcomp; - icalproperty *prop; - icalparameter *param; - struct icaltimetype ictime; - time_t *pt; - CalendarAlarm *alarm = NULL; - icalcomponent_kind compType; - struct icalgeotype geo; - struct icalperiodtype period; - - gboolean root = FALSE; - gboolean attachment = FALSE; - - char *tmpStr; /* this is a library-owned string */ - - ical = g_new0 (iCalObject, 1); - - compType = icalcomponent_isa (comp); - - switch (compType) { - case ICAL_XROOT_COMPONENT: - root = TRUE; - break; - case ICAL_XATTACH_COMPONENT: - attachment = TRUE; - break; - case ICAL_VEVENT_COMPONENT: - ical->type = ICAL_EVENT; - break; - case ICAL_VTODO_COMPONENT: - ical->type = ICAL_TODO; - break; - case ICAL_VJOURNAL_COMPONENT: - ical->type = ICAL_JOURNAL; - break; - case ICAL_VCALENDAR_COMPONENT: - /* FIXME: what does this mean? */ - break; - case ICAL_VFREEBUSY_COMPONENT: - ical->type = ICAL_FBREQUEST; - /* NOTE: This is not conclusive- you need to analyze - properties to determine whether this is an - FBREQUEST or an FBREPLY */ - break; - case ICAL_VTIMEZONE_COMPONENT: - ical->type = ICAL_TIMEZONE; - break; - case ICAL_VALARM_COMPONENT: - case ICAL_XAUDIOALARM_COMPONENT: - case ICAL_XDISPLAYALARM_COMPONENT: - case ICAL_XEMAILALARM_COMPONENT: - case ICAL_XPROCEDUREALARM_COMPONENT: - /* this should not be reached, since this loop should - only be processing first level components */ - break; - case ICAL_XSTANDARD_COMPONENT: - /* FIXME: what does this mean? */ - break; - case ICAL_XDAYLIGHT_COMPONENT: - /* FIXME: what does this mean? */ - break; - case ICAL_X_COMPONENT: - /* FIXME: what does this mean? */ - break; - case ICAL_VSCHEDULE_COMPONENT: - /* FIXME: what does this mean? */ - break; - case ICAL_XLICINVALID_COMPONENT: - /* FIXME: what does this mean? */ - break; - case ICAL_NO_COMPONENT: - case ICAL_ANY_COMPONENT: - /* should not occur */ - break; - case ICAL_VQUERY_COMPONENT: - case ICAL_VCAR_COMPONENT: - case ICAL_VCOMMAND_COMPONENT: - /* FIXME: what does this mean? */ - break; - } - - prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY); - while (prop) { - switch (icalproperty_isa (prop)) { - case ICAL_CALSCALE_PROPERTY: - if (g_strcasecmp (icalproperty_get_calscale (prop), - "GREGORIAN")) - g_warning ("Unknown calendar format."); - break; - case ICAL_METHOD_PROPERTY: - /* FIXME: implement something here */ - break; - case ICAL_ATTACH_PROPERTY: - /* FIXME: not yet implemented */ - break; - case ICAL_CATEGORIES_PROPERTY: - copy_to_list (&ical->categories, - icalproperty_get_categories (prop)); - break; - case ICAL_CLASS_PROPERTY: - copy_str (&ical->class, icalproperty_get_class (prop)); - break; - case ICAL_COMMENT_PROPERTY: - tmpStr = icalproperty_get_comment (prop); - tmpStr = g_strconcat (icalproperty_get_comment (prop), - ical->comment, - NULL); - if (ical->comment) - g_free (ical->comment); - ical->comment = tmpStr; - break; - case ICAL_DESCRIPTION_PROPERTY: - copy_str (&ical->desc, - icalproperty_get_description (prop)); - break; - case ICAL_GEO_PROPERTY: - geo = icalproperty_get_geo (prop); - ical->geo.latitude = geo.lat; - ical->geo.longitude = geo.lon; - ical->geo.valid = TRUE; - break; - case ICAL_LOCATION_PROPERTY: - copy_str (&ical->location, - icalproperty_get_location (prop)); - break; - case ICAL_PERCENTCOMPLETE_PROPERTY: - ical->percent = icalproperty_get_percentcomplete (prop); - break; - case ICAL_PRIORITY_PROPERTY: - ical->priority = icalproperty_get_priority (prop); - if (ical->priority < 0 || ical->priority > 9) - g_warning ("Priority out-of-range (see RFC2445)"); - break; - case ICAL_RESOURCES_PROPERTY: - copy_to_list (&ical->resources, - icalproperty_get_resources (prop)); - break; - case ICAL_STATUS_PROPERTY: - copy_str (&ical->status, - icalproperty_get_status (prop)); - break; - case ICAL_SUMMARY_PROPERTY: - copy_str (&ical->summary, - icalproperty_get_summary (prop)); - break; - case ICAL_COMPLETED_PROPERTY: - ictime = icalproperty_get_completed (prop); - ical->completed = icaltime_to_timet (&ictime); - break; - case ICAL_DTEND_PROPERTY: - ictime = icalproperty_get_dtend (prop); - ical->dtend = icaltime_to_timet (&ictime); - param = icalproperty_get_first_parameter (prop, - ICAL_VALUE_PARAMETER); - ical->date_only = (icalparameter_get_value (param) == - ICAL_VALUE_DATE); - /* FIXME: We should handle timezone specifiers */ - break; - case ICAL_DUE_PROPERTY: - ictime = icalproperty_get_due (prop); - ical->dtend = icaltime_to_timet (&ictime); - param = icalproperty_get_first_parameter (prop, - ICAL_VALUE_PARAMETER); - ical->date_only = (icalparameter_get_value (param) == - ICAL_VALUE_DATE); - /* FIXME: We should handle timezone specifiers */ - break; - case ICAL_DTSTART_PROPERTY: - ictime = icalproperty_get_dtstart (prop); - ical->dtstart = icaltime_to_timet (&ictime); - param = icalproperty_get_first_parameter (prop, - ICAL_VALUE_PARAMETER); - ical->date_only = (icalparameter_get_value (param) == - ICAL_VALUE_DATE); - /* FIXME: We should handle timezone specifiers */ - break; - case ICAL_DURATION_PROPERTY: - /* FIXME: I don't see the necessary libical function */ - break; - case ICAL_FREEBUSY_PROPERTY: - period = icalproperty_get_freebusy (prop); - ical->dtstart = icaltime_to_timet (&(period.start)); - /* FIXME: period.end is specified as being relative to start, so -this may not be correct */ - ical->dtend = icaltime_to_timet (&(period.end)); - break; - case ICAL_TRANSP_PROPERTY: - tmpStr = icalproperty_get_transp (prop); - /* do not i18n the following string constant! */ - if (!g_strcasecmp (tmpStr, "TRANSPARENT")) - ical->transp = ICAL_TRANSPARENT; - else - ical->transp = ICAL_OPAQUE; - break; - case ICAL_TZID_PROPERTY: - case ICAL_TZNAME_PROPERTY: - case ICAL_TZOFFSETFROM_PROPERTY: - case ICAL_TZOFFSETTO_PROPERTY: - case ICAL_TZURL_PROPERTY: - /* no implementation for now */ - break; - case ICAL_ATTENDEE_PROPERTY: - tmpStr = icalproperty_get_attendee (prop); - person = parse_person (prop, tmpStr); - ical->attendee = g_list_prepend (ical->attendee, - person); - break; - case ICAL_CONTACT_PROPERTY: - tmpStr = icalproperty_get_contact (prop); - person = parse_person (prop, tmpStr); - ical->contact = g_list_prepend (ical->contact, person); - break; - case ICAL_ORGANIZER_PROPERTY: - tmpStr = icalproperty_get_organizer (prop); - person = parse_person (prop, tmpStr); - if (ical->organizer) - g_free (ical->organizer); - ical->organizer = person; - break; - case ICAL_RECURRENCEID_PROPERTY: - ictime = icalproperty_get_recurrenceid (prop); - ical->recurid = icaltime_to_timet (&ictime); - /* FIXME: Range parameter not implemented */ - break; - case ICAL_RELATEDTO_PROPERTY: - ical->related = g_list_prepend (ical->related, - parse_related (prop)); - break; - case ICAL_URL_PROPERTY: - copy_str (&ical->url, - icalproperty_get_url (prop)); - break; - case ICAL_UID_PROPERTY: - copy_str (&ical->uid, - icalproperty_get_uid (prop)); - break; - case ICAL_EXDATE_PROPERTY: - /* FIXME: This does not appear to parse - multiple exdate values in one property, as - allowed by the RFC; needs a libical fix */ - ictime = icalproperty_get_exdate (prop); - pt = g_new0 (time_t, 1); - *pt = icaltime_to_timet (&ictime); - ical->exdate = g_list_prepend (ical->exdate, pt); - break; - case ICAL_EXRULE_PROPERTY: - case ICAL_RDATE_PROPERTY: - case ICAL_RRULE_PROPERTY: - /* FIXME: need recursion processing */ - break; - case ICAL_ACTION_PROPERTY: - case ICAL_REPEAT_PROPERTY: - case ICAL_TRIGGER_PROPERTY: - /* should only occur in VALARM's, handled below */ - g_assert_not_reached(); - break; - case ICAL_CREATED_PROPERTY: - ictime = icalproperty_get_created (prop); - ical->created = icaltime_to_timet (&ictime); - break; - case ICAL_DTSTAMP_PROPERTY: - ictime = icalproperty_get_dtstamp (prop); - ical->dtstamp = icaltime_to_timet (&ictime); - break; - case ICAL_LASTMODIFIED_PROPERTY: - ictime = icalproperty_get_lastmodified (prop); - ical->last_mod = icaltime_to_timet (&ictime); - break; - case ICAL_SEQUENCE_PROPERTY: - ical->seq = icalproperty_get_sequence (prop); - break; - case ICAL_REQUESTSTATUS_PROPERTY: - copy_str (&ical->rstatus, - icalproperty_get_requeststatus (prop)); - break; - case ICAL_X_PROPERTY: - g_warning ("Unsupported X-property: %s", - icalproperty_as_ical_string (prop)); - break; - case ICAL_XLICERROR_PROPERTY: - g_warning ("Unsupported property: %s", - icalproperty_get_xlicerror (prop)); - break; - case ICAL_PRODID_PROPERTY: - case ICAL_VERSION_PROPERTY: - /* nothing to do for this property */ - break; - default: - g_warning ("Unsupported property: %s", icalproperty_as_ical_string -(prop)); - break; - - } - - prop = icalcomponent_get_next_property (comp, - ICAL_ANY_PROPERTY); - } - - /* now parse subcomponents --- should only be VALARM's */ - subcomp = icalcomponent_get_first_component (comp, - ICAL_ANY_COMPONENT); - while (subcomp) { - compType = icalcomponent_isa (subcomp); - switch (compType) { - case ICAL_VALARM_COMPONENT: - alarm = parse_alarm (subcomp); - if (alarm) - ical->alarms = g_list_prepend (ical->alarms, - alarm); - break; - default: - g_warning ("Only nested VALARM components are supported."); - } - - subcomp = icalcomponent_get_next_component (comp, - ICAL_ANY_COMPONENT); - } - - return ical; -} - - -static time_t icaltime_to_timet (struct icaltimetype* i) -{ - extern long timezone; - struct tm t; - time_t ret; - - t.tm_year = i->year - 1900; - t.tm_mon = i->month - 1; - t.tm_mday = i->day; - if (!i->is_date) { - t.tm_hour = i->hour; - t.tm_min = i->minute; - t.tm_sec = i->second; - } else { - t.tm_hour = 0; - t.tm_min = 0; - t.tm_sec = 0; - } - - ret = mktime(&t); - - return ret - (i->is_utc ? timezone : 0); -} - -static iCalPerson* -parse_person (icalproperty* prop, gchar* value) -{ - icalparameter* param; - icalparameter_role role; - icalparameter_partstat partstat; - icalparameter_cutype cutype; - - iCalPerson* ret; - - ret = g_new0 (iCalPerson, 1); - - ret->addr = g_strdup (value); - - param = icalproperty_get_first_parameter (prop, - ICAL_CN_PARAMETER); - ret->name = g_strdup (icalparameter_get_cn (param)); - - param = icalproperty_get_first_parameter (prop, - ICAL_ROLE_PARAMETER); - if (param) { - role = icalparameter_get_role (param); - switch (role) { - case ICAL_ROLE_CHAIR: - ret->role = g_strdup ("CHAIR"); - break; - case ICAL_ROLE_REQPARTICIPANT: - ret->role = g_strdup ("REQPARTICIPANT"); - break; - case ICAL_ROLE_OPTPARTICIPANT: - ret->role = g_strdup ("OPTPARTICIPANT"); - break; - case ICAL_ROLE_NONPARTICIPANT: - ret->role = g_strdup ("NONPARTICIPANT"); - break; - case ICAL_ROLE_XNAME: - default: - ret->role = g_strdup ("UNKNOWN"); - break; - } - } else - ret->role = g_strdup ("REQPARTICIPANT"); - - param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER); - if (param) { - partstat = icalparameter_get_partstat (param); - switch (partstat) { - case ICAL_PARTSTAT_NEEDSACTION: - ret->partstat = g_strdup ("NEEDSACTION"); - break; - case ICAL_PARTSTAT_ACCEPTED: - ret->partstat = g_strdup ("ACCEPTED"); - break; - case ICAL_PARTSTAT_DECLINED: - ret->partstat = g_strdup ("DECLINED"); - break; - case ICAL_PARTSTAT_TENTATIVE: - ret->partstat = g_strdup ("TENTATIVE"); - break; - case ICAL_PARTSTAT_DELEGATED: - ret->partstat = g_strdup ("DELEGATED"); - break; - case ICAL_PARTSTAT_COMPLETED: - ret->partstat = g_strdup ("COMPLETED"); - break; - case ICAL_PARTSTAT_INPROCESS: - ret->partstat = g_strdup ("INPROCESS"); - break; - case ICAL_PARTSTAT_XNAME: - ret->partstat = g_strdup (icalparameter_get_xvalue (param)); - break; - default: - ret->partstat = g_strdup ("UNKNOWN"); - break; - } - } else - ret->partstat = g_strdup ("NEEDSACTION"); - - param = icalproperty_get_first_parameter (prop, ICAL_RSVP_PARAMETER); - if (param) - ret->rsvp = icalparameter_get_rsvp (param); - else - ret->rsvp = FALSE; - - param = icalproperty_get_first_parameter (prop, ICAL_CUTYPE_PARAMETER -); - if (param) { - cutype = icalparameter_get_cutype (param); - switch (cutype) { - case ICAL_CUTYPE_INDIVIDUAL: - ret->cutype = g_strdup ("INDIVIDUAL"); - break; - case ICAL_CUTYPE_GROUP: - ret->cutype = g_strdup ("GROUP"); - break; - case ICAL_CUTYPE_RESOURCE: - ret->cutype = g_strdup ("RESOURCE"); - break; - case ICAL_CUTYPE_ROOM: - ret->cutype = g_strdup ("ROOM"); - break; - case ICAL_CUTYPE_UNKNOWN: - case ICAL_CUTYPE_XNAME: - default: - ret->cutype = g_strdup ("UNKNOWN"); - break; - } - } else - ret->cutype = g_strdup ("INDIVIDUAL"); - - param = icalproperty_get_first_parameter (prop, ICAL_MEMBER_PARAMETER -); - while (param) { - copy_to_list (&ret->member, icalparameter_get_member (param)); - param = icalproperty_get_next_parameter (prop, - ICAL_MEMBER_PARAMETER); - } - - param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDTO_PARAMETER); - while (param) { - copy_to_list (&ret->deleg_to, - icalparameter_get_delegatedto (param)); - param = icalproperty_get_next_parameter (prop, - ICAL_DELEGATEDTO_PARAMETER); - } - - param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER); - while (param) { - copy_to_list (&ret->deleg_from, - icalparameter_get_delegatedfrom (param)); - param = icalproperty_get_next_parameter (prop, - ICAL_DELEGATEDFROM_PARAMETER); - } - - param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER -); - copy_str (&ret->sent_by, - icalparameter_get_sentby (param)); - - param = icalproperty_get_first_parameter (prop, ICAL_DIR_PARAMETER); - while (param) { - copy_to_list (&ret->deleg_to, - icalparameter_get_delegatedto (param)); - param = icalproperty_get_next_parameter (prop, - ICAL_DIR_PARAMETER); - } - - return ret; -} - -static iCalRelation* -parse_related (icalproperty* prop) -{ - iCalRelation* rel; - icalparameter* param; - icalparameter_reltype type; - - rel = g_new0 (iCalRelation, 1); - rel->uid = g_strdup (icalproperty_get_relatedto (prop)); - - param = icalproperty_get_first_parameter (prop, - ICAL_RELTYPE_PARAMETER); - if (param) { - type = icalparameter_get_reltype (param); - switch (type) { - case ICAL_RELTYPE_PARENT: - rel->reltype = g_strdup ("PARENT"); - break; - case ICAL_RELTYPE_CHILD: - rel->reltype = g_strdup ("CHILD"); - break; - case ICAL_RELTYPE_SIBLING: - rel->reltype = g_strdup ("SIBLING"); - break; - case ICAL_RELTYPE_XNAME: - rel->reltype = g_strdup (icalparameter_get_xvalue (param)); - break; - default: - rel->reltype = g_strdup ("UNKNOWN"); - break; - } - } else - rel->reltype = g_strdup ("PARENT"); - - return rel; -} - -#ifdef TEST - -int main(int argc, char* argv[]) -{ - icalcomponent* comp; - comp = icalendar_parse_file (argv[1]); - printf ("%s\n", icalcomponent_as_ical_string (comp)); - return 0; -} - -#endif - - -static CalendarAlarm* -parse_alarm (icalcomponent* comp) -{ - CalendarAlarm *alarm; - icalproperty *prop; - char *tmpStr; - struct icaldurationtype dur; - struct icalattachtype attach; - - g_return_val_if_fail (comp != NULL, NULL); - - alarm = g_new0 (CalendarAlarm, 1); - - prop = icalcomponent_get_first_property (comp, ICAL_ANY_PROPERTY); - while (prop) { - switch (icalproperty_isa (prop)) { - case ICAL_ACTION_PROPERTY: - tmpStr = icalproperty_get_action (prop); - if (!g_strcasecmp (tmpStr, "AUDIO")) - alarm->type = ALARM_AUDIO; - else if (!g_strcasecmp (tmpStr, "DISPLAY")) - alarm->type = ALARM_DISPLAY; - else if (!g_strcasecmp (tmpStr, "EMAIL")) - alarm->type = ALARM_MAIL; - else if (!g_strcasecmp (tmpStr, "PROCEDURE")) - alarm->type = ALARM_PROGRAM; - else - g_warning ("Unsupported alarm type!"); - break; - case ICAL_TRIGGER_PROPERTY: - /* FIXME: waiting on proper libical support */ - break; - case ICAL_REPEAT_PROPERTY: - alarm->snooze_repeat = icalproperty_get_repeat (prop); - break; - case ICAL_DURATION_PROPERTY: - dur = icalproperty_get_duration (prop); - alarm->snooze_secs = icaldurationtype_as_timet (dur); - break; - case ICAL_ATTACH_PROPERTY: - attach = icalproperty_get_attach (prop); - copy_str (&alarm->attach, - icalattachtype_get_url (&attach)); - break; - case ICAL_DESCRIPTION_PROPERTY: - copy_str (&alarm->desc, - icalproperty_get_description (prop)); - break; - case ICAL_SUMMARY_PROPERTY: - copy_str (&alarm->summary, - icalproperty_get_summary (prop)); - break; - case ICAL_ATTENDEE_PROPERTY: - copy_str (&alarm->attendee, - icalproperty_get_attendee (prop)); - break; - default: - g_warning ("Unsupported alarm property: %s", - icalproperty_as_ical_string (prop)); - break; - } - - prop = icalcomponent_get_next_property (comp, - ICAL_ANY_PROPERTY); - } - - return alarm; -} diff --git a/calendar/icalendar.h b/calendar/icalendar.h deleted file mode 100644 index 84993bc3ae..0000000000 --- a/calendar/icalendar.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "ical.h" -#include "calobj.h" -#include "cal-backend.h" - - -iCalObject *ical_object_create_from_icalcomponent (icalcomponent* comp); diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl deleted file mode 100644 index bc4266c3ae..0000000000 --- a/calendar/idl/evolution-calendar.idl +++ /dev/null @@ -1,127 +0,0 @@ -/* Evolution calendar interface - * - * Copyright (C) 2000 Eskil Heyn Olsen - * Copyright (C) 2000 Helix Code, Inc. - * - * Authors: Eskil Heyn Olsen - * Federico Mena-Quintero - */ - -#ifndef _EVOLUTION_CALENDAR_IDL_ -#define _EVOLUTION_CALENDAR_IDL_ - -#include - -module Evolution { - -module Calendar { - /* A calendar object (event/todo/journal/etc), represented as an - * iCalendar string. - */ - typedef string CalObj; - - /* An unique identifier for a calendar object */ - typedef string CalObjUID; - - /* Sequence of unique identifiers */ - typedef sequence CalObjUIDSeq; - - /* Flags for getting UID sequences */ - typedef long CalObjType; - const CalObjType TYPE_EVENT = 1 << 0; - const CalObjType TYPE_TODO = 1 << 1; - const CalObjType TYPE_JOURNAL = 1 << 2; - const CalObjType TYPE_OTHER = 1 << 3; - const CalObjType TYPE_ANY = 0x0f; - - /* Used to store a time_t */ - typedef unsigned long Time_t; - - /* An instance of a calendar object that actually occurs. These are - * "virtual" objects in that they are used to represent instances of - * recurring events and alarms. "Real" objects just contain the - * information required to figure out the times at which they recur or - * trigger. - */ - struct CalObjInstance { - CalObjUID uid; - CalObj calobj; - Time_t start; - Time_t end; - }; - - typedef sequence CalObjInstanceSeq; - - interface Listener; - - /* Calendar client interface */ - interface Cal : Bonobo::Unknown { - exception NotFound {}; - exception InvalidRange {}; - exception InvalidObject {}; - - /* A calendar is identified by its URI */ - readonly attribute string uri; - - /* Gets an object based on its URI */ - CalObj get_object (in CalObjUID uid) - raises (NotFound); - - /* Gets a list of UIDs based on object type */ - CalObjUIDSeq get_uids (in CalObjType type); - - /* Gets the events that occur or recur in the specified time range */ - CalObjInstanceSeq get_events_in_range (in Time_t start, in Time_t end) - raises (InvalidRange); - - /* Updates an object by adding it if it does not exist or by - * changing an existing one. - */ - void update_object (in CalObjUID uid, in CalObj calobj) - raises (InvalidObject); - - /* Removes an object */ - void remove_object (in CalObjUID uid) - raises (NotFound); - }; - - /* Listener for changes in a calendar */ - interface Listener : Bonobo::Unknown { - /* Return status when loading a calendar; we need better error reporting */ - enum LoadStatus { - SUCCESS, /* All OK */ - ERROR, /* Generic error */ - IN_USE /* Requested create while a calendar - * with the same URI was in use. - */ - }; - - /* Called from a CalFactory when a calendar is initially loaded - * or created. The listener must remember the cal object. - */ - void cal_loaded (in LoadStatus status, in Cal cal); - - /* Called from a Calendar when an object is added or changed */ - void obj_updated (in CalObjUID uid); - - /* Called from a Calendar when an object is removed */ - void obj_removed (in CalObjUID uid); - }; - - /* A calendar factory, can load and create calendars */ - interface CalFactory : Bonobo::Unknown { - exception NilListener {}; - - /* Load a calendar from an URI */ - void load (in string uri, in Listener listener) - raises (NilListener); - - /* Create a new calendar at the specified URI */ - void create (in string uri, in Listener listener) - raises (NilListener); - }; -}; - -}; - -#endif diff --git a/calendar/job.c b/calendar/job.c deleted file mode 100644 index d97df6d883..0000000000 --- a/calendar/job.c +++ /dev/null @@ -1,98 +0,0 @@ -/* GNOME personal calendar server - job manager - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include "job.h" - - - -/* The job list */ - -typedef struct { - JobFunc func; - gpointer data; -} Job; - -static GSList *jobs_head; -static GSList *jobs_tail; - -static guint jobs_idle_id; - - - -/* Runs a job and dequeues it */ -static gboolean -run_job (gpointer data) -{ - Job *job; - GSList *l; - - g_assert (jobs_head != NULL); - - job = jobs_head->data; - (* job->func) (job->data); - g_free (job); - - l = jobs_head; - jobs_head = g_slist_remove_link (jobs_head, jobs_head); - g_slist_free_1 (l); - - if (!jobs_head) { - jobs_tail = NULL; - jobs_idle_id = 0; - return FALSE; - } else - return TRUE; -} - -/** - * job_add: - * @func: Function to run the job. - * @data: Data to pass to @function. - * - * Adds a job to the queue. The job will automatically be run asynchronously. - **/ -void -job_add (JobFunc func, gpointer data) -{ - Job *job; - - g_return_if_fail (func != NULL); - - job = g_new (Job, 1); - job->func = func; - job->data = data; - - if (!jobs_head) { - g_assert (jobs_tail == NULL); - g_assert (jobs_idle_id == 0); - - jobs_head = g_slist_append (NULL, job); - jobs_tail = jobs_head; - - jobs_idle_id = g_idle_add (run_job, NULL); - } else { - g_assert (jobs_tail != NULL); - g_assert (jobs_idle_id != 0); - - jobs_tail = g_slist_append (jobs_tail, job)->next; - } -} diff --git a/calendar/job.h b/calendar/job.h deleted file mode 100644 index c9bce24dd4..0000000000 --- a/calendar/job.h +++ /dev/null @@ -1,35 +0,0 @@ -/* GNOME personal calendar server - job manager - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 JOB_H -#define JOB_H - -#include - - - -typedef void (* JobFunc) (gpointer data); - -void job_add (JobFunc func, gpointer data); - - - -#endif diff --git a/calendar/layout.c b/calendar/layout.c deleted file mode 100644 index 4195c464ae..0000000000 --- a/calendar/layout.c +++ /dev/null @@ -1,288 +0,0 @@ -/* Event layout engine for Gnomecal - * - * Copyright (C) 1998 The Free Software Foundation - * - * Authors: Miguel de Icaza - * Federico Mena - */ - -#include -#include -#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 */ -static 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.partition); - 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 - * Federico Mena - */ - -#ifndef LAYOUT_H -#define LAYOUT_H - -#include -#include - - -/* 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 eb1823fc6f..0000000000 --- a/calendar/main.c +++ /dev/null @@ -1,1044 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#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); -} - -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, - - 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, CALENDAR_INIT_ALARMS); - 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, CALENDAR_INIT_ALARMS); - 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->addr, 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 - */ - -#include -#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 - */ - -#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 - */ - -#include -#include -#include -#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 - */ - -#ifndef MONTH_VIEW_H -#define MONTH_VIEW_H - -#include -#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/cal-backend.c b/calendar/pcs/cal-backend.c deleted file mode 100644 index 570c4dccdc..0000000000 --- a/calendar/pcs/cal-backend.c +++ /dev/null @@ -1,1083 +0,0 @@ -/* Evolution calendar backend - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal-backend.h" -#include "calobj.h" -#include "../libversit/vcc.h" -#include "icalendar.h" - - - -/* VCalendar product ID */ -#define PRODID "-//Helix Code//NONSGML Tlacuache//EN" - - - -/* Private part of the CalBackend structure */ -typedef struct { - /* URI where the calendar data is stored */ - GnomeVFSURI *uri; - - /* format of this calendar (ical or vcal) */ - CalendarFormat format; - - /* List of Cal objects with their listeners */ - GList *clients; - - /* All the iCalObject structures in the calendar, hashed by UID. The - * hash key *is* icalobj->uid; it is not copied, so don't free it when - * you remove an object from the hash table. - */ - GHashTable *object_hash; - - /* All events, TODOs, and journals in the calendar */ - GList *events; - GList *todos; - GList *journals; - - /* Whether a calendar has been loaded */ - guint loaded : 1; -} CalBackendPrivate; - - - -static void cal_backend_class_init (CalBackendClass *class); -static void cal_backend_init (CalBackend *backend); -static void cal_backend_destroy (GtkObject *object); - -static GtkObjectClass *parent_class; - - - -/** - * cal_backend_get_type: - * @void: - * - * Registers the #CalBackend class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalBackend class. - **/ -GtkType -cal_backend_get_type (void) -{ - static GtkType cal_backend_type = 0; - - if (!cal_backend_type) { - static const GtkTypeInfo cal_backend_info = { - "CalBackend", - sizeof (CalBackend), - sizeof (CalBackendClass), - (GtkClassInitFunc) cal_backend_class_init, - (GtkObjectInitFunc) cal_backend_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_backend_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_backend_info); - } - - return cal_backend_type; -} - -/* Class initialization function for the calendar backend */ -static void -cal_backend_class_init (CalBackendClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - object_class->destroy = cal_backend_destroy; -} - -/* Object initialization function for the calendar backend */ -static void -cal_backend_init (CalBackend *backend) -{ - CalBackendPrivate *priv; - - priv = g_new0 (CalBackendPrivate, 1); - backend->priv = priv; - - /* FIXME can be CAL_VCAL or CAL_ICAL */ - priv->format = CAL_VCAL; -} - -/* Saves a calendar */ -static void -save (CalBackend *backend) -{ - /* FIXME */ -} - -/* g_hash_table_foreach() callback to destroy an iCalObject */ -static void -free_ical_object (gpointer key, gpointer value, gpointer data) -{ - iCalObject *ico; - - ico = value; - ical_object_destroy (ico); -} - -/* Destroys a backend's data */ -static void -destroy (CalBackend *backend) -{ - CalBackendPrivate *priv; - - priv = backend->priv; - - if (priv->uri) { - gnome_vfs_uri_unref (priv->uri); - priv->uri = NULL; - } - - g_assert (priv->clients == NULL); - - if (priv->object_hash) { - g_hash_table_foreach (priv->object_hash, free_ical_object, NULL); - g_hash_table_destroy (priv->object_hash); - priv->object_hash = NULL; - } - - g_list_free (priv->events); - g_list_free (priv->todos); - g_list_free (priv->journals); - - priv->events = NULL; - priv->todos = NULL; - priv->journals = NULL; - - priv->loaded = FALSE; -} - -/* Destroy handler for the calendar backend */ -static void -cal_backend_destroy (GtkObject *object) -{ - CalBackend *backend; - CalBackendPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_BACKEND (object)); - - backend = CAL_BACKEND (object); - priv = backend->priv; - - if (priv->loaded) - save (backend); - - destroy (backend); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* iCalObject manipulation functions */ - -/* Looks up an object by its UID in the backend's object hash table */ -static iCalObject * -lookup_object (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - iCalObject *ico; - - priv = backend->priv; - ico = g_hash_table_lookup (priv->object_hash, uid); - - return ico; -} - -/* Ensures that an iCalObject has a unique identifier. If it doesn't have one, - * it will create one for it. Returns whether an UID was created or not. - */ -static gboolean -ensure_uid (iCalObject *ico) -{ - char *buf; - gulong str_time; - static guint seqno = 0; - - if (ico->uid) - return FALSE; - - str_time = (gulong) time (NULL); - - /* Is this good enough? */ - - buf = g_strdup_printf ("Evolution-Tlacuache-%d-%ld-%u", (int) getpid(), str_time, seqno++); - ico->uid = buf; - - return TRUE; -} - -/* Adds an object to the calendar backend. Does *not* perform notification to - * calendar clients. - */ -static void -add_object (CalBackend *backend, iCalObject *ico) -{ - CalBackendPrivate *priv; - - g_assert (ico != NULL); - priv = backend->priv; - -#if 0 - /* FIXME: gnomecal old code */ - ico->new = 0; -#endif - - if (ensure_uid (ico)) - /* FIXME: mark the calendar as dirty so that we can re-save it - * with the object's new UID. - */ - ; - - g_hash_table_insert (priv->object_hash, ico->uid, ico); - - switch (ico->type) { - case ICAL_EVENT: - priv->events = g_list_prepend (priv->events, ico); -#if 0 - /* FIXME: gnomecal old code */ - ical_object_try_alarms (ico); -# ifdef DEBUGGING_MAIL_ALARM - ico->malarm.trigger = 0; - calendar_notify (0, ico); -# endif -#endif - break; - - case ICAL_TODO: - priv->todos = g_list_prepend (priv->todos, ico); - break; - - case ICAL_JOURNAL: - priv->journals = g_list_prepend (priv->journals, ico); - break; - - default: - g_assert_not_reached (); - } - -#if 0 - /* FIXME: gnomecal old code */ - ico->last_mod = time (NULL); -#endif -} - -/* Removes an object from the backend's hash and lists. Does not perform - * notification on the clients. - */ -static void -remove_object (CalBackend *backend, iCalObject *ico) -{ - CalBackendPrivate *priv; - GList **list, *l; - - priv = backend->priv; - - g_assert (ico->uid != NULL); - g_hash_table_remove (priv->object_hash, ico->uid); - - switch (ico->type) { - case ICAL_EVENT: - list = &priv->events; - break; - - case ICAL_TODO: - list = &priv->todos; - break; - - case ICAL_JOURNAL: - list = &priv->journals; - break; - - default: - list = NULL; - } - - if (!list) - return; - - l = g_list_find (*list, ico); - g_assert (l != NULL); - - *list = g_list_remove_link (*list, l); - g_list_free_1 (l); - - ical_object_destroy (ico); -} - -/* Load a calendar from a VObject */ -static void -load_from_vobject (CalBackend *backend, VObject *vobject) -{ - CalBackendPrivate *priv; - VObjectIterator i; - - priv = backend->priv; - - g_assert (!priv->loaded); - g_assert (priv->object_hash == NULL); - priv->object_hash = g_hash_table_new (g_str_hash, g_str_equal); - - initPropIterator (&i, vobject); - - while (moreIteration (&i)) { - VObject *this; - iCalObject *ical; - const char *object_name; - - this = nextVObject (&i); - object_name = vObjectName (this); -#if 0 - /* FIXME? What is this used for in gnomecal? */ - if (strcmp (object_name, VCDCreatedProp) == 0) { - cal->created = time_from_isodate (str_val (this)); - continue; - } -#endif - 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); - - /* FIXME: some broken files may have duplicated UIDs. This is - * Bad(tm). Deal with it by creating new UIDs for them and - * spitting some messages to the console. - */ - - if (ical) - add_object (backend, ical); - } -} - -/* Creates a VObject with the base information of a calendar */ -static VObject * -get_calendar_base_vobject (CalBackend *backend) -{ - VObject *vobj; - time_t now; - struct tm tm; - - /* We call localtime for the side effect of setting tzname */ - - now = time (NULL); - tm = *localtime (&now); - - vobj = newVObject (VCCalProp); - - addPropValue (vobj, VCProdIdProp, PRODID); - -#if defined (HAVE_TM_ZONE) - addPropValue (vobj, VCTimeZoneProp, tm.tm_zone); -#elif defined (HAVE_TZNAME) - addPropValue (vobj, VCTimeZoneProp, tzname[0]); -#endif - - /* Per the vCalendar spec, this must be "1.0" */ - addPropValue (vobj, VCVersionProp, "1.0"); - - return vobj; -} - -/* Builds the string representation of a complete calendar object wrapping the - * specified object --- a complete calendar is needed because of the timezone - * information. The return value must be freed with free(), not g_free(), since - * the internal implementation calls writeMemVObject() from libversit, which - * uses realloc() to allocate this string. - */ -static char * -string_from_ical_object (CalBackend *backend, iCalObject *ico) -{ - VObject *vcalobj, *vobj; - char *buf; - - vcalobj = get_calendar_base_vobject (backend); - vobj = ical_object_to_vobject (ico); - addVObjectProp (vcalobj, vobj); - - buf = writeMemVObject (NULL, NULL, vcalobj); - - cleanVObject (vcalobj); - cleanStrTbl (); - - return buf; -} - - - -/** - * cal_backend_new: - * @void: - * - * Creates a new empty calendar backend. A calendar must then be loaded or - * created before the backend can be used. - * - * Return value: A newly-created calendar backend. - **/ -CalBackend * -cal_backend_new (void) -{ - return CAL_BACKEND (gtk_type_new (CAL_BACKEND_TYPE)); -} - -/** - * cal_backend_get_uri: - * @backend: A calendar backend. - * - * Queries the URI of a calendar backend, which must already have a loaded - * calendar. - * - * Return value: The URI where the calendar is stored. - **/ -GnomeVFSURI * -cal_backend_get_uri (CalBackend *backend) -{ - CalBackendPrivate *priv; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - g_assert (priv->uri != NULL); - - return priv->uri; -} - -/* Callback used when a Cal is destroyed */ -static void -cal_destroy_cb (GtkObject *object, gpointer data) -{ - Cal *cal; - Cal *lcal; - CalBackend *backend; - CalBackendPrivate *priv; - GList *l; - - cal = CAL (object); - - backend = CAL_BACKEND (data); - priv = backend->priv; - - /* Find the cal in the list of clients */ - - for (l = priv->clients; l; l = l->next) { - lcal = CAL (l->data); - - if (lcal == cal) - break; - } - - g_assert (l != NULL); - - /* Disconnect */ - - priv->clients = g_list_remove_link (priv->clients, l); - g_list_free_1 (l); - - /* When all clients go away, the backend can go away, too. Commit - * suicide here. - */ - - if (!priv->clients) - gtk_object_unref (GTK_OBJECT (backend)); -} - -/** - * cal_backend_add_cal: - * @backend: A calendar backend. - * @cal: A calendar client interface object. - * - * Adds a calendar client interface object to a calendar @backend. The calendar - * backend must already have a loaded calendar. - **/ -void -cal_backend_add_cal (CalBackend *backend, Cal *cal) -{ - CalBackendPrivate *priv; - - g_return_if_fail (backend != NULL); - g_return_if_fail (IS_CAL_BACKEND (backend)); - - priv = backend->priv; - g_return_if_fail (priv->loaded); - - g_return_if_fail (cal != NULL); - g_return_if_fail (IS_CAL (cal)); - - /* We do not keep a reference to the Cal since the calendar user agent - * owns it. - */ - - gtk_signal_connect (GTK_OBJECT (cal), "destroy", - GTK_SIGNAL_FUNC (cal_destroy_cb), - backend); - - priv->clients = g_list_prepend (priv->clients, cal); -} - - -static icalcomponent* -icalendar_parse_file (char* fname) -{ - FILE* fp; - icalcomponent* comp = NULL; - gchar* str; - struct stat st; - int n; - - fp = fopen (fname, "r"); - if (!fp) { - g_warning ("Cannot open open calendar file."); - return NULL; - } - - stat (fname, &st); - - str = g_malloc (st.st_size + 2); - - n = fread ((gchar*) str, 1, st.st_size, fp); - if (n != st.st_size) { - g_warning ("Read error."); - } - str[n] = '\0'; - - fclose (fp); - - comp = icalparser_parse_string (str); - g_free (str); - - return comp; -} - - -static void -icalendar_calendar_load (CalBackend * cal, char* fname) -{ - icalcomponent *comp; - icalcomponent *subcomp; - iCalObject *ical; - - comp = icalendar_parse_file (fname); - subcomp = icalcomponent_get_first_component (comp, - ICAL_ANY_COMPONENT); - while (subcomp) { - ical = ical_object_create_from_icalcomponent (subcomp); - if (ical->type != ICAL_EVENT && - ical->type != ICAL_TODO && - ical->type != ICAL_JOURNAL) { - g_warning ("Skipping unsupported iCalendar component."); - } else - add_object (cal, ical); - subcomp = icalcomponent_get_next_component (comp, - ICAL_ANY_COMPONENT); - } -} - - -/* -ics is to be used to designate a file containing (an arbitrary set of) -calendaring and scheduling information. - -ifb is to be used to designate a file containing free or busy time -information. - -anything else is assumed to be a vcal file. -*/ - -static CalendarFormat -cal_get_type_from_filename (char *str_uri) -{ - int len; - - if (str_uri == NULL) - return CAL_VCAL; - - len = strlen (str_uri); - if (len < 5) - return CAL_VCAL; - - if (str_uri[ len-4 ] == '.' && - str_uri[ len-3 ] == 'i' && - str_uri[ len-2 ] == 'c' && - str_uri[ len-1 ] == 's') - return CAL_ICAL; - - if (str_uri[ len-4 ] == '.' && - str_uri[ len-3 ] == 'i' && - str_uri[ len-2 ] == 'f' && - str_uri[ len-1 ] == 'b') - return CAL_ICAL; - - return CAL_VCAL; -} - - -/** - * cal_backend_load: - * @backend: A calendar backend. - * @uri: URI that contains the calendar data. - * - * Loads a calendar backend with data from a calendar stored at the specified - * URI. - * - * Return value: An operation status code. - **/ -CalBackendLoadStatus -cal_backend_load (CalBackend *backend, GnomeVFSURI *uri) -{ - CalBackendPrivate *priv; - VObject *vobject; - char *str_uri; - - g_return_val_if_fail (backend != NULL, CAL_BACKEND_LOAD_ERROR); - g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_LOAD_ERROR); - - priv = backend->priv; - g_return_val_if_fail (!priv->loaded, CAL_BACKEND_LOAD_ERROR); - - g_return_val_if_fail (uri != NULL, CAL_BACKEND_LOAD_ERROR); - - /* FIXME: this looks rather bad; maybe we should check for local files - * and fail if they are remote. - */ - - str_uri = gnome_vfs_uri_to_string (uri, - (GNOME_VFS_URI_HIDE_USER_NAME - | GNOME_VFS_URI_HIDE_PASSWORD - | GNOME_VFS_URI_HIDE_HOST_NAME - | GNOME_VFS_URI_HIDE_HOST_PORT - | GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD)); - - - /* look at the extension on the filename and decide - if this is a ical or vcal file */ - - priv->format = cal_get_type_from_filename (str_uri); - - /* load */ - - switch (priv->format) { - case CAL_VCAL: - vobject = Parse_MIME_FromFileName (str_uri); - - if (!vobject) - return CAL_BACKEND_LOAD_ERROR; - - load_from_vobject (backend, vobject); - cleanVObject (vobject); - cleanStrTbl (); - break; - case CAL_ICAL: - icalendar_calendar_load (backend, str_uri); - break; - default: - return CAL_BACKEND_LOAD_ERROR; - } - - g_free (str_uri); - - gnome_vfs_uri_ref (uri); - - priv->uri = uri; - priv->loaded = TRUE; - return CAL_BACKEND_LOAD_SUCCESS; -} - -/** - * cal_backend_create: - * @backend: A calendar backend. - * @uri: URI that will contain the calendar data. - * - * Creates a new empty calendar in a calendar backend. - **/ -void -cal_backend_create (CalBackend *backend, GnomeVFSURI *uri) -{ - CalBackendPrivate *priv; - - g_return_if_fail (backend != NULL); - g_return_if_fail (IS_CAL_BACKEND (backend)); - - priv = backend->priv; - g_return_if_fail (!priv->loaded); - - g_return_if_fail (uri != NULL); - - /* Create the new calendar information */ - - g_assert (priv->object_hash == NULL); - priv->object_hash = g_hash_table_new (g_str_hash, g_str_equal); - - /* Done */ - - gnome_vfs_uri_ref (uri); - - priv->uri = uri; - priv->loaded = TRUE; -} - -/** - * cal_backend_get_object: - * @backend: A calendar backend. - * @uid: Unique identifier for a calendar object. - * - * Queries a calendar backend for a calendar object based on its unique - * identifier. - * - * Return value: The string representation of a complete calendar wrapping the - * the sought object, or NULL if no object had the specified UID. A complete - * calendar is returned because you also need the timezone data. - **/ -char * -cal_backend_get_object (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - iCalObject *ico; - char *buf, *retval; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - - g_return_val_if_fail (uid != NULL, NULL); - - g_assert (priv->object_hash != NULL); - - ico = lookup_object (backend, uid); - - if (!ico) - return NULL; - - /* string_from_ical_object() uses writeMemVObject(), which uses - * realloc(), so we must free its result with free() instead of - * g_free(). We take a copy of the result so that callers can use the - * normal glib function to free it. - */ - - buf = string_from_ical_object (backend, ico); - retval = g_strdup (buf); - free (buf); - - return retval; -} - -struct get_uids_closure { - CalObjType type; - GList *uid_list; -}; - -/* Builds a list of UIDs for objects that match the sought type. Called from - * g_hash_table_foreach(). - */ -static void -build_uids_list (gpointer key, gpointer value, gpointer data) -{ - iCalObject *ico; - struct get_uids_closure *c; - gboolean store; - - ico = value; - c = data; - - store = FALSE; - - if (c->type & CALOBJ_TYPE_ANY) - store = TRUE; - else if (ico->type == ICAL_EVENT) - store = (c->type & CALOBJ_TYPE_EVENT) ? TRUE : FALSE; - else if (ico->type == ICAL_TODO) - store = (c->type & CALOBJ_TYPE_TODO) ? TRUE : FALSE; - else if (ico->type == ICAL_JOURNAL) - store = (c->type & CALOBJ_TYPE_JOURNAL) ? TRUE : FALSE; - else - store = (c->type & CALOBJ_TYPE_OTHER) ? TRUE : FALSE; - - if (store) - c->uid_list = g_list_prepend (c->uid_list, g_strdup (ico->uid)); -} - -/** - * cal_backend_get_uids: - * @backend: A calendar backend. - * @type: Bitmask with types of objects to return. - * - * Builds a list of unique identifiers corresponding to calendar objects whose - * type matches one of the types specified in the @type flags. - * - * Return value: A list of strings that are the sought UIDs. - **/ -GList * -cal_backend_get_uids (CalBackend *backend, CalObjType type) -{ - CalBackendPrivate *priv; - struct get_uids_closure c; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - - /* We go through the hash table instead of the lists of particular - * object types so that we can pick up CALOBJ_TYPE_OTHER objects. - */ - - c.type = type; - c.uid_list = NULL; - g_hash_table_foreach (priv->object_hash, build_uids_list, &c); - - return c.uid_list; -} - -struct build_event_list_closure { - CalBackend *backend; - GList *event_list; -}; - -/* Builds a sorted list of event object instances. Used as a callback from - * ical_object_generate_events(). - */ -static int -build_event_list (iCalObject *ico, time_t start, time_t end, void *data) -{ - CalObjInstance *icoi; - struct build_event_list_closure *c; - - c = data; - - icoi = g_new (CalObjInstance, 1); - - g_assert (ico->uid != NULL); - icoi->uid = g_strdup (ico->uid); - icoi->calobj = string_from_ical_object (c->backend, ico); - icoi->start = start; - icoi->end = end; - - c->event_list = g_list_prepend (c->event_list, icoi); - - return TRUE; -} - -/* Compares two CalObjInstance structures by their start times. Called from - * g_list_sort(). - */ -static gint -compare_instance_func (gconstpointer a, gconstpointer b) -{ - const CalObjInstance *ca, *cb; - time_t diff; - - ca = a; - cb = b; - - diff = ca->start - cb->start; - return (diff < 0) ? -1 : (diff > 0) ? 1 : 0; -} - -/** - * cal_backend_get_events_in_range: - * @backend: A calendar backend. - * @start: Start time for query. - * @end: End time for query. - * - * Builds a sorted list of calendar event object instances that occur or recur - * within the specified time range. Each object instance contains the object - * itself and the start/end times at which it occurs or recurs. - * - * Return value: A list of calendar event object instances, sorted by their - * start times. - **/ -GList * -cal_backend_get_events_in_range (CalBackend *backend, time_t start, time_t end) -{ - CalBackendPrivate *priv; - struct build_event_list_closure c; - GList *l; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - - g_return_val_if_fail (start != -1 && end != -1, NULL); - g_return_val_if_fail (start <= end, NULL); - - c.backend = backend; - c.event_list = NULL; - - for (l = priv->events; l; l = l->next) { - iCalObject *ico; - - ico = l->data; - ical_object_generate_events (ico, start, end, build_event_list, &c); - } - - c.event_list = g_list_sort (c.event_list, compare_instance_func); - return c.event_list; -} - -/* Notifies a backend's clients that an object was updated */ -static void -notify_update (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - GList *l; - - priv = backend->priv; - - for (l = priv->clients; l; l = l->next) { - Cal *cal; - - cal = CAL (l->data); - cal_notify_update (cal, uid); - } -} - -/* Notifies a backend's clients that an object was removed */ -static void -notify_remove (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - GList *l; - - priv = backend->priv; - - for (l = priv->clients; l; l = l->next) { - Cal *cal; - - cal = CAL (l->data); - cal_notify_remove (cal, uid); - } -} - -/** - * cal_backend_update_object: - * @backend: A calendar backend. - * @uid: Unique identifier of the object to update. - * @calobj: String representation of the new calendar object. - * - * Updates an object in a calendar backend. It will replace any existing object - * that has the same UID as the specified one. The backend will in turn notify - * all of its clients about the change. - * - * Return value: TRUE on success, FALSE on being passed an invalid object. - **/ -gboolean -cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj) -{ - CalBackendPrivate *priv; - iCalObject *ico, *new_ico; - CalObjFindStatus status; - - g_return_val_if_fail (backend != NULL, FALSE); - g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - g_return_val_if_fail (calobj != NULL, FALSE); - - /* Pull the object from the string */ - - status = ical_object_find_in_string (uid, calobj, &new_ico); - - if (status != CAL_OBJ_FIND_SUCCESS) - return FALSE; - - /* Update the object */ - - ico = lookup_object (backend, uid); - - if (ico) - remove_object (backend, ico); - - add_object (backend, new_ico); - - /* FIXME: do the notification asynchronously */ - - notify_update (backend, new_ico->uid); - return TRUE; -} - -/** - * cal_backend_remove_object: - * @backend: A calendar backend. - * @uid: Unique identifier of the object to remove. - * - * Removes an object in a calendar backend. The backend will notify all of its - * clients about the change. - * - * Return value: TRUE on success, FALSE on being passed an UID for an object - * that does not exist in the backend. - **/ -gboolean -cal_backend_remove_object (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - iCalObject *ico; - - g_return_val_if_fail (backend != NULL, FALSE); - g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - - ico = lookup_object (backend, uid); - if (!ico) - return FALSE; - - remove_object (backend, ico); - - /* FIXME: do the notification asynchronously */ - - notify_remove (backend, uid); - return TRUE; -} diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h deleted file mode 100644 index 21c516126d..0000000000 --- a/calendar/pcs/cal-backend.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Evolution calendar backend - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_BACKEND_H -#define CAL_BACKEND_H - -#include -#include -#include "evolution-calendar.h" -#include "cal-common.h" -#include "cal.h" -#include "cal-util.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_BACKEND_TYPE (cal_backend_get_type ()) -#define CAL_BACKEND(obj) (GTK_CHECK_CAST ((obj), CAL_BACKEND_TYPE, CalBackend)) -#define CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_BACKEND_TYPE, \ - CalBackendClass)) -#define IS_CAL_BACKEND(obj) (GTK_CHECK_TYPE ((obj), CAL_BACKEND_TYPE)) -#define IS_CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_TYPE)) - -/* Load status values */ -typedef enum { - CAL_BACKEND_LOAD_SUCCESS, /* Loading OK */ - CAL_BACKEND_LOAD_ERROR /* We need better error reporting in libversit */ -} CalBackendLoadStatus; - -struct _CalBackend { - GtkObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalBackendClass { - GtkObjectClass parent_class; -}; - -typedef enum { - CAL_VCAL, - CAL_ICAL -} CalendarFormat; - -GtkType cal_backend_get_type (void); - -CalBackend *cal_backend_new (void); - -GnomeVFSURI *cal_backend_get_uri (CalBackend *backend); - -void cal_backend_add_cal (CalBackend *backend, Cal *cal); -void cal_backend_remove_cal (CalBackend *backend, Cal *cal); - -CalBackendLoadStatus cal_backend_load (CalBackend *backend, GnomeVFSURI *uri); - -void cal_backend_create (CalBackend *backend, GnomeVFSURI *uri); - -char *cal_backend_get_object (CalBackend *backend, const char *uid); - -GList *cal_backend_get_uids (CalBackend *backend, CalObjType type); - -GList *cal_backend_get_events_in_range (CalBackend *backend, time_t start, time_t end); - -gboolean cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj); - -gboolean cal_backend_remove_object (CalBackend *backend, const char *uid); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/cal-common.h b/calendar/pcs/cal-common.h deleted file mode 100644 index e51ddf1bdd..0000000000 --- a/calendar/pcs/cal-common.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Evolution calendar server - common declarations - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_COMMON_H -#define CAL_COMMON_H - -#include - -BEGIN_GNOME_DECLS - - - -typedef struct _CalBackend CalBackend; -typedef struct _CalBackendClass CalBackendClass; - -typedef struct _Cal Cal; -typedef struct _CalClass CalClass; - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c deleted file mode 100644 index a170718678..0000000000 --- a/calendar/pcs/cal-factory.c +++ /dev/null @@ -1,681 +0,0 @@ -/* Evolution calendar factory - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include "cal.h" -#include "cal-backend.h" -#include "cal-factory.h" -#include "job.h" - - - -/* Private part of the CalFactory structure */ -typedef struct { - /* Hash table from GnomeVFSURI structures to CalBackend objects */ - GHashTable *backends; -} CalFactoryPrivate; - - - -static void cal_factory_class_init (CalFactoryClass *class); -static void cal_factory_init (CalFactory *factory); -static void cal_factory_destroy (GtkObject *object); - -static POA_Evolution_Calendar_CalFactory__vepv cal_factory_vepv; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_factory_get_type: - * @void: - * - * Registers the #CalFactory class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalFactory class. - **/ -GtkType -cal_factory_get_type (void) -{ - static GtkType cal_factory_type = 0; - - if (!cal_factory_type) { - static const GtkTypeInfo cal_factory_info = { - "CalFactory", - sizeof (CalFactory), - sizeof (CalFactoryClass), - (GtkClassInitFunc) cal_factory_class_init, - (GtkObjectInitFunc) cal_factory_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_factory_type = gtk_type_unique (bonobo_object_get_type (), &cal_factory_info); - } - - return cal_factory_type; -} - -/* CORBA class initialization function for the calendar factory */ -static void -init_cal_factory_corba_class (void) -{ - cal_factory_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_factory_vepv.Evolution_Calendar_CalFactory_epv = cal_factory_get_epv (); -} - -/* Class initialization function for the calendar factory */ -static void -cal_factory_class_init (CalFactoryClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = cal_factory_destroy; - - init_cal_factory_corba_class (); -} - -/* Object initialization function for the calendar factory */ -static void -cal_factory_init (CalFactory *factory) -{ - CalFactoryPrivate *priv; - - priv = g_new0 (CalFactoryPrivate, 1); - factory->priv = priv; - - priv->backends = g_hash_table_new (gnome_vfs_uri_hash, gnome_vfs_uri_hequal); -} - -/* Frees a uri/backend pair from the backends hash table */ -static void -free_backend (gpointer key, gpointer value, gpointer data) -{ - GnomeVFSURI *uri; - CalBackend *backend; - - uri = key; - backend = value; - - gnome_vfs_uri_unref (uri); - gtk_object_unref (GTK_OBJECT (backend)); -} - -/* Destroy handler for the calendar */ -static void -cal_factory_destroy (GtkObject *object) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_FACTORY (object)); - - factory = CAL_FACTORY (object); - priv = factory->priv; - - /* Should we assert that there are no more backends? */ - - g_hash_table_foreach (priv->backends, free_backend, NULL); - g_hash_table_destroy (priv->backends); - priv->backends = NULL; - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* CORBA servant implementation */ - -/* CalFactory::load method */ -static void -CalFactory_load (PortableServer_Servant servant, - const CORBA_char *uri, - Evolution_Calendar_Listener listener, - CORBA_Environment *ev) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - CORBA_Environment ev2; - gboolean result; - - factory = CAL_FACTORY (bonobo_object_from_servant (servant)); - priv = factory->priv; - - CORBA_exception_init (&ev2); - result = CORBA_Object_is_nil (listener, &ev2); - - if (ev2._major != CORBA_NO_EXCEPTION || result) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_CalFactory_NilListener, - NULL); - - CORBA_exception_free (&ev2); - return; - } - CORBA_exception_free (&ev2); - - cal_factory_load (factory, uri, listener); -} - -/* CalFactory::create method */ -static void -CalFactory_create (PortableServer_Servant servant, - const CORBA_char *uri, - Evolution_Calendar_Listener listener, - CORBA_Environment *ev) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - - factory = CAL_FACTORY (bonobo_object_from_servant (servant)); - priv = factory->priv; - - cal_factory_create (factory, uri, listener); -} - -/** - * cal_factory_get_epv: - * @void: - * - * Creates an EPV for the CalFactory CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_CalFactory__epv * -cal_factory_get_epv (void) -{ - POA_Evolution_Calendar_CalFactory__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_CalFactory__epv, 1); - epv->load = CalFactory_load; - epv->create = CalFactory_create; - - return epv; -} - - - -/* Loading and creating calendars */ - -/* Job data */ -typedef struct { - CalFactory *factory; - char *uri; - Evolution_Calendar_Listener listener; -} LoadCreateJobData; - -/* Looks up a calendar backend in a factory's hash table of uri->cal */ -static CalBackend * -lookup_backend (CalFactory *factory, GnomeVFSURI *uri) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - - priv = factory->priv; - - backend = g_hash_table_lookup (priv->backends, uri); - return backend; -} - -/* Callback used when a backend is destroyed */ -static void -backend_destroy_cb (GtkObject *object, gpointer data) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - CalBackend *backend; - GnomeVFSURI *uri; - gpointer orig_key; - gboolean result; - GnomeVFSURI *orig_uri; - - factory = CAL_FACTORY (data); - priv = factory->priv; - - /* Remove the backend from the hash table */ - - backend = CAL_BACKEND (object); - uri = cal_backend_get_uri (backend); - g_assert (uri != NULL); - - result = g_hash_table_lookup_extended (priv->backends, uri, &orig_key, NULL); - g_assert (result != FALSE); - - orig_uri = orig_key; - - g_hash_table_remove (priv->backends, orig_uri); - gnome_vfs_uri_unref (orig_uri); - - /* If there are no more backends, then the factory can go away */ - - if (g_hash_table_size (priv->backends) == 0) - bonobo_object_unref (BONOBO_OBJECT (factory)); -} - -/* Adds a backend to the calendar factory's hash table */ -static void -add_backend (CalFactory *factory, GnomeVFSURI *uri, CalBackend *backend) -{ - CalFactoryPrivate *priv; - - priv = factory->priv; - - gnome_vfs_uri_ref (uri); - g_hash_table_insert (priv->backends, uri, backend); - - gtk_signal_connect (GTK_OBJECT (backend), "destroy", - GTK_SIGNAL_FUNC (backend_destroy_cb), - factory); -} - -/* Loads a calendar backend and puts it in the factory's backend hash table */ -static CalBackend * -load_backend (CalFactory *factory, GnomeVFSURI *uri) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - CalBackendLoadStatus status; - - priv = factory->priv; - - backend = cal_backend_new (); - if (!backend) { - g_message ("load_backend(): could not create the backend"); - return NULL; - } - - status = cal_backend_load (backend, uri); - - switch (status) { - case CAL_BACKEND_LOAD_SUCCESS: - add_backend (factory, uri, backend); - return backend; - - case CAL_BACKEND_LOAD_ERROR: - gtk_object_unref (GTK_OBJECT (backend)); - return NULL; - - default: - g_assert_not_reached (); - return NULL; - } -} - -/* Creates a calendar backend and puts it in the factory's backend hash table */ -static CalBackend * -create_backend (CalFactory *factory, GnomeVFSURI *uri) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - - priv = factory->priv; - - backend = cal_backend_new (); - if (!backend) { - g_message ("create_backend(): could not create the backend"); - return NULL; - } - - cal_backend_create (backend, uri); - add_backend (factory, uri, backend); - - return backend; -} - -/* Adds a listener to a calendar backend by creating a calendar client interface - * object. - */ -static void -add_calendar_client (CalFactory *factory, CalBackend *backend, Evolution_Calendar_Listener listener) -{ - Cal *cal; - CORBA_Environment ev; - - cal = cal_new (backend, listener); - if (!cal) { - g_message ("add_calendar_client(): could not create the calendar client interface"); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("add_calendar_client(): could not notify the listener"); - - CORBA_exception_free (&ev); - return; - } - - cal_backend_add_cal (backend, cal); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_SUCCESS, - bonobo_object_corba_objref (BONOBO_OBJECT (cal)), - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("add_calendar_client(): could not notify the listener"); - bonobo_object_unref (BONOBO_OBJECT (cal)); - } - - CORBA_exception_free (&ev); -} - -/* Job handler for the load calendar command */ -static void -load_fn (gpointer data) -{ - LoadCreateJobData *jd; - CalFactory *factory; - GnomeVFSURI *uri; - Evolution_Calendar_Listener listener; - CalBackend *backend; - CORBA_Environment ev; - - jd = data; - - /* Look up the calendar */ - - uri = gnome_vfs_uri_new (jd->uri); - g_free (jd->uri); - - factory = jd->factory; - listener = jd->listener; - g_free (jd); - - /* Look up the backend and create it if needed */ - - backend = lookup_backend (factory, uri); - - if (!backend) - backend = load_backend (factory, uri); - - if (!backend) { - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("load_fn(): could not notify the listener"); - - CORBA_exception_free (&ev); - goto out; - } - - add_calendar_client (factory, backend, listener); - - out: - - gnome_vfs_uri_unref (uri); - - CORBA_exception_init (&ev); - CORBA_Object_release (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("load_fn(): could not release the listener"); - - CORBA_exception_free (&ev); -} - -/* Job handler for the create calendar command */ -static void -create_fn (gpointer data) -{ - LoadCreateJobData *jd; - CalFactory *factory; - GnomeVFSURI *uri; - Evolution_Calendar_Listener listener; - CalBackend *backend; - CORBA_Environment ev; - - jd = data; - factory = jd->factory; - - uri = gnome_vfs_uri_new (jd->uri); - g_free (jd->uri); - - factory = jd->factory; - listener = jd->listener; - g_free (jd); - - /* Check that the backend is not in use */ - - backend = lookup_backend (factory, uri); - - if (backend) { - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_IN_USE, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("create_fn(): could not notify the listener"); - - CORBA_exception_free (&ev); - goto out; - } - - /* Create the backend */ - - backend = create_backend (factory, uri); - - if (!backend) { - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("create_fn(): could not notify the listener"); - - CORBA_exception_free (&ev); - goto out; - } - - add_calendar_client (factory, backend, listener); - - out: - - gnome_vfs_uri_unref (uri); - - CORBA_exception_init (&ev); - CORBA_Object_release (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("create_fn(): could not release the listener"); - - CORBA_exception_free (&ev); -} - - - -/** - * cal_factory_construct: - * @factory: A calendar factory. - * @corba_factory: CORBA object for the calendar factory. - * - * Constructs a calendar factory by binding the corresponding CORBA object to - * it. - * - * Return value: The same object as the @factory argument. - **/ -CalFactory * -cal_factory_construct (CalFactory *factory, Evolution_Calendar_CalFactory corba_factory) -{ - g_return_val_if_fail (factory != NULL, NULL); - g_return_val_if_fail (IS_CAL_FACTORY (factory), NULL); - - bonobo_object_construct (BONOBO_OBJECT (factory), corba_factory); - return factory; -} - -/** - * cal_factory_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar factory @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_CalFactory -cal_factory_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_CalFactory *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL_FACTORY (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_CalFactory *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_factory_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_CalFactory__init ((PortableServer_Servant) servant, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_factory_corba_object_create(): could not init the servant"); - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_CalFactory) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_factory_new: - * @void: - * - * Creates a new #CalFactory object. - * - * Return value: A newly-created #CalFactory, or NULL if its corresponding CORBA - * object could not be created. - **/ -CalFactory * -cal_factory_new (void) -{ - CalFactory *factory; - CORBA_Environment ev; - Evolution_Calendar_CalFactory corba_factory; - gboolean retval; - - factory = gtk_type_new (CAL_FACTORY_TYPE); - - corba_factory = cal_factory_corba_object_create (BONOBO_OBJECT (factory)); - - CORBA_exception_init (&ev); - retval = CORBA_Object_is_nil (corba_factory, &ev); - - if (ev._major != CORBA_NO_EXCEPTION || retval) { - g_message ("cal_factory_new(): could not create the CORBA factory"); - bonobo_object_unref (BONOBO_OBJECT (factory)); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - return cal_factory_construct (factory, corba_factory); -} - -/* Queues a load or create request */ -static void -queue_load_create_job (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener, - JobFunc func) -{ - LoadCreateJobData *jd; - CORBA_Environment ev; - Evolution_Calendar_Listener listener_copy; - gboolean result; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("queue_load_create_job(): could not see if the listener was NIL"); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) { - g_message ("queue_load_create_job(): cannot operate on a NIL listener!"); - return; - } - - listener_copy = CORBA_Object_duplicate (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("queue_load_create_job(): could not duplicate the listener"); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - jd = g_new (LoadCreateJobData, 1); - jd->factory = factory; - jd->uri = g_strdup (uri); - jd->listener = listener_copy; - - job_add (func, jd); -} - -/** - * cal_factory_load: - * @factory: A calendar factory. - * @uri: URI of calendar to load. - * @listener: Listener for notification of the load result. - * - * Initiates a load request in a calendar factory. A calendar will be loaded - * asynchronously and the result code will be reported to the specified - * listener. - **/ -void -cal_factory_load (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener) -{ - queue_load_create_job (factory, uri, listener, load_fn); -} - -void -cal_factory_create (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener) -{ - queue_load_create_job (factory, uri, listener, create_fn); -} diff --git a/calendar/pcs/cal-factory.h b/calendar/pcs/cal-factory.h deleted file mode 100644 index 9d5fd57e2c..0000000000 --- a/calendar/pcs/cal-factory.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Evolution calendar factory - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_FACTORY_H -#define CAL_FACTORY_H - -#include -#include -#include "evolution-calendar.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_FACTORY_TYPE (cal_factory_get_type ()) -#define CAL_FACTORY(obj) (GTK_CHECK_CAST ((obj), CAL_FACTORY_TYPE, CalFactory)) -#define CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_FACTORY_TYPE, \ - CalFactoryClass)) -#define IS_CAL_FACTORY(obj) (GTK_CHECK_TYPE ((obj), CAL_FACTORY_TYPE)) -#define IS_CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_FACTORY_TYPE)) - -typedef struct _CalFactory CalFactory; -typedef struct _CalFactoryClass CalFactoryClass; - -struct _CalFactory { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalFactoryClass { - BonoboObjectClass parent_class; -}; - -GtkType cal_factory_get_type (void); - -CalFactory *cal_factory_construct (CalFactory *factory, Evolution_Calendar_CalFactory corba_factory); -Evolution_Calendar_CalFactory cal_factory_corba_object_create (BonoboObject *object); - -CalFactory *cal_factory_new (void); - -void cal_factory_load (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener); -void cal_factory_create (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener); - -POA_Evolution_Calendar_CalFactory__epv *cal_factory_get_epv (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c deleted file mode 100644 index 8263bfe491..0000000000 --- a/calendar/pcs/cal.c +++ /dev/null @@ -1,559 +0,0 @@ -/* Evolution calendar client interface object - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include "cal.h" -#include "cal-backend.h" - - - -/* Private part of the Cal structure */ -typedef struct { - /* Our backend */ - CalBackend *backend; - - /* Listener on the client we notify */ - Evolution_Calendar_Listener listener; -} CalPrivate; - - - -static void cal_class_init (CalClass *class); -static void cal_init (Cal *cal); -static void cal_destroy (GtkObject *object); - -static POA_Evolution_Calendar_Cal__vepv cal_vepv; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_get_type: - * @void: - * - * Registers the #Cal class if necessary, and returns the type ID associated to - * it. - * - * Return value: The type ID of the #Cal class. - **/ -GtkType -cal_get_type (void) -{ - static GtkType cal_type = 0; - - if (!cal_type) { - static const GtkTypeInfo cal_info = { - "Cal", - sizeof (Cal), - sizeof (CalClass), - (GtkClassInitFunc) cal_class_init, - (GtkObjectInitFunc) cal_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_type = gtk_type_unique (BONOBO_OBJECT_TYPE, &cal_info); - } - - return cal_type; -} - -/* CORBA class initialzation function for the calendar */ -static void -init_cal_corba_class (void) -{ - cal_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_vepv.Evolution_Calendar_Cal_epv = cal_get_epv (); -} - -/* Class initialization function for the calendar */ -static void -cal_class_init (CalClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (BONOBO_OBJECT_TYPE); - - object_class->destroy = cal_destroy; - - init_cal_corba_class (); -} - -/* Object initialization function for the calendar */ -static void -cal_init (Cal *cal) -{ - CalPrivate *priv; - - priv = g_new0 (CalPrivate, 1); - cal->priv = priv; - - priv->listener = CORBA_OBJECT_NIL; -} - -/* Destroy handler for the calendar */ -static void -cal_destroy (GtkObject *object) -{ - Cal *cal; - CalPrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL (object)); - - cal = CAL (object); - priv = cal->priv; - - priv->backend = NULL; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_destroy(): could not release the listener"); - - CORBA_exception_free (&ev); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* CORBA servant implementation */ - -/* Cal::get_uri method */ -static CORBA_char * -Cal_get_uri (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - GnomeVFSURI *uri; - char *str_uri; - CORBA_char *str_uri_copy; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - uri = cal_backend_get_uri (priv->backend); - str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); - str_uri_copy = CORBA_string_dup (str_uri); - g_free (str_uri); - - return str_uri_copy; - -} - -/* Cal::get_object method */ -static Evolution_Calendar_CalObj -Cal_get_object (PortableServer_Servant servant, - const Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - char *calobj; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - calobj = cal_backend_get_object (priv->backend, uid); - - if (calobj) { - CORBA_char *calobj_copy; - - calobj_copy = CORBA_string_dup (calobj); - g_free (calobj); - return calobj_copy; - } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_NotFound, - NULL); - return NULL; - } -} - -/* Cal::get_uids method */ -static Evolution_Calendar_CalObjUIDSeq * -Cal_get_uids (PortableServer_Servant servant, - const Evolution_Calendar_CalObjType type, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - GList *uids, *l; - Evolution_Calendar_CalObjUIDSeq *seq; - int t; - int n, i; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - /* Translate the CORBA flags to our own flags */ - - t = (((type & Evolution_Calendar_TYPE_EVENT) ? CALOBJ_TYPE_EVENT : 0) - | ((type & Evolution_Calendar_TYPE_TODO) ? CALOBJ_TYPE_TODO : 0) - | ((type & Evolution_Calendar_TYPE_JOURNAL) ? CALOBJ_TYPE_JOURNAL : 0) - | ((type & Evolution_Calendar_TYPE_OTHER) ? CALOBJ_TYPE_OTHER : 0) - | ((type & Evolution_Calendar_TYPE_ANY) ? CALOBJ_TYPE_ANY : 0)); - - uids = cal_backend_get_uids (priv->backend, t); - n = g_list_length (uids); - - seq = Evolution_Calendar_CalObjUIDSeq__alloc (); - CORBA_sequence_set_release (seq, TRUE); - seq->_length = n; - seq->_buffer = CORBA_sequence_Evolution_Calendar_CalObjUID_allocbuf (n); - - /* Fill the sequence */ - - for (i = 0, l = uids; l; i++, l = l->next) { - char *uid; - - uid = l->data; - - seq->_buffer[i] = CORBA_string_dup (uid); - } - - /* Done */ - - cal_obj_uid_list_free (uids); - - return seq; -} - -/* Cal::get_events_in_range method */ -static Evolution_Calendar_CalObjInstanceSeq * -Cal_get_events_in_range (PortableServer_Servant servant, - const Evolution_Calendar_Time_t start, - const Evolution_Calendar_Time_t end, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - time_t t_start, t_end; - Evolution_Calendar_CalObjInstanceSeq *seq; - GList *elist, *l; - int n, i; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - t_start = (time_t) start; - t_end = (time_t) end; - - if (t_start > t_end || t_start == -1 || t_end == -1) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_InvalidRange, - NULL); - return NULL; - } - - /* Figure out the list and allocate the sequence */ - - elist = cal_backend_get_events_in_range (priv->backend, t_start, t_end); - n = g_list_length (elist); - - seq = Evolution_Calendar_CalObjInstanceSeq__alloc (); - CORBA_sequence_set_release (seq, TRUE); - seq->_length = n; - seq->_buffer = CORBA_sequence_Evolution_Calendar_CalObjInstance_allocbuf (n); - - /* Fill the sequence */ - - for (i = 0, l = elist; l; i++, l = l->next) { - CalObjInstance *icoi; - Evolution_Calendar_CalObjInstance *corba_icoi; - - icoi = l->data; - corba_icoi = &seq->_buffer[i]; - - corba_icoi->uid = CORBA_string_dup (icoi->uid); - corba_icoi->calobj = CORBA_string_dup (icoi->calobj); - corba_icoi->start = icoi->start; - corba_icoi->end = icoi->end; - } - - /* Done */ - - cal_obj_instance_list_free (elist); - - return seq; -} - -/* Cal::update_object method */ -static void -Cal_update_object (PortableServer_Servant servant, - const Evolution_Calendar_CalObjUID uid, - const Evolution_Calendar_CalObj calobj, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - if (!cal_backend_update_object (priv->backend, uid, calobj)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_InvalidObject, - NULL); -} - -/* Cal::remove_object method */ -static void -Cal_remove_object (PortableServer_Servant servant, - const Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - if (!cal_backend_remove_object (priv->backend, uid)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_NotFound, - NULL); -} - -/** - * cal_get_epv: - * @void: - * - * Creates an EPV for the Cal CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_Cal__epv * -cal_get_epv (void) -{ - POA_Evolution_Calendar_Cal__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_Cal__epv, 1); - epv->_get_uri = Cal_get_uri; - epv->get_object = Cal_get_object; - epv->get_uids = Cal_get_uids; - epv->get_events_in_range = Cal_get_events_in_range; - epv->update_object = Cal_update_object; - epv->remove_object = Cal_remove_object; - - return epv; -} - - - -/** - * cal_construct: - * @cal: A calendar client interface. - * @corba_cal: CORBA object for the calendar. - * @backend: Calendar backend that this @cal presents an interface to. - * @listener: Calendar listener for notification. - * - * Constructs a calendar client interface object by binding the corresponding - * CORBA object to it. The calendar interface is bound to the specified - * @backend, and will notify the @listener about changes to the calendar. - * - * Return value: The same object as the @cal argument. - **/ -Cal * -cal_construct (Cal *cal, - Evolution_Calendar_Cal corba_cal, - CalBackend *backend, - Evolution_Calendar_Listener listener) -{ - CalPrivate *priv; - CORBA_Environment ev; - - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (IS_CAL (cal), NULL); - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = cal->priv; - - CORBA_exception_init (&ev); - priv->listener = CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_construct: could not duplicate the listener"); - priv->listener = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - priv->backend = backend; - - bonobo_object_construct (BONOBO_OBJECT (cal), corba_cal); - return cal; -} - -/** - * cal_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar client interface @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_Cal -cal_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_Cal *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_Cal *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_Cal__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_corba_object_create(): could not init the servant"); - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_Cal) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_new: - * @backend: A calendar backend. - * @listener: A calendar listener. - * - * Creates a new calendar client interface object and binds it to the specified - * @backend and @listener objects. - * - * Return value: A newly-created #Cal calendar client interface object, or NULL - * if its corresponding CORBA object could not be created. - **/ -Cal * -cal_new (CalBackend *backend, Evolution_Calendar_Listener listener) -{ - Cal *cal, *retval; - Evolution_Calendar_Cal corba_cal; - CORBA_Environment ev; - gboolean ret; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - cal = CAL (gtk_type_new (CAL_TYPE)); - corba_cal = cal_corba_object_create (BONOBO_OBJECT (cal)); - - CORBA_exception_init (&ev); - ret = CORBA_Object_is_nil ((CORBA_Object) corba_cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION || ret) { - g_message ("cal_new(): could not create the CORBA object"); - bonobo_object_unref (BONOBO_OBJECT (cal)); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - retval = cal_construct (cal, corba_cal, backend, listener); - if (!retval) { - g_message ("cal_new(): could not construct the calendar client interface"); - bonobo_object_unref (BONOBO_OBJECT (cal)); - return NULL; - } - - return retval; -} - -/** - * cal_notify_update: - * @cal: A calendar client interface. - * @uid: UID of object that was updated. - * - * Notifies a listener attached to a calendar client interface object about an - * update to a calendar object. - **/ -void -cal_notify_update (Cal *cal, const char *uid) -{ - CalPrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (cal != NULL); - g_return_if_fail (IS_CAL (cal)); - g_return_if_fail (uid != NULL); - - priv = cal->priv; - g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_obj_updated (priv->listener, uid, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_notify_update(): could not notify the listener " - "about an updated object"); - - CORBA_exception_free (&ev); -} - -/** - * cal_notify_remove: - * @cal: A calendar client interface. - * @uid: UID of object that was removed. - * - * Notifies a listener attached to a calendar client interface object about a - * calendar object that was removed. - **/ -void -cal_notify_remove (Cal *cal, const char *uid) -{ - CalPrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (cal != NULL); - g_return_if_fail (IS_CAL (cal)); - g_return_if_fail (uid != NULL); - - priv = cal->priv; - g_return_if_fail (priv->listener != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_obj_removed (priv->listener, uid, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_notify_remove(): could not notify the listener " - "about a removed object"); - - CORBA_exception_free (&ev); -} diff --git a/calendar/pcs/cal.h b/calendar/pcs/cal.h deleted file mode 100644 index 508f36d56c..0000000000 --- a/calendar/pcs/cal.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Evolution calendar client interface object - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 CAL_H -#define CAL_H - -#include -#include -#include "evolution-calendar.h" -#include "cal-common.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_TYPE (cal_get_type ()) -#define CAL(obj) (GTK_CHECK_CAST ((obj), CAL_TYPE, Cal)) -#define CAL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_TYPE, CalClass)) -#define IS_CAL(obj) (GTK_CHECK_TYPE ((obj), CAL_TYPE)) -#define IS_CAL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_TYPE)) - -struct _Cal { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalClass { - BonoboObjectClass parent_class; -}; - -GtkType cal_get_type (void); - -Cal *cal_construct (Cal *cal, - Evolution_Calendar_Cal corba_cal, - CalBackend *backend, - Evolution_Calendar_Listener listener); -Evolution_Calendar_Cal cal_corba_object_create (BonoboObject *object); - -Cal *cal_new (CalBackend *backend, Evolution_Calendar_Listener listener); - -void cal_notify_update (Cal *cal, const char *uid); -void cal_notify_remove (Cal *cal, const char *uid); - -POA_Evolution_Calendar_Cal__epv *cal_get_epv (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c deleted file mode 100644 index ce0d330303..0000000000 --- a/calendar/pcs/calobj.c +++ /dev/null @@ -1,1608 +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 -#include -#include -#include -#include -#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_new0 (iCalPerson, 1); - ico->organizer->addr = 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; -} - -#if 0 - -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; -} - -#endif - -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; - - /* FIXME!!!!! The UID needs to change!!! */ - - 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 = g_strdup ("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_new0 (iCalPerson, 1); - ical->organizer->addr = g_strdup (str_val (vo)); - free (the_str); - } - - /* related */ - if (has (o, VCRelatedToProp)){ - char *str; - char *s; - iCalRelation *rel; - str = str_val (vo); - for (s = strtok (str, ";"); s; s = strtok (NULL, ";")) { - rel = g_new0 (iCalRelation, 1); - rel->uid = g_strdup (s); - rel->reltype = g_strdup ("PARENT"); - ical->related = g_list_prepend (ical->related, rel); - } - 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_rel_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 (((iCalRelation*)(l->data))->uid) + 1; - - result = g_malloc (len); - - for (p = result, l = values; l; l = l->next) { - int len = strlen (((iCalRelation*)(l->data))->uid); - - strcpy (p, ((iCalRelation*)(l->data))->uid); - - 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)); - - /* Owner/organizer */ - if (ical->organizer && ical->organizer->addr) - addPropValue (o, VCOrgNameProp, ical->organizer->addr); - - /* related */ - if (ical->related) - store_rel_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 (¤t); - - 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 (¤t); - 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 (¤t); - - 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; -} - -/** - * ical_object_find_in_string: - * @uid: Unique identifier of the sought object. - * @vcalobj: String representation of a complete calendar object. - * @ico: The resulting #iCalObject is stored here. - * - * Parses a complete vCalendar object string and tries to find the calendar - * object that matches the specified @uid. If found, it stores the resulting - * #iCalObject in the @ico parameter. - * - * Return value: A result code depending on whether the parse and search were - * successful. - **/ -CalObjFindStatus -ical_object_find_in_string (const char *uid, const char *vcalobj, iCalObject **ico) -{ - VObject *vcal; - VObjectIterator i; - CalObjFindStatus status; - - g_return_val_if_fail (uid != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - g_return_val_if_fail (vcalobj != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - g_return_val_if_fail (ico != NULL, CAL_OBJ_FIND_SYNTAX_ERROR); - - *ico = NULL; - status = CAL_OBJ_FIND_NOT_FOUND; - - vcal = Parse_MIME (vcalobj, strlen (vcalobj)); - - if (!vcal) - return CAL_OBJ_FIND_SYNTAX_ERROR; - - initPropIterator (&i, vcal); - - while (moreIteration (&i)) { - VObject *vobj; - VObject *uid_prop; - char *the_str; - - vobj = nextVObject (&i); - - uid_prop = isAPropertyOf (vobj, VCUniqueStringProp); - if (!uid_prop) - continue; - - /* str_val() sets the_str to the string representation of the - * property. - */ - str_val (uid_prop); - - if (strcmp (the_str, uid) == 0) { - const char *object_name; - - object_name = vObjectName (vobj); - *ico = ical_object_create_from_vobject (vobj, object_name); - - if (*ico) - status = CAL_OBJ_FIND_SUCCESS; - } - - free (the_str); - - if (status == CAL_OBJ_FIND_SUCCESS) - break; - } - - cleanVObject (vcal); - cleanStrTbl (); - - return status; -} diff --git a/calendar/pcs/calobj.h b/calendar/pcs/calobj.h deleted file mode 100644 index 38d9598298..0000000000 --- a/calendar/pcs/calobj.h +++ /dev/null @@ -1,263 +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 -#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; /* not used for iCalendar alarms */ - - /* the following pointers are used for iCalendar alarms */ - - char *attach; /* AUDIO, EMAIL, PROC */ - char *desc; /* DISPLAY, EMAIL, PROC */ - char *summary; /* EMAIL */ - char *attendee; /* EMAIL */ - - /* 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 struct { - char *uid; - char *reltype; -} iCalRelation; - -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; - -/* - NOTE: iCalPerson is used for various property values which specify - people (e.g. ATTENDEE, ORGANIZER, etc. Not all fields are valid - under RFC 2445 for all property values, but iCalPerson can store - them anyway. Enforcing the RFC is a job for the parser. -*/ - -typedef struct { - char *addr; - char *name; - char *role; - char *partstat; - gboolean rsvp; - char *cutype; /* calendar user type */ - GList *member; /* group memberships */ - GList *deleg_to; - GList *deleg_from; - char *sent_by; - char *directory; - GList *altrep; /* list of char* URI's */ -} iCalPerson; - -#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 (list of iCalPerson) */ - 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 */ - char *desc; - time_t dtstamp; - time_t dtstart; - time_t dtend; /* also duedate for todo's */ - gboolean date_only; /* set if the start/end times were - specified using dates, not times (internal use, not stored to disk) */ - GList *exdate; /* type: one or more time_t's */ - GList *exrule; /* type: one or more RECUR */ - iCalGeo geo; - time_t last_mod; - char *location; - iCalPerson *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; - - GList *alarms; - - 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); - -typedef enum { - CAL_OBJ_FIND_SUCCESS, - CAL_OBJ_FIND_SYNTAX_ERROR, - CAL_OBJ_FIND_NOT_FOUND -} CalObjFindStatus; - -CalObjFindStatus ical_object_find_in_string (const char *uid, const char *vcalobj, 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/pcs/job.c b/calendar/pcs/job.c deleted file mode 100644 index d97df6d883..0000000000 --- a/calendar/pcs/job.c +++ /dev/null @@ -1,98 +0,0 @@ -/* GNOME personal calendar server - job manager - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include "job.h" - - - -/* The job list */ - -typedef struct { - JobFunc func; - gpointer data; -} Job; - -static GSList *jobs_head; -static GSList *jobs_tail; - -static guint jobs_idle_id; - - - -/* Runs a job and dequeues it */ -static gboolean -run_job (gpointer data) -{ - Job *job; - GSList *l; - - g_assert (jobs_head != NULL); - - job = jobs_head->data; - (* job->func) (job->data); - g_free (job); - - l = jobs_head; - jobs_head = g_slist_remove_link (jobs_head, jobs_head); - g_slist_free_1 (l); - - if (!jobs_head) { - jobs_tail = NULL; - jobs_idle_id = 0; - return FALSE; - } else - return TRUE; -} - -/** - * job_add: - * @func: Function to run the job. - * @data: Data to pass to @function. - * - * Adds a job to the queue. The job will automatically be run asynchronously. - **/ -void -job_add (JobFunc func, gpointer data) -{ - Job *job; - - g_return_if_fail (func != NULL); - - job = g_new (Job, 1); - job->func = func; - job->data = data; - - if (!jobs_head) { - g_assert (jobs_tail == NULL); - g_assert (jobs_idle_id == 0); - - jobs_head = g_slist_append (NULL, job); - jobs_tail = jobs_head; - - jobs_idle_id = g_idle_add (run_job, NULL); - } else { - g_assert (jobs_tail != NULL); - g_assert (jobs_idle_id != 0); - - jobs_tail = g_slist_append (jobs_tail, job)->next; - } -} diff --git a/calendar/pcs/job.h b/calendar/pcs/job.h deleted file mode 100644 index c9bce24dd4..0000000000 --- a/calendar/pcs/job.h +++ /dev/null @@ -1,35 +0,0 @@ -/* GNOME personal calendar server - job manager - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 JOB_H -#define JOB_H - -#include - - - -typedef void (* JobFunc) (gpointer data); - -void job_add (JobFunc func, gpointer data); - - - -#endif diff --git a/calendar/pcs/tlacuache.c b/calendar/pcs/tlacuache.c deleted file mode 100644 index 35bb585862..0000000000 --- a/calendar/pcs/tlacuache.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Tlacuache - personal calendar server main module - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include -#include -#include "cal-factory.h" -#include "calobj.h" - - - -/* Stuff that the un-converted alarm code needs to build */ - -int debug_alarms = FALSE; - -void calendar_notify (time_t time, CalendarAlarm *which, void *data); - -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 } -}; - -void -calendar_notify (time_t time, CalendarAlarm *which, void *data) -{ - g_error ("calendar_notify() called!"); -} - - - -/* Callback used when the calendar factory is destroyed */ -static void -factory_destroy_cb (GtkObject *object, gpointer data) -{ - gtk_main_quit (); -} - -/* Creates and registers the calendar factory */ -static gboolean -create_cal_factory (void) -{ - CalFactory *factory; - CORBA_Object object; - CORBA_Environment ev; - int result; - - factory = cal_factory_new (); - if (!factory) { - g_message ("create_cal_factory(): could not create the calendar factory!"); - return FALSE; - } - - object = bonobo_object_corba_objref (BONOBO_OBJECT (factory)); - - CORBA_exception_init (&ev); - result = goad_server_register (CORBA_OBJECT_NIL, - object, - "evolution:calendar-factory", - "object", - &ev); - - if (ev._major != CORBA_NO_EXCEPTION || result == -1) { - g_message ("create_cal_factory(): could not register the calendar factory"); - bonobo_object_unref (BONOBO_OBJECT (factory)); - CORBA_exception_free (&ev); - return FALSE; - } else if (result == -2) { - g_message ("create_cal_factory(): a calendar factory is already registered"); - bonobo_object_unref (BONOBO_OBJECT (factory)); - CORBA_exception_free (&ev); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (factory), "destroy", - GTK_SIGNAL_FUNC (factory_destroy_cb), - NULL); - - CORBA_exception_free (&ev); - return TRUE; -} - -int -main (int argc, char **argv) -{ - CORBA_Environment ev; - - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); - - CORBA_exception_init (&ev); - gnome_CORBA_init ("tlacuache", VERSION, &argc, argv, GNORBA_INIT_SERVER_FUNC, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("main(): could not initialize the ORB"); - CORBA_exception_free (&ev); - exit (1); - } - CORBA_exception_free (&ev); - - if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - g_message ("main(): could not initialize Bonobo"); - exit (1); - } - - if (!gnome_vfs_init ()) { - g_message ("main(): could not initialize GNOME-VFS"); - exit (1); - } - - if (!create_cal_factory ()) - exit (1); - - bonobo_main (); - return 0; -} diff --git a/calendar/pcs/tlacuache.gnorba b/calendar/pcs/tlacuache.gnorba deleted file mode 100644 index da0f4ed552..0000000000 --- a/calendar/pcs/tlacuache.gnorba +++ /dev/null @@ -1,5 +0,0 @@ -[evolution:calendar-factory] -type=exe -repo_id=IDL:Evolution/Calendar/CalFactory:1.0 -description=Calendar factory for the Personal Calendar Server -location_info=tlacuache 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 - */ - -#include -#include -#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 - */ - -#ifndef POPUP_MENU_H -#define POPUP_MENU_H - -#include -#include - - -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 8e91f4d730..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 - * Federico Mena - */ -#include -#ifdef HAVE_LANGINGO_H -#include -#else -#include -#endif -#include -#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 42da747259..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 -#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. - */ -static 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 -#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/test2.vcf b/calendar/test2.vcf deleted file mode 100644 index 6446507989..0000000000 --- a/calendar/test2.vcf +++ /dev/null @@ -1,133 +0,0 @@ -BEGIN:VCALENDAR -PRODID:-//GNOME//NONSGML GnomeCalendar//EN -TZ:MST -VERSION:0.13 -BEGIN:VEVENT -UID:KOrganizer - 8469308861 -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 - 8469308862 -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 - 8469308863 -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 - 18042893834 -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 - 18042893835 -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 - 8469308866 -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 - 18042893837 -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 - 18042893838 -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 - * Miguel de Icaza - */ - -#include -#include -#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 - * Miguel de Icaza - */ - -#ifndef TIMEUTIL_H -#define TIMEUTIL_H - - -#include - - -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/tl-test.c b/calendar/tl-test.c deleted file mode 100644 index d2374db275..0000000000 --- a/calendar/tl-test.c +++ /dev/null @@ -1,160 +0,0 @@ -#include -#include -#include -#include "cal-client.h" - -static CalClient *client1; -static CalClient *client2; - -/* Prints a message with a client identifier */ -static void -cl_printf (CalClient *client, const char *format, ...) -{ - va_list args; - - va_start (args, format); - printf ("Client %s: ", - client == client1 ? "1" : - client == client2 ? "2" : - "UNKNOWN"); - vprintf (format, args); - va_end (args); -} - -/* Lists the UIDs of objects in a calendar, called as an idle handler */ -static gboolean -list_uids (gpointer data) -{ - CalClient *client; - GList *uids; - GList *l; - - client = CAL_CLIENT (data); - - uids = cal_client_get_uids (client, CALOBJ_TYPE_ANY); - - cl_printf (client, "UIDs: "); - - if (!uids) - printf ("none\n"); - else { - for (l = uids; l; l = l->next) { - char *uid; - - uid = l->data; - printf ("`%s' ", uid); - } - - printf ("\n"); - - for (l = uids; l; l = l->next) { - char *uid; - char *calobj; - - uid = l->data; - calobj = cal_client_get_object (client, uid); - - printf ("------------------------------\n%s", calobj); - printf ("------------------------------\n"); - - cal_client_update_object (client, uid, calobj); - - g_free (calobj); - } - } - - cal_obj_uid_list_free (uids); - -/* gtk_object_unref (GTK_OBJECT (client)); */ - - return FALSE; -} - -/* Callback used when a calendar is loaded */ -static void -cal_loaded (CalClient *client, CalClientLoadStatus status, gpointer data) -{ - cl_printf (client, "Load/create %s\n", - ((status == CAL_CLIENT_LOAD_SUCCESS) ? "success" : - (status == CAL_CLIENT_LOAD_ERROR) ? "error" : - (status == CAL_CLIENT_LOAD_IN_USE) ? "in use" : - "unknown status value")); - - if (status == CAL_CLIENT_LOAD_SUCCESS) - g_idle_add (list_uids, client); - else - gtk_object_unref (GTK_OBJECT (client)); -} - -/* Callback used when an object is updated */ -static void -obj_updated (CalClient *client, const char *uid, gpointer data) -{ - cl_printf (client, "Object updated: %s\n", uid); -} - -/* Creates a calendar client and tries to load the specified URI into it */ -static CalClient * -create_client (const char *uri, gboolean load) -{ - CalClient *client; - gboolean result; - - client = cal_client_new (); - if (!client) { - g_message ("create_client(): could not create the client"); - exit (1); - } - - gtk_signal_connect (GTK_OBJECT (client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded), - NULL); - gtk_signal_connect (GTK_OBJECT (client), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated), - NULL); - - printf ("Calendar loading `%s'...\n", uri); - - if (load) - result = cal_client_load_calendar (client, uri); - else - result = cal_client_load_calendar (client, uri); - - if (!result) { - g_message ("create_client(): failure when issuing calendar load/create request `%s'", - uri); - exit (1); - } - - return client; -} - -int -main (int argc, char **argv) -{ - CORBA_Environment ev; - - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); - - CORBA_exception_init (&ev); - gnome_CORBA_init ("tl-test", VERSION, &argc, argv, 0, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("main(): could not initialize the ORB"); - CORBA_exception_free (&ev); - exit (1); - } - CORBA_exception_free (&ev); - - if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - g_message ("main(): could not initialize Bonobo"); - exit (1); - } - - client1 = create_client ("/cvs/evolution/calendar/test2.vcf", TRUE); - client2 = create_client ("/cvs/evolution/calendar/test2.vcf", FALSE); - - bonobo_main (); - - return 0; -} diff --git a/calendar/tlacuache.c b/calendar/tlacuache.c deleted file mode 100644 index 35bb585862..0000000000 --- a/calendar/tlacuache.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Tlacuache - personal calendar server main module - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include -#include -#include "cal-factory.h" -#include "calobj.h" - - - -/* Stuff that the un-converted alarm code needs to build */ - -int debug_alarms = FALSE; - -void calendar_notify (time_t time, CalendarAlarm *which, void *data); - -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 } -}; - -void -calendar_notify (time_t time, CalendarAlarm *which, void *data) -{ - g_error ("calendar_notify() called!"); -} - - - -/* Callback used when the calendar factory is destroyed */ -static void -factory_destroy_cb (GtkObject *object, gpointer data) -{ - gtk_main_quit (); -} - -/* Creates and registers the calendar factory */ -static gboolean -create_cal_factory (void) -{ - CalFactory *factory; - CORBA_Object object; - CORBA_Environment ev; - int result; - - factory = cal_factory_new (); - if (!factory) { - g_message ("create_cal_factory(): could not create the calendar factory!"); - return FALSE; - } - - object = bonobo_object_corba_objref (BONOBO_OBJECT (factory)); - - CORBA_exception_init (&ev); - result = goad_server_register (CORBA_OBJECT_NIL, - object, - "evolution:calendar-factory", - "object", - &ev); - - if (ev._major != CORBA_NO_EXCEPTION || result == -1) { - g_message ("create_cal_factory(): could not register the calendar factory"); - bonobo_object_unref (BONOBO_OBJECT (factory)); - CORBA_exception_free (&ev); - return FALSE; - } else if (result == -2) { - g_message ("create_cal_factory(): a calendar factory is already registered"); - bonobo_object_unref (BONOBO_OBJECT (factory)); - CORBA_exception_free (&ev); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (factory), "destroy", - GTK_SIGNAL_FUNC (factory_destroy_cb), - NULL); - - CORBA_exception_free (&ev); - return TRUE; -} - -int -main (int argc, char **argv) -{ - CORBA_Environment ev; - - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); - - CORBA_exception_init (&ev); - gnome_CORBA_init ("tlacuache", VERSION, &argc, argv, GNORBA_INIT_SERVER_FUNC, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("main(): could not initialize the ORB"); - CORBA_exception_free (&ev); - exit (1); - } - CORBA_exception_free (&ev); - - if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - g_message ("main(): could not initialize Bonobo"); - exit (1); - } - - if (!gnome_vfs_init ()) { - g_message ("main(): could not initialize GNOME-VFS"); - exit (1); - } - - if (!create_cal_factory ()) - exit (1); - - bonobo_main (); - return 0; -} diff --git a/calendar/tlacuache.gnorba b/calendar/tlacuache.gnorba deleted file mode 100644 index da0f4ed552..0000000000 --- a/calendar/tlacuache.gnorba +++ /dev/null @@ -1,5 +0,0 @@ -[evolution:calendar-factory] -type=exe -repo_id=IDL:Evolution/Calendar/CalFactory:1.0 -description=Calendar factory for the Personal Calendar Server -location_info=tlacuache 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 -#include -#include -#include - -#include -#include - -#include -#include -#include - -#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"),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 -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include - -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 - * Miguel de Icaza - */ - -#include -#include "view-utils.h" -#include - -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 - */ - -#ifndef VIEW_UTILS_H -#define VIEW_UTILS_H - - -#include -#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 - */ - -#include -#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 - */ - -#ifndef WEEK_VIEW_H -#define WEEK_VIEW_H - -#include -#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 - * Federico Mena - */ - -#include -#include -#include -#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 - * Federico Mena - */ - -#ifndef YEAR_VIEW_H -#define YEAR_VIEW_H - -#include -#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/ChangeLog b/camel/ChangeLog deleted file mode 100644 index 0a45793135..0000000000 --- a/camel/ChangeLog +++ /dev/null @@ -1,383 +0,0 @@ -2000-02-24 Dan Winship - - * camel-session.c: Add camel_session_get_transport_for_protocol. - - * camel-transport.h: - * camel-transport.c: Add an abstract CamelTransport class. - - * providers/sendmail/*: A CamelTransport that uses sendmail - to deliver mail. - -2000-02-24 Dan Winship - - * camel-folder.c: use CamelExceptions for run-time errors, not - incorrect code. Don't bother validating that an object exists from - inside one of its methods, since you couldn't have gotten there if - it didn't. Fix some code style bugs. - - (_init): Rename init_with_store to init and add parent_folder, - separator, and name arguments. - (_set_name): Get separator from self, not parent_store now. - - * camel-store.h: - * camel-store.c: Remove get/set_separator. - - * providers/mbox/: Update for above. - -2000-02-23 Dan Winship - - * camel-medium.c (_finalize): Free the data in the headers hash - table. - (_add_header): g_strdup the header name and value when adding it. - - * camel-mime-part-utils.c - (camel_mime_part_construct_headers_from_stream): Free the header - data after calling camel_medium_add_header, since it will have - g_strdup()ed it itself. - -2000-02-22 NotZed - - * providers/mbox/camel-mbox-search.c: Dont compile by default. - - * providers/mbox/Makefile.am: Fuck off the filter code. - -2000-02-22 bertrand - - * camel-stream-b64.c (read_decode__static): - don't read the char if we reached the length - of the output buffer. Hours lost on this - %$!@# bug : 3.5 - - * camel-folder.c (camel_folder_get_subfolder): - (camel_folder_create): - (camel_folder_delete): - (camel_folder_delete_messages): - (camel_folder_list_subfolders): - (camel_folder_expunge): - (camel_folder_get_message_by_number): - (camel_folder_get_message_count): - (camel_folder_append_message): - (camel_folder_copy_message_to): - (camel_folder_get_summary): - (camel_folder_get_message_uid): - (camel_folder_get_message_by_uid): - (camel_folder_get_uid_list): - Check folder state (open/close) and raise an - exception if it is not ok. - - * providers/mbox/camel-mbox-folder.c (_create): - create the file and the path with two different - names. - - * camel-folder.c (_create): handle the case - when the folder name starts with '/' - - * camel-exception.c (camel_exception_new): use - (void) instead of () in decl. - - * camel-exception.h: cosmetic fixes. - - * camel-exception.c (camel_exception_init): new routine. - Fix a bug in mail/message-list.c - - - * camel-folder.h: cosmetic changes. - - * camel-stream-b64.c (reset__static): added a - reset method. Thanks message-browser to find - so much bugs :) - - * providers/mbox/Makefile.am (libcamelmbox_la_LIBADD): readd - Unicode libs. - -2000-02-21 bertrand - - * camel-formatter.c (lookup_unique_id): - awful hack to test get_output_stream. - * camel-stream-b64.[ch] : - b64 encoding/decoding is now implemented as - a stream. - - -2000-02-21 bertrand - - * camel-seekable-substream.c (_reemit_parent_signal): - emit "data_available" when parent stream emits it. - - -2000-02-21 NotZed - - * providers/mbox/Makefile.am: Uh, fixed LIBADD again. What was - there was never ever going to work, wasn't it tested? - - -2000-02-21 Dan Winship - - * camel-session.h: (struct _CamelSession): Add authenticator. - - * camel-session.c (camel_session_new): Add authenticator. - (camel_session_query_authenticator): New function to query the - session authenticator for password, etc, information. - -2000-02-21 Dan Winship - - * camel-session.c: add CamelExceptions to several functions. Use - camel_session_new to initialize the session and URL fields of - created CamelStores as appropriate. - - * camel-store.h: - * camel-store.c - * camel-service.h: - * camel-service.c: Move the session and url (and associated - functions) from CamelStore to CamelService. Add url_flags to - CamelService so subclasses can specify which URL components - are mandatory for them. Add camel_session_new for - camel_session_get_store* to use. - - * providers/mbox/camel-mbox-folder.c: - * providers/mbox/camel-mbox-store.c: - * providers/mbox/camel-mbox-store.h: Update for above changes. - - * camel-exception-list.def: Once camel is being used for real, - exceptions won't be renumberable. So renumber them now to make - more room to add exceptions to the various categories later, and - add a big warning message. - -2000-02-20 Dan Winship - - * providers/mbox/Makefile.am: add libibex back to - libcamelmbox_la_LIBADD - -2000-02-18 NotZed - - * providers/mbox/camel-mbox-search.h - (camel_mbox_folder_search_by_expression): Added exception to call, - and fixed caller. - - * providers/mbox/camel-mbox-search.c - (camel_mbox_folder_search_by_expression): Major changes, to use - the sexp evaluator from filter/filter-sexp.c to implement the - searching. - (func_body_contains): Changed to support multiple strings in 1 - command (results or'd together) - - * url-util.c (g_url_new): Fixed a typo (colon == 0 isn't right), - and made it so full url's are absolute pathed (Dan, this is how it - has to work!). Also, always include a path part, even if it is an - empty string. - -2000-02-18 Dan Winship - - * camel/camel-types.h: New header with the typedefs for all camel - classes. Now the class headers can just include this and the - header for the parent type. This makes it possible for - CamelService to include a CamelSession without creating an - #include loop. - - * camel/*: - * composer/e-msg-composer-attachment-bar.h: - * mail/folder-browser.c: - * mail/message-list.c: frob #includes to match the new reality - -2000-02-17 Dan Winship - - * camel/camel-service.h: - * camel/camel-service.c: Make camel-service us a Gurl internally. - Remove the login/password interfaces and instead provide - camel_service_connect_with_url. Add CamelExceptions - -2000-02-17 bertrand - - * camel/camel-formatter.c (handle_text_plain): - (handle_text_html): use camel_stream_reset instead - of seek. The formatter should be able to work - with all streams, not only seekable streams. - In the case where some provider implementation - would not be able to provide a reset method - to their stream, implementors would have - to find a workaround. - - * camel/camel-session.c (camel_session_new): use - (void) instean of () in function decl. - - * camel/camel-folder.c: ifdef async operation - related code. - - * camel/camel-seekable-stream.c (_seek): added a warning. - (_reset): default implementation of reset for seekable - stream. - - * camel/camel-mime-message.h: set_received_date declaration fix. - cosmetic changes. - - * camel/providers/mbox/camel-mbox-provider.c (camel_provider_module_init): - use (void) instead of (). - - * camel/camel-stream.c (camel_stream_reset): - new method for CamelStream. - -2000-02-17 Dan Winship - - * camel/url-util.c (g_url_to_string): New function to convert - a Gurl back into a char *. - -2000-02-17 bertrand - - * camel/camel-formatter.c (handle_text_plain): - revamped so that it uses the output stream - of the data wrapper - (handle_text_html): ditto. - - - * camel/camel-simple-data-wrapper.h: - * camel/camel-simple-data-wrapper.c (camel_simple_data_wrapper_new): - use (void) instead of (). - (_get_output_stream): simple implementation. - -2000-02-16 bertrand - - * camel/camel-data-wrapper.c (_set_input_stream): ref input stream - (_set_output_stream): ref output stream - (_finalize): unref input and output streams - - * camel/camel-seekable-substream.c (_set_bounds): don't - seek the begining of the substream. - (_eos): fix eos condition testing. - (_finalize): unref parent stream - (_init_with_seekable_stream_and_bounds): ref parent stream - - * camel/gstring-util.c (g_string_equal_for_hash): - (g_string_equal_for_glist): return type is int. - - * camel/camel.h: - * camel/camel.c (camel_init): use (void) - instead of (). - -2000-02-16 NotZed - - * providers/mbox/Makefile.am (libcamelmbox_la_LIBADD): Added - libfilter to link line (temporarily?). Required for - filter-sexp. - -2000-02-15 bertrand - - * camel/camel-multipart.c (_localize_part): - this routine replaces the _read_part routine - and does not store the part in a buffer. - (_set_input_stream): use the set_input_stream - instead of the construct_from_stream. - each bodypart is given an input stream. - - * camel/camel-mime-part-utils.c: - include the data-wrapper-repository header. - (camel_mime_part_construct_content_from_stream): - use the set_input_stream instead of the - construct_from_stream method. - - * camel/camel-seekable-substream.c (_set_bounds): - cur position is set to 0 not to inf_bound. - -2000-02-15 bertrand - - * camel/camel-mime-part.c: include gmime-base64.h - various compilation and runtime fixes. - (_set_input_stream): store the input substream - for the content object. - - * camel/camel-data-wrapper.h: declare the - set/get function on input/output stream. - - * camel/camel-mime-part.c (_get_content_object): - don't use a temporary mem stream. - - * camel/camel-seekable-substream.c (_seek): - (_eos): - (_read): the substream can be unlimited in length - - * camel/camel-data-wrapper.c (camel_data_wrapper_class_init): - set the get/set_input/output_stream methods. - - * camel/camel-multipart.c (_construct_from_stream): - camel_stream_seek -> camel_seekable_stream_seek - -2000-02-14 Miguel de Icaza - - * camel/providers/mbox/Makefile.am (libcamelmbox_la_LIBADD): Add - the unicode libraries as well. - - * camel/camel-provider.c (camel_provider_register_as_module): Add - error reporting here. Desire to use Solaris increases. Hair loss - in the last two hours: 5,400. - - * camel/providers/mbox/camel-mbox-provider.c - (camel_mbox_get_provider): Renamed function. - - * camel/camel.h: All include files use camel/ now here. - - * camel/providers/mbox/Makefile.am: Drop all the dynamism from - Camel, and make this a standard library. - -2000-02-14 bertrand - - * camel/gmime-utils.c (get_header_array_from_stream): use the - eos stream method. - (gmime_read_line_from_stream): ditto. - - * camel/camel-stream-fs.h (struct ): add the eof field - cosmetics changes. - - * camel/camel-stream-fs.c (camel_stream_fs_init): set eof. - (_read): set eof on end of file. - (_eos): implemented. - - * camel/gmime-utils.c (get_header_array_from_stream): - make a blocking version of the header parser. - When the fs stream uses gnome-vfs, this should - be changed. - (gmime_read_line_from_stream): ditto. - -2000-02-11 bertrand - - * camel/camel-stream-fs.c: - everywhere, when using the cur_pos field, do it - on the CamelSeekableStream object. - (_seek): small fix. - - * camel/camel-seekable-stream.c (camel_seekable_stream_seek): - s/camel_stream_seek/camel_seekable_stream_seek/g - - * camel/camel-seekable-stream.h: - (struct ): added a field to store the - current position. - - * camel/camel-seekable-stream.c (camel_seekable_stream_get_current_position): - New function. Allows to get the current position - of a seekable stream. - - -2000-02-13 NotZed - - * providers/mbox/camel-mbox-search.c: New file, implements the - search api for mbox folders. - - * providers/mbox/Makefile.am: Link with ibex. - - * camel-folder.c (camel_folder_has_search_capability): Api - additions. - (camel_folder_search_by_expression): Ditto. - -2000-02-12 NotZed - - * providers/mbox/camel-mbox-folder.c (_set_name): Setup index - filename as well. - (_init_with_store): Init index filename. Hmm, none of these - names ever seem to get free'd (FIXME?) - - * providers/mbox/camel-mbox-folder.h: Add index file name. - -2000-02-12 NotZed - - * camel-folder.h: Add folder search functions. - - ** Created ChangeLog just for camel ** - - refer to ../ChangeLog for changes prior to this date. diff --git a/camel/Makefile.am b/camel/Makefile.am deleted file mode 100644 index 50a34a9a08..0000000000 --- a/camel/Makefile.am +++ /dev/null @@ -1,129 +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 ENABLE_THREADS - -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-formatter.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-seekable-stream.c \ - camel-seekable-substream.c \ - camel-service.c \ - camel-session.c \ - camel-store.c \ - camel-stream.c \ - camel-stream-b64.c \ - camel-stream-buffered-fs.c \ - camel-stream-fs.c \ - camel-stream-mem.c \ - camel-transport.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-formatter.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-seekable-stream.h \ - camel-seekable-substream.h \ - camel-service.h \ - camel-session.h \ - camel-store.h \ - camel-stream.h \ - camel-stream-b64.h \ - camel-stream-buffered-fs.h \ - camel-stream-fs.h \ - camel-stream-mem.h \ - camel-transport.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 f020174d5e..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 development there. -You know, that "bazaar" thing. Maybe could we organize a big contest on -gnome-list to find the best explanation :) - -Camel draws heavily from JavaMail and the IMAP4rev1 RFC. People -wanting to hack on a provider should 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 with a store. - -* CamelMessage : An object contained in folders. Is defined by a set -of attributes and a content. (Attributes include: 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 \ No newline at end of file diff --git a/camel/camel-arg-collector.c b/camel/camel-arg-collector.c deleted file mode 100644 index 44b9e2d99b..0000000000 --- a/camel/camel-arg-collector.c +++ /dev/null @@ -1,186 +0,0 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -/* - * included in camel because it is not exported - * by gtk - * - * Bertrand Guiheneuf - */ - -/* collect a single argument value from a va_list. - * this is implemented as a huge macro , 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 fdc9aac45b..0000000000 --- a/camel/camel-data-wrapper.c +++ /dev/null @@ -1,348 +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 - * - * 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 -#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 _set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); -static CamelStream *_get_input_stream (CamelDataWrapper *data_wrapper); -static void _set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream); -static CamelStream *_get_output_stream (CamelDataWrapper *data_wrapper); - -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, const 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; - - camel_data_wrapper_class->set_input_stream = _set_input_stream; - camel_data_wrapper_class->get_input_stream = _get_input_stream; - camel_data_wrapper_class->set_output_stream = _set_output_stream; - camel_data_wrapper_class->get_output_stream = _get_output_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); - - if (camel_data_wrapper->input_stream) - gtk_object_unref (GTK_OBJECT (camel_data_wrapper->input_stream)); - - if (camel_data_wrapper->output_stream) - gtk_object_unref (GTK_OBJECT (camel_data_wrapper->output_stream)); - - parent_class->finalize (object); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelDataWrapper::finalize\n"); -} - - - - - - -static void -_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - g_assert (data_wrapper); - data_wrapper->input_stream = stream; - if (stream) - gtk_object_ref (GTK_OBJECT (stream)); -} - - -void -camel_data_wrapper_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - g_assert (data_wrapper); - CDW_CLASS(data_wrapper)->set_input_stream (data_wrapper, stream); -} - - - - - -static CamelStream * -_get_input_stream (CamelDataWrapper *data_wrapper) -{ - g_assert (data_wrapper); - return (data_wrapper->input_stream); -} - -CamelStream * -camel_data_wrapper_get_input_stream (CamelDataWrapper *data_wrapper) -{ - g_assert (data_wrapper); - return CDW_CLASS(data_wrapper)->get_input_stream (data_wrapper); -} - - - - -static void -_set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - g_assert (data_wrapper); - data_wrapper->output_stream = stream; - if (stream) - gtk_object_ref (GTK_OBJECT (stream)); -} - -void -camel_data_wrapper_set_output_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - g_assert (data_wrapper); - CDW_CLASS(data_wrapper)->set_output_stream (data_wrapper, stream); -} - - - - -static CamelStream * -_get_output_stream (CamelDataWrapper *data_wrapper) -{ - g_assert (data_wrapper); - return (data_wrapper->output_stream); -} - -CamelStream * -camel_data_wrapper_get_output_stream (CamelDataWrapper *data_wrapper) -{ - g_assert (data_wrapper); - return CDW_CLASS(data_wrapper)->get_output_stream (data_wrapper); -} - - - - - -/** - * _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, const 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, const 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) -{ - return 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 246b86f841..0000000000 --- a/camel/camel-data-wrapper.h +++ /dev/null @@ -1,124 +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 - * - * 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 -#include "camel-types.h" -#include "gmime-content-field.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)) - - -struct _CamelDataWrapper -{ - GtkObject parent_object; - - CamelStream *input_stream; - CamelStream *output_stream; - - GMimeContentField *mime_type; -}; - - - -typedef struct { - - GtkObjectClass parent_class; - - /* Virtual methods */ - void (*set_input_stream) (CamelDataWrapper *data_wrapper, - CamelStream *stream); - CamelStream * (*get_input_stream) (CamelDataWrapper *data_wrapper); - void (*set_output_stream) (CamelDataWrapper *data_wrapper, - CamelStream *stream); - CamelStream * (*get_output_stream) (CamelDataWrapper *data_wrapper); - - void (*set_mime_type) (CamelDataWrapper *data_wrapper, - const 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); - - - /* deprecated method */ - CamelStream * (*get_stream) (CamelDataWrapper *data_wrapper); - void (*write_to_stream) (CamelDataWrapper *data_wrapper, - CamelStream *stream); - void (*construct_from_stream) (CamelDataWrapper *data_wrapper, - CamelStream *stream); - -} 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_set_mime_type (CamelDataWrapper *data_wrapper, - const 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); - -void camel_data_wrapper_set_input_stream (CamelDataWrapper *data_wrapper, - CamelStream *stream); -CamelStream * camel_data_wrapper_get_input_stream (CamelDataWrapper *data_wrapper); -void camel_data_wrapper_set_output_stream (CamelDataWrapper *data_wrapper, - CamelStream *stream); -CamelStream * camel_data_wrapper_get_output_stream (CamelDataWrapper *data_wrapper); - - - -/* deprecated methods. Left until the new parser scheme is ok */ -CamelStream * camel_data_wrapper_get_stream (CamelDataWrapper *data_wrapper); -void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, - CamelStream *stream); - -#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 e99f0c90d9..0000000000 --- a/camel/camel-exception-list.def +++ /dev/null @@ -1,32 +0,0 @@ -/* WARNING: Exceptions MUST NOT be renumbered: they need to be - * consistent across libraries compiled at different times. - * Categories should be widely separated, old unused exceptions can - * never be deleted, and new exceptions can be added only to the - * ends of categories. - */ - -CAMEL_EXCEPTION_NONE = 0, - -/* Generic exceptions */ -CAMEL_EXCEPTION_INVALID_PARAM, -CAMEL_EXCEPTION_SYSTEM, -CAMEL_EXCEPTION_USER_CANCEL, - -/* CamelFolderException */ -CAMEL_EXCEPTION_FOLDER_NULL = 100, -CAMEL_EXCEPTION_FOLDER_INVALID, -CAMEL_EXCEPTION_FOLDER_INVALID_STATE, -CAMEL_EXCEPTION_FOLDER_NON_EMPTY, -CAMEL_EXCEPTION_FOLDER_NON_UID, -CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, -CAMEL_EXCEPTION_FOLDER_INVALID_PATH, -CAMEL_EXCEPTION_FOLDER_INVALID_UID, - -/* CamelStoreException */ -CAMEL_EXCEPTION_STORE_NULL = 200, -CAMEL_EXCEPTION_STORE_INVALID, - -/* CamelServiceException */ -CAMEL_EXCEPTION_SERVICE_NULL = 300, -CAMEL_EXCEPTION_SERVICE_INVALID, -CAMEL_EXCEPTION_SERVICE_URL_INVALID diff --git a/camel/camel-exception.c b/camel/camel-exception.c deleted file mode 100644 index 1e75e90d17..0000000000 --- a/camel/camel-exception.c +++ /dev/null @@ -1,277 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-execpetion.c : exception utils */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#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 (void) -{ - CamelException *ex; - - ex = g_new (CamelException, 1); - ex->desc = NULL; - - /* set the Exception Id to NULL */ - ex->id = CAMEL_EXCEPTION_NONE; - - return ex; -} - -/** - * camel_exception_init: init a (statically allocated) exception. - * - * Init an exception. This routine is mainly - * useful when using a statically allocated - * exception. - * - * - **/ -void -camel_exception_init (CamelException *ex) -{ - ex->desc = NULL; - - /* set the Exception Id to NULL */ - ex->id = CAMEL_EXCEPTION_NONE; - - return ex; -} - - -/** - * camel_exception_clear: Clear an exception - * @exception: the exception object - * - * Clear an exception, that is, set the - * exception ID to CAMEL_EXCEPTION_NONE and - * free the description text. - * If the exception is NULL, this funtion just - * returns. - **/ -void -camel_exception_clear (CamelException *exception) -{ - if (!exception) return; - - /* free the description text */ - if (exception->desc) - g_free (exception->desc); - exception->desc = NULL; - - /* set the Exception Id to NULL */ - exception->id = CAMEL_EXCEPTION_NONE; -} - - - - -/** - * camel_exception_free: Free an exception - * @exception: The exception object to free - * - * Free an exception object. If the exception - * is NULL, nothing is done, the routine simply - * returns. - **/ -void -camel_exception_free (CamelException *exception) -{ - if (!exception) return; - - /* free the description text */ - if (exception->desc) - g_free (exception->desc); - /* free the exeption itself */ - g_free (exception); -} - -/** - * camel_exception_set: set an exception - * @ex: exception object - * @id: exception id - * @desc: textual description of the exception - * - * Set the value of an exception. The exception id is - * a unique number representing the exception. The - * textual description is a small text explaining - * what happened and provoked the exception. - * - * When @ex is NULL, nothing is done, this routine - * simply returns. - * - **/ -void -camel_exception_set (CamelException *ex, - ExceptionId id, - const char *desc) -{ - /* if no exception is given, do nothing */ - if (!ex) return; - - ex->id = id; - - /* remove the previous exception description */ - if (ex->desc) - g_free (ex->desc); - ex->desc = g_strdup (desc); -} - - -/** - * camel_exception_setv: set an exception - * @ex: exception object - * @id: exception id - * @format: format of the description string. The format string is used as in printf(). - * - * Set the value of an exception. The exception id is - * a unique number representing the exception. The - * textual description is a small text explaining - * what happened and provoked the exception. - * In this version, the string is created from the format - * string and the variable argument list. - * - * When @ex is NULL, nothing is done, this routine - * simply returns. - * - **/ -void -camel_exception_setv (CamelException *ex, - ExceptionId id, - const char *format, - ...) -{ - va_list args; - gchar *tmp_desc_string; - - - /* if no exception is given, do nothing */ - if (!ex) return; - - - /* create the temporary exception string */ - va_start(args, format); - tmp_desc_string = g_strdup_vprintf (format, args); - va_end (args); - - - /* now set the exception. We don't call - camel_exception_set because we want to - avoid a useless strdup () */ - ex->id = id; - - /* remove the previous exception description */ - if (ex->desc) - g_free (ex->desc); - ex->desc = g_strdup (tmp_desc_string); - -} - - - - - - - -/** - * camel_exception_xfer: transfer an exception - * @ex_dst: Destination exception object - * @ex_src: Source exception object - * - * Transfer the content of an exception from - * an exception object to another. - * The destination exception receives the id and - * the description text of the source exception. - **/ -void -camel_exception_xfer (CamelException *ex_dst, - CamelException *ex_src) -{ - if (ex_dst->desc) - g_free (ex_dst->desc); - - ex_dst->id = ex_src->id; - ex_dst->desc = ex_src->desc; - - ex_src->desc = NULL; - ex_src->id = CAMEL_EXCEPTION_NONE; -} - - - - - - - -/** - * camel_exception_get_id: get the exception id - * @ex: The exception object - * - * Return the id of an exception. - * If @ex is NULL, return CAMEL_EXCEPTION_NONE; - * - * Return value: Exception ID. - **/ -ExceptionId -camel_exception_get_id (CamelException *ex) -{ - if (ex) - return ex->id; - else - return CAMEL_EXCEPTION_NONE; -} - - - - -/** - * camel_exception_get_description: get the description of an exception. - * @ex: The exception object - * - * Return the exception description text. - * If @ex is NULL, return NULL; - * - * - * Return value: Exception description text. - **/ -const gchar * -camel_exception_get_description (CamelException *ex) -{ - if (ex) - return ex->desc; - else - return NULL; -} diff --git a/camel/camel-exception.h b/camel/camel-exception.h deleted file mode 100644 index 53f1366fbb..0000000000 --- a/camel/camel-exception.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-execpetion.h : exception utils */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include "camel-types.h" - -typedef enum { -#include "camel-exception-list.def" - -} ExceptionId; - - -struct _CamelException { - /* do not access the fields directly */ - ExceptionId id; - char *desc; - -}; - - - -/* creation and destruction functions */ -CamelException * camel_exception_new (void); -void camel_exception_free (CamelException *exception); -void camel_exception_init (CamelException *ex); - - -/* exception content manipulation */ -void camel_exception_clear (CamelException *exception); -void camel_exception_set (CamelException *ex, - ExceptionId id, - const char *desc); -void camel_exception_setv (CamelException *ex, - ExceptionId id, - const char *format, - ...); - - -/* exception content transfer */ -void camel_exception_xfer (CamelException *ex_dst, - CamelException *ex_src); - - -/* exception content retrieval */ -ExceptionId camel_exception_get_id (CamelException *ex); -const gchar * camel_exception_get_description (CamelException *ex); - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_EXCEPTION_H */ - diff --git a/camel/camel-folder-pt-proxy.c b/camel/camel-folder-pt-proxy.c deleted file mode 100644 index a181ba8582..0000000000 --- a/camel/camel-folder-pt-proxy.c +++ /dev/null @@ -1,823 +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 - * - * 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 -#include "camel-folder-pt-proxy.h" -#include "camel-log.h" -#include "camel-marshal-utils.h" -#include "camel-exception.h" -#include -#include -#include -#include - - -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 (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, 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); -static gboolean _can_hold_messages(CamelFolder *folder); -static gboolean _exists (CamelFolder *folder, CamelException *ex); -static gboolean _is_open (CamelFolder *folder); -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 = _init; - camel_folder_class->open = _open; - camel_folder_class->close = _close; -#ifdef FOLDER_ASYNC_TEST - camel_folder_class->open_async = _open_async; - camel_folder_class->close_async = _close_async; -#endif - 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 = _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); - - 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 implementation */ -static void -_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex) -{ - - parent_class->init (folder, parent_store, parent_folder, - name, separator, ex); - if (ex->id != CAMEL_EXCEPTION_NONE) - return; -#warning use proxy store here - CF_CLASS (folder)->init (CAMEL_FOLDER_PT_PROXY (folder)->real_folder, - parent_store, parent_folder, name, - separator, 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) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - can_hold_folders (proxy_folder->real_folder); -} - - - - -static gboolean -_can_hold_messages (CamelFolder *folder) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - can_hold_messages (proxy_folder->real_folder); -} - - - -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) -{ - CamelFolderPtProxy *proxy_folder; - - proxy_folder = CAMEL_FOLDER_PT_PROXY (folder); - return CF_CLASS (proxy_folder->real_folder)-> - is_open (proxy_folder->real_folder); -} - - - - - -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 189d486a85..0000000000 --- a/camel/camel-folder-pt-proxy.h +++ /dev/null @@ -1,92 +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 - * - * 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; - - -GtkType camel_folder_pt_proxy_get_type (void); - -#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 e1d4543ace..0000000000 --- a/camel/camel-folder-summary.c +++ /dev/null @@ -1,162 +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 - * - * 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 -#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 GArray *_get_subfolder_info_list (CamelFolderSummary *summary); -static const GArray *_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 = g_array_new (FALSE, FALSE, sizeof (CamelFolderInfo)); - summary->message_info_list = g_array_new (FALSE, FALSE, sizeof (CamelMessageInfo)); - 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 () -{ - CamelFolderSummary *folder_summary; - - folder_summary = gtk_type_new (CAMEL_FOLDER_SUMMARY_TYPE); - folder_summary->message_info_list = g_array_new (FALSE, FALSE, sizeof (CamelMessageInfo)); - folder_summary->subfolder_info_list = g_array_new (FALSE, FALSE, sizeof (CamelFolderInfo)); - - return folder_summary; - -} - -static const GArray * -_get_subfolder_info_list (CamelFolderSummary *summary) -{ - return summary->subfolder_info_list; -} - - -const GArray * -camel_folder_summary_get_subfolder_info_list (CamelFolderSummary *summary) -{ - return CFS_CLASS (summary)->get_subfolder_info_list (summary); -} - - - - -static const GArray * -_get_message_info_list (CamelFolderSummary *summary) -{ - return summary->message_info_list; -} - -const GArray * -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 f1ef888233..0000000000 --- a/camel/camel-folder-summary.h +++ /dev/null @@ -1,112 +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 - * - * 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 -#include "camel-types.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; - - - - -struct _CamelFolderSummary { - GtkObject parent_object; - - GArray *subfolder_info_list; /* informations on subfolders */ - GArray *message_info_list; /* informations on messages */ - -}; - - - - -typedef struct { - GtkObjectClass parent_class; - - /* Virtual methods */ - const GArray * (*get_subfolder_info_list) (CamelFolderSummary *summary); - const GArray * (*get_message_info_list) (CamelFolderSummary *summary); - -} CamelFolderSummaryClass; - - - -/* Standard Gtk function */ -GtkType camel_folder_summary_get_type (void); - - -/* public methods */ -CamelFolderSummary *camel_folder_summary_new (); - -/* get information about the messages and the subfolders in the directory */ -const GArray *camel_folder_summary_get_subfolder_info_list (CamelFolderSummary *summary); -const GArray *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 76bc040446..0000000000 --- a/camel/camel-folder-utils.c +++ /dev/null @@ -1,101 +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 - * - * 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 -#include "camel-folder-utils.h" -#include "camel-log.h" -#include "camel-mime-message.h" - - - -/* Active Message List utilities */ - -/* */ -static 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. - **/ -static GList * -camel_aml_expunge_messages (GList *aml, - CamelFolder *folder) -{ - CamelMimeMessage *message = NULL; - GList *message_node = NULL; - GList *next_message_node = NULL; - GList *expunged_messages = NULL; - - - message_node = aml; - /* look in folder message list which messages - * need to be expunged */ - while ( message_node) { - message = CAMEL_MIME_MESSAGE (message_node->data); - - /* we may free message_node so get the next node now */ - next_message_node = message_node->next; - - if (message) { - if (camel_mime_message_get_flag (message, "DELETED")) { - - /* remove the message from active message list */ - g_list_remove_link (aml, message_node); - g_list_free_1 (message_node); - camel_mime_message_set_flag (message, "EXPUNGED", TRUE); - expunged_messages = g_list_prepend (expunged_messages, message); - - } - } - else { - CAMEL_LOG_WARNING ("CamelFolder::expunge warning message_node contains no message\n"); - } - message_node = next_message_node; - CAMEL_LOG_FULL_DEBUG ("CamelFolder::expunge, examined message node %p\n", message_node); - } - - return expunged_messages; -} diff --git a/camel/camel-folder-utils.h b/camel/camel-folder-utils.h deleted file mode 100644 index 1d6823e771..0000000000 --- a/camel/camel-folder-utils.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-folder-utils : Utility for camel folders */ - - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 5097caa295..0000000000 --- a/camel/camel-folder.c +++ /dev/null @@ -1,1405 +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 - * - * 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 -#include "camel-folder.h" -#include "camel-log.h" -#include "camel-exception.h" -#include "camel-store.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 (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, 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); - -#ifdef FOLDER_ASYNC_TEST - -/* 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); - -#endif - -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); -static gboolean _can_hold_messages (CamelFolder *folder); -static gboolean _exists (CamelFolder *folder, CamelException *ex); -static gboolean _is_open (CamelFolder *folder); -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); -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 = _init; - camel_folder_class->open = _open; -#ifdef FOLDER_ASYNC_TEST - camel_folder_class->open_async = _open_async; -#endif - camel_folder_class->close = _close; -#ifdef FOLDER_ASYNC_TEST - camel_folder_class->close_async = _close_async; -#endif - 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 = _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); - - 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); - - if (camel_folder->parent_store) - gtk_object_unref (GTK_OBJECT (camel_folder->parent_store)); - if (camel_folder->parent_folder) - gtk_object_unref (GTK_OBJECT (camel_folder->parent_folder)); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelFolder::finalize\n"); -} - - -/** - * _init: init the folder - * @folder: folder object to initialize - * @parent_store: parent store object of the folder - * @parent_folder: parent folder of the folder (may be NULL) - * @name: (short) name of the folder - * @separator: separator between the parent folder name and this name - * - * Initalizes the folder by setting the parent store, parent folder, - * and name. - **/ -static void -_init (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex) -{ - g_assert (folder != NULL); - g_assert (parent_store != NULL); - g_assert (folder->parent_store == NULL); - - folder->parent_store = parent_store; - gtk_object_ref (GTK_OBJECT (parent_store)); - - folder->parent_folder = parent_folder; - if (parent_folder) - gtk_object_ref (GTK_OBJECT (parent_folder)); - - folder->open_mode = FOLDER_OPEN_UNKNOWN; - folder->open_state = FOLDER_CLOSE; - folder->separator = separator; - camel_folder_set_name (folder, name, ex); -} - - - - - -static void -_open (CamelFolder *folder, - CamelFolderOpenMode mode, - CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - CF_CLASS (folder)->open (folder, mode, ex); -} - - - - -#ifdef FOLDER_ASYNC_TEST - -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) -{ - g_assert (folder != NULL); - CF_CLASS (folder)->open_async (folder, mode, callback, user_data, ex); -} - - -#endif /* FOLDER_ASYNC_TEST */ - - - -static void -_close (CamelFolder *folder, - gboolean expunge, - CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - CF_CLASS (folder)->close (folder, expunge, ex); -} - - - - -#ifdef FOLDER_ASYNC_TEST - - -static void -_close_async (CamelFolder *folder, - gboolean expunge, - CamelFolderAsyncCallback callback, - gpointer user_data, - CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - CF_CLASS (folder)->close_async (folder, expunge, callback, - user_data, ex); -} - - -#endif - - -static void -_set_name (CamelFolder *folder, - const gchar *name, - CamelException *ex) -{ - gchar *full_name; - const gchar *parent_full_name; - - g_assert (folder->parent_store != NULL); - g_assert (name != NULL); - g_assert (!camel_folder_is_open (folder)); - - /* 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; - - CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder name is %s\n", - name); - - 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%c%s", parent_full_name, - folder->separator, name); - } else { - full_name = g_strdup_printf ("%c%s", folder->separator, name); - } - - CAMEL_LOG_FULL_DEBUG ("CamelFolder::set_name, folder full name " - "set to %s\n", full_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) -{ - g_assert (folder != NULL); - CF_CLASS (folder)->set_name (folder, name, ex); -} - - - -static const gchar * -_get_name (CamelFolder *folder, CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - return CF_CLASS (folder)->get_name (folder, ex); -} - - - -static const gchar * -_get_full_name (CamelFolder *folder, CamelException *ex) -{ - 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) -{ - g_assert (folder != 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) -{ - 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) -{ - return folder->can_hold_messages; -} - - - -static gboolean -_exists (CamelFolder *folder, CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - 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) -{ - return folder->open_state == FOLDER_OPEN; -} - - -/** - * _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 - **/ -gboolean -camel_folder_is_open (CamelFolder *folder) -{ - g_assert (folder != NULL); - return CF_CLASS (folder)->is_open (folder); -} - - -static CamelFolder * -_get_subfolder (CamelFolder *folder, - const gchar *folder_name, - CamelException *ex) -{ - CamelFolder *new_folder; - gchar *full_name; - const gchar *current_folder_full_name; - - g_assert (folder->parent_store != NULL); - - current_folder_full_name = camel_folder_get_full_name (folder, ex); - if (camel_exception_get_id (ex)) return NULL; - - - full_name = g_strdup_printf ("%s%c%s", current_folder_full_name, - folder->separator, folder_name); - - new_folder = camel_store_get_folder (folder->parent_store, full_name, ex); - 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) -{ - g_assert (folder != NULL); - g_assert (folder_name != NULL); - g_assert (camel_folder_is_open (folder)); - - 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; - - g_assert (folder->parent_store != NULL); - g_assert (folder->name != NULL); - - /* if the folder already exists on the - store, do nothing and return true */ - if (CF_CLASS (folder)->exists (folder, ex)) - return TRUE; - - - 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, - folder->separator, - &prefix, NULL, - STRING_DICHOTOMY_STRIP_TRAILING | STRING_DICHOTOMY_RIGHT_DIR); - if (dich_result!='o') { - if (prefix == NULL) { - /* separator is the first caracter, no folder above */ - return TRUE; - } - } else { - parent = camel_store_get_folder (folder->parent_store, prefix, ex); - 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) -{ - g_assert (folder != NULL); - g_assert (!camel_folder_is_open (folder)); - - 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; - - /* 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) -{ - g_assert (folder != NULL); - g_assert (!camel_folder_is_open (folder)); - - 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) -{ - 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) -{ - g_assert (folder != NULL); - g_assert (!camel_folder_is_open (folder)); - - 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) -{ - 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) -{ - g_assert (folder != 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) -{ - 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) -{ - g_assert (folder != NULL); - return CF_CLASS (folder)->get_parent_store (folder, ex); -} - - - - -static CamelFolderOpenMode -_get_mode (CamelFolder *folder, CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - return CF_CLASS (folder)->get_mode (folder, ex); -} - - - - -static GList * -_list_subfolders (CamelFolder *folder, CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - g_assert (camel_folder_is_open (folder)); - - return CF_CLASS (folder)->list_subfolders (folder, ex); -} - - - - -static GList * -_expunge (CamelFolder *folder, CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - g_assert (!camel_folder_is_open (folder)); - - return CF_CLASS (folder)->expunge (folder, ex); -} - - -static gboolean -_has_message_number_capability (CamelFolder *folder) -{ - 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) -{ - g_assert (folder != NULL); - return CF_CLASS (folder)->has_message_number_capability (folder); -} - - - - -static CamelMimeMessage * -_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - g_assert (camel_folder_is_open (folder)); - - 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) -{ - g_assert (folder != NULL); - g_assert (camel_folder_is_open (folder)); - - return CF_CLASS (folder)->get_message_count (folder, ex); -} - - -static void -_append_message (CamelFolder *folder, CamelMimeMessage *message, - CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - g_assert (camel_folder_is_open (folder)); - - CF_CLASS (folder)->append_message (folder, message, ex); -} - - -static const GList * -_list_permanent_flags (CamelFolder *folder, CamelException *ex) -{ - return folder->permanent_flags; -} - - -const GList * -camel_folder_list_permanent_flags (CamelFolder *folder, CamelException *ex) -{ - g_assert (folder != NULL); - return CF_CLASS (folder)->list_permanent_flags (folder, ex); -} - - - - -static void -_copy_message_to (CamelFolder *folder, CamelMimeMessage *message, CamelFolder *dest_folder, CamelException *ex) -{ - camel_folder_append_message (dest_folder, message, ex); -} - - -void -camel_folder_copy_message_to (CamelFolder *folder, - CamelMimeMessage *message, - CamelFolder *dest_folder, - CamelException *ex) -{ - g_assert (folder != NULL); - g_assert (camel_folder_is_open (folder)); - - CF_CLASS (folder)->copy_message_to (folder, message, dest_folder, ex);; -} - - - - - -/* summary stuff */ - -gboolean -camel_folder_has_summary_capability (CamelFolder *folder) -{ - g_assert (folder != NULL); - 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) -{ - g_assert (folder != NULL); - g_assert (camel_folder_is_open (folder)); - - 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) -{ - g_assert (folder != NULL); - 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) -{ - g_assert (folder != NULL); - g_assert (folder->has_uid_capability); - g_assert (camel_folder_is_open (folder)); - - return CF_CLASS (folder)->get_message_uid (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) -{ - CAMEL_LOG_WARNING ("Calling CamelFolder::get_message_uid_by_number " - "directly. Should be overloaded\n"); - return NULL; -} - - -const gchar * -camel_folder_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex); - -/** - * 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) -{ - g_assert (folder != NULL); - - /* if (!folder->has_uid_capability) return NULL; */ - /* return CF_CLASS (folder)->get_message_uid_by_number (folder, message_number, ex); */ - - return NULL; -} -#endif /* 0 */ - -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) -{ - g_assert (folder != NULL); - g_assert (folder->has_uid_capability); - g_assert (camel_folder_is_open (folder)); - - return CF_CLASS (folder)->get_message_by_uid (folder, uid, ex); -} - -static GList * -_get_uid_list (CamelFolder *folder, CamelException *ex) -{ - 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) -{ - g_assert (folder != NULL); - g_assert (folder->has_uid_capability); - g_assert (camel_folder_is_open (folder)); - - return CF_CLASS (folder)->get_uid_list (folder, ex); -} - -/** - * camel_folder_has_search_capability: - * @folder: Folder object - * - * Checks if a folder supports searching. - * - * Return value: TRUE if the folder supports UIDs - **/ -gboolean -camel_folder_has_search_capability (CamelFolder *folder) -{ - g_assert (folder != NULL); - return folder->has_search_capability; -} - -GList *camel_folder_search_by_expression (CamelFolder *folder, - const char *expression, - CamelException *ex) -{ - g_assert (folder != NULL); - g_assert (folder->has_search_capability); - - return CF_CLASS (folder)->search_by_expression (folder, expression, ex); -} - -/* **** */ diff --git a/camel/camel-folder.h b/camel/camel-folder.h deleted file mode 100644 index a3b9788c84..0000000000 --- a/camel/camel-folder.h +++ /dev/null @@ -1,313 +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 - * - * 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 -#include "camel-types.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; - gchar separator; - CamelStore *parent_store; - CamelFolder *parent_folder; - GList *permanent_flags; - - gboolean has_summary_capability; - CamelFolderSummary *summary; - - gboolean has_uid_capability; - - gboolean has_search_capability; -}; - - - -typedef struct { - GtkObjectClass parent_class; - - /* Virtual methods */ - void (*init) (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, 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); - - const gchar * (*get_name) (CamelFolder *folder, - CamelException *ex); - - const gchar * (*get_full_name) (CamelFolder *folder, - CamelException *ex); - - gboolean (*can_hold_folders) (CamelFolder *folder); - - gboolean (*can_hold_messages) (CamelFolder *folder); - - gboolean (*exists) (CamelFolder *folder, - CamelException *ex); - - gboolean (*is_open) (CamelFolder *folder); - - 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); - - 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); - - gboolean (*has_search_capability) (CamelFolder *folder); - - GList *(*search_by_expression) (CamelFolder *folder, const char *expression, 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_close (CamelFolder *folder, - gboolean expunge, - 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); -gboolean camel_folder_is_open (CamelFolder *folder); - - - -/* 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); -CamelFolderSummary *camel_folder_get_summary (CamelFolder *folder, - CamelException *ex); - - -/* number based access operations */ -gboolean camel_folder_has_message_number_capability (CamelFolder *folder); -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); -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); - -/* search api */ -gboolean camel_folder_has_search_capability (CamelFolder *folder); -GList * camel_folder_search_by_expression (CamelFolder *folder, - const char *expression, - CamelException *ex); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_FOLDER_H */ - diff --git a/camel/camel-formatter.c b/camel/camel-formatter.c deleted file mode 100644 index 469a096689..0000000000 --- a/camel/camel-formatter.c +++ /dev/null @@ -1,1039 +0,0 @@ - /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/*--------------------------------*-C-*---------------------------------* - * - * Author : - * Matt Loper - * - * Copyright 2000, Helix Code, Inc. (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 Street #330, Boston, MA 02111-1307, USA. - * - *----------------------------------------------------------------------*/ - -#include -#include "camel-formatter.h" -#include "camel-data-wrapper.h" -#include "camel-mime-message.h" -#include "camel-multipart.h" -#include "camel-recipient.h" - -#include "camel-log.h" -#include -#include /* for isprint */ -#include /* for strstr */ - -/* - * The CamelFormatter takes a mime message, and produces html from it, - * through the single function camel_formatter_mime_message_to_html(). - * The flow of execution goes something like this: - * - * camel_formatter_mime_message_to_html() - * | - * V - * call_handler_function() - * - * Then, 'call_handler_function' acts as a dispatcher, using a - * hashtable to match a mime type to one of the following functions; - * note that the below functions sometimes then use - * 'call_handler_function()' to continue the process recursively. - */ - -static void handle_text_plain (CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_text_html (CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_image (CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_vcard (CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_mime_part (CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_multipart_mixed (CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_multipart_related (CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_multipart_alternative(CamelFormatter *formatter, - CamelDataWrapper *wrapper); -static void handle_unknown_type (CamelFormatter *formatter, - CamelDataWrapper *wrapper); - -/* encodes some characters into their 'escaped' version; - * so '<' turns into '<', and '"' turns into '"' */ -static gchar* text_to_html (const guchar *input, - guint len, - guint *encoded_len_return); - -/* compares strings case-insensitively */ -static gint strcase_equal (gconstpointer v, gconstpointer v2); -static gchar* str_tolower (gchar* str); - -/* writes the header info for a mime message into a stream */ -static void write_header_info_to_stream (CamelMimeMessage* mime_message, - CamelStream* stream); - -/* dispatch html printing via mimetype */ -static void call_handler_function (CamelFormatter* formatter, - CamelDataWrapper* wrapper, - gchar* mimetype_whole, - gchar* mimetype_main); - -static GtkObjectClass *parent_class = NULL; - -struct _CamelFormatterPrivate { - CamelDataWrapper *current_root; - CamelStream *stream; - GHashTable *attachments; -}; - - -static void -debug (const gchar *format, ...) -{ - va_list args; - gchar *string; - - g_return_if_fail (format != NULL); - - va_start (args, format); - string = g_strdup_vprintf (format, args); - va_end (args); - - fputs (string, stdout); - fflush (stdout); - - g_free (string); -} - -static void -initialize_camel_formatter (CamelFormatter* formatter, - CamelDataWrapper* data_wrapper, - CamelStream* stream) -{ - CamelFormatterPrivate* fmt = formatter->priv; - - /* initialize members of our formatter */ - fmt->current_root = data_wrapper; - fmt->stream = stream; - if (fmt->attachments) - g_hash_table_destroy (fmt->attachments); - fmt->attachments = g_hash_table_new (g_str_hash, strcase_equal); -} - - -/** - * camel_formatter_wrapper_to_html: - * @formatter: the camel formatter object - * @data_wrapper: the data wrapper - * @stream: byte stream where data will be written - * - * Writes a CamelDataWrapper out, as html, into a stream passed in as - * a parameter. - **/ -void camel_formatter_wrapper_to_html (CamelFormatter* formatter, - CamelDataWrapper* data_wrapper, - CamelStream* stream_out) -{ - CamelFormatterPrivate* fmt = formatter->priv; - gchar *mimetype_whole = - g_strdup_printf ("%s/%s", - data_wrapper->mime_type->type, - data_wrapper->mime_type->subtype); - - g_print ("camel_formatter_wrapper_to_html: entered\n"); - g_assert (formatter && data_wrapper && stream_out); - - /* give the root CamelDataWrapper and the stream to the formatter */ - initialize_camel_formatter (formatter, data_wrapper, stream_out); - - if (stream_out) { - - /* write everything to the stream */ - camel_stream_write_string ( - fmt->stream, "\n"); - call_handler_function ( - formatter, - data_wrapper, - mimetype_whole, - data_wrapper->mime_type->type); - - camel_stream_write_string (fmt->stream, "\n\n"); - } - - - g_free (mimetype_whole); -} - - -/** - * camel_formatter_mime_message_to_html: - * @formatter: the camel formatter object - * @mime_message: the input mime message - * @header_stream: byte stream where data will be written (can be - * NULL) - * @body_stream: byte stream where data will be written (required) - * - * Writes a CamelMimeMessage out, as html, into a stream passed in as - * a parameter. - **/ -void -camel_formatter_mime_message_to_html (CamelFormatter* formatter, - CamelMimeMessage* mime_message, - CamelStream* header_stream, - CamelStream* body_stream) -{ - g_print ("camel_formatter_mime_message_to_html: entered\n"); - - g_assert (formatter != NULL); - g_assert (CAMEL_IS_FORMATTER (formatter)); - g_assert (mime_message != NULL); - g_assert (CAMEL_IS_MIME_MESSAGE (mime_message)); - - g_assert (header_stream || body_stream); - - /* give the root CamelDataWrapper and the stream to the - formatter */ - initialize_camel_formatter (formatter, - CAMEL_DATA_WRAPPER (mime_message), - body_stream); - - if (body_stream) { - /* Write the contents of the mime message to the stream */ - camel_stream_write_string (body_stream, "\n"); - call_handler_function ( - formatter, - CAMEL_DATA_WRAPPER (mime_message), - "message/rfc822", - "message"); - camel_stream_write_string (body_stream, "\n\n"); - } - - /* write the subj:, to:, from: etc. fields out as html to the - header stream */ - if (header_stream) - write_header_info_to_stream (mime_message, - header_stream); -} - -/* we're maintaining a hashtable of mimetypes -> functions; - * those functions have the following signature...*/ -typedef void (*mime_handler_fn) (CamelFormatter *formatter, - CamelDataWrapper *data_wrapper); - -static gchar* -lookup_unique_id (CamelDataWrapper* root, CamelDataWrapper* child) -{ - /* ** FIXME : replace this with a string representing - the location of the objetc in the tree */ - /* TODO: assert our return value != NULL */ - - gchar *temp_hack_uid; - - temp_hack_uid = g_strdup_printf ("%p", camel_data_wrapper_get_output_stream (child)); - - return temp_hack_uid; -} - -static GHashTable* mime_function_table; - -/* This tries to create a tag, given a mimetype and the child of a - * mime message. It can return NULL if it can't match the mimetype to - * a bonobo object. */ -static gchar* -get_bonobo_tag_for_object (CamelFormatter* formatter, - CamelDataWrapper* wrapper, - gchar* mimetype) -{ - - CamelDataWrapper* root = formatter->priv->current_root; - char* uid = lookup_unique_id (root, wrapper); - const char* goad_id = gnome_mime_get_value ( - mimetype, "bonobo-goad_id"); - - g_assert (root); - - if (goad_id) { - char* tag = g_strdup_printf ( - "", - goad_id, uid); - return tag; - } - else - return NULL; -} - - -/* - * This takes a mimetype, and tries to map that mimetype to a function - * or a bonobo object. - * - * - If it's mapped to a bonobo object, this function prints a tag - * into the stream, designating the bonobo object and a place that - * the bonobo object can find data to hydrate from - * - * - otherwise, the mimetype is mapped to another function, which can - * print into the stream - */ -static void -call_handler_function (CamelFormatter* formatter, - CamelDataWrapper* wrapper, - gchar* mimetype_whole_in, /* ex. "image/jpeg" */ - gchar* mimetype_main_in) /* ex. "image" */ -{ - mime_handler_fn handler_function = NULL; - gchar* mimetype_whole = NULL; - gchar* mimetype_main = NULL; - - g_assert (formatter); - g_assert (mimetype_whole_in || mimetype_main_in); - g_assert (wrapper); - -/* - * Try to find a handler function in our own lookup table - */ - if (mimetype_whole_in) { - mimetype_whole = str_tolower (mimetype_whole_in); - - handler_function = g_hash_table_lookup ( - mime_function_table, mimetype_whole); - } - - if (mimetype_main_in) - mimetype_main = str_tolower (mimetype_main_in); - - if (mimetype_main && !handler_function) - handler_function = g_hash_table_lookup ( - mime_function_table, mimetype_main); -/* - * Upon failure, try to find a bonobo object to show the object - */ - if (!handler_function) { - - gchar* bonobo_tag = NULL; - - if (mimetype_whole) - bonobo_tag = get_bonobo_tag_for_object ( - formatter, wrapper, mimetype_whole); - - if (mimetype_main && !bonobo_tag) - bonobo_tag = get_bonobo_tag_for_object ( - formatter, wrapper, mimetype_main); - - if (bonobo_tag) { - - /* we can print a tag, and return! */ - camel_stream_write_string ( - formatter->priv->stream, bonobo_tag); - g_free (bonobo_tag); - if (mimetype_whole) g_free (mimetype_whole); - if (mimetype_main) g_free (mimetype_main); - - return; - } - } -/* - * Use either a handler function we've found, or a default handler - */ - if (handler_function) - (*handler_function)(formatter, wrapper); - else { - handle_unknown_type (formatter, wrapper); - debug ("no function or bonobo object found for mimetype \"%s\"\n", - mimetype_whole?mimetype_whole:mimetype_main); - } - if (mimetype_whole) g_free (mimetype_whole); - if (mimetype_main) g_free (mimetype_main); -} - - -/*----------------------------------------------------------------------* - * Header (ex. "subj:", "from:") helper functions for mime msgs - *----------------------------------------------------------------------*/ - -/* This routine was originally written by Daniel Velliard, (C) 1998 - * World Wide Web Consortium. - * - It will (for example) turn the input 'ab ' into 'ab <c>' - * - It has also been altered to turn '\n' into
. */ -static gchar * -text_to_html (const guchar *input, - guint len, - guint *encoded_len_return) -{ - const guchar *cur = input; - guchar *buffer = NULL; - guchar *out = NULL; - gint buffer_size = 0; - guint count; - - /* Allocate a translation buffer. */ - buffer_size = 1000; - buffer = g_malloc (buffer_size); - - out = buffer; - count = 0; - - while (count < len) { - if (out - buffer > buffer_size - 100) { - gint index = out - buffer; - - buffer_size *= 2; - buffer = g_realloc (buffer, buffer_size); - out = &buffer[index]; - } - - /* By default one has to encode at least '<', '>', '"' - and '&'. */ - if (*cur == '<') { - *out++ = '&'; - *out++ = 'l'; - *out++ = 't'; - *out++ = ';'; - } else if (*cur == '>') { - *out++ = '&'; - *out++ = 'g'; - *out++ = 't'; - *out++ = ';'; - } else if (*cur == '&') { - *out++ = '&'; - *out++ = 'a'; - *out++ = 'm'; - *out++ = 'p'; - *out++ = ';'; - } else if (*cur == '"') { - *out++ = '&'; - *out++ = 'q'; - *out++ = 'u'; - *out++ = 'o'; - *out++ = 't'; - *out++ = ';'; - } else if (((*cur >= 0x20) && (*cur < 0x80)) - || (*cur == '\n') || (*cur == '\r') || (*cur == '\t')) { - /* Default case, just copy. */ - *out++ = *cur; - } else { - char buf[10], *ptr; - - g_snprintf(buf, 9, "&#%d;", *cur); - - ptr = buf; - while (*ptr != 0) - *out++ = *ptr++; - } - - /* turn newlines into
*/ - if (*cur == '\n') { - *out++ = '<'; - *out++ = 'b'; - *out++ = 'r'; - *out++ = '>'; - } - - - cur++; - count++; - } - - *out = 0; - *encoded_len_return = out - buffer; - - return buffer; -} - - -static void -write_field_to_stream (const gchar* description, const gchar* value, - CamelStream *stream, gboolean as_table_row) -{ - gchar *s; - guint ev_length; - gchar* encoded_value = value?text_to_html ( - value, strlen(value), &ev_length):""; - int i; - for (i = 0; i < strlen (value); i++) - if (!isprint(encoded_value[i])) - encoded_value[i] = 'Z'; - - g_assert (description && value); - - s = g_strdup_printf ("%s%s%s%s%s\n", - as_table_row?"":"", - description, - as_table_row?"":" ", - encoded_value, - as_table_row?"":"
"); - - camel_stream_write_string (stream, s); - g_free (encoded_value); - g_free (s); -} - - -static void -write_recipients_to_stream (const gchar* recipient_type, - const GList* recipients, - CamelStream* stream, - gboolean as_table_row) -{ - /* list of recipients, like "elvis@graceland; bart@springfield" */ - gchar *recipients_string = NULL; - g_assert (recipient_type && stream); - - /* Write out each recipient of 'recipient_type' to the stream */ - while (recipients) { - gchar *old_string = recipients_string; - recipients_string = g_strdup_printf ( - "%s%s%s", - old_string?old_string:"", - old_string?"; ":"", - (gchar*)recipients->data); - - g_free (old_string); - - recipients = recipients->next; - } - write_field_to_stream (recipient_type, recipients_string, stream, - as_table_row); - - g_free (recipients_string); -} - - - -static void -write_header_info_to_stream (CamelMimeMessage* mime_message, - CamelStream* stream) -{ - gchar *s = NULL; - const GList *recipients = NULL; - - g_assert (mime_message && stream); - - camel_stream_write_string (stream, ""); - - /* A few fields will probably be available from the mime_message; - for each one that's available, write it to the output stream - with a helper function, 'write_field_to_stream'. */ - if ((s = (gchar*)camel_mime_message_get_subject (mime_message))) { - write_field_to_stream ("Subject: ", s, stream, TRUE); - } - - if ((s = (gchar*)camel_mime_message_get_from (mime_message))) { - write_field_to_stream ("From: ", s, stream, TRUE); - } - - if ((s = (gchar*)camel_mime_message_get_received_date (mime_message))) { - write_field_to_stream ("Received Date: ", s, stream, TRUE); - } - - if ((s = (gchar*)camel_mime_message_get_sent_date (mime_message))) { - write_field_to_stream ("Sent Date: ", s, stream, TRUE); - } - - /* Fill out the "To:" recipients line */ - recipients = camel_mime_message_get_recipients ( - mime_message, CAMEL_RECIPIENT_TYPE_TO); - - if (recipients) - write_recipients_to_stream ("To:", recipients, stream, TRUE); - - /* Fill out the "CC:" recipients line */ - recipients = camel_mime_message_get_recipients ( - mime_message, CAMEL_RECIPIENT_TYPE_CC); - if (recipients) - write_recipients_to_stream ("CC:", recipients, stream, TRUE); - - /* Fill out the "BCC:" recipients line */ - recipients = camel_mime_message_get_recipients ( - mime_message, CAMEL_RECIPIENT_TYPE_BCC); - if (recipients) - write_recipients_to_stream ("BCC:", recipients, stream, TRUE); - - camel_stream_write_string (stream, "
"); -} - -/* case-insensitive string comparison */ -static gint -strcase_equal (gconstpointer v, gconstpointer v2) -{ - return g_strcasecmp ((const gchar*) v, (const gchar*)v2) == 0; -} - -static gchar* -str_tolower (gchar* str) -{ - int i; - int len = strlen (str); - gchar* new_str = g_strdup (str); - - for (i = 0; i < len; i++) { - new_str[i] = tolower (str[i]); - } - return new_str; -} - - -#define MIME_TYPE_WHOLE(a) (gmime_content_field_get_mime_type ( \ - camel_mime_part_get_content_type (CAMEL_MIME_PART (a)))) -#define MIME_TYPE_MAIN(a) ((camel_mime_part_get_content_type (CAMEL_MIME_PART (a)))->type) -#define MIME_TYPE_SUB(a) ((camel_mime_part_get_content_type (CAMEL_MIME_PART (a)))->subtype) - - -/*----------------------------------------------------------------------* - * Mime handling functions - *----------------------------------------------------------------------*/ - -static void -handle_text_plain (CamelFormatter *formatter, CamelDataWrapper *wrapper) -{ - gchar* text; - CamelStream *wrapper_output_stream; - gchar tmp_buffer[4096]; - gint nb_bytes_read; - gboolean empty_text = TRUE; - - debug ("handle_text_plain: entered\n"); - - camel_stream_write_string (formatter->priv->stream, - "\n\n"); - - if (strcmp (wrapper->mime_type->subtype, "richtext") == 0) { - - camel_stream_write_string ( - formatter->priv->stream, - "
Warning: the following richtext may not"); - camel_stream_write_string ( - formatter->priv->stream, - " be formatted correctly.

"); - } - - /* get the output stream of the data wrapper */ - wrapper_output_stream = camel_data_wrapper_get_output_stream (wrapper); - - camel_stream_reset (wrapper_output_stream); - - - do { - - /* read next chunk of text */ - nb_bytes_read = camel_stream_read (wrapper_output_stream, - tmp_buffer, - 4096); - - /* If there's any text, write it to the stream */ - if (nb_bytes_read > 0) { - - int returned_strlen; - - empty_text = FALSE; - - /* replace '<' with '<', etc. */ - text = text_to_html (tmp_buffer, - nb_bytes_read, - &returned_strlen); - - camel_stream_write_string (formatter->priv->stream, text); - g_free (text); - } - - - } while (!camel_stream_eos (wrapper_output_stream)); - - - if (empty_text) { - debug ("Warning: handle_text_plain: text part is empty!\n"); - camel_stream_write_string (formatter->priv->stream, - "(empty)"); - } - - debug ("handle_text_plain: exiting\n"); -} - -static void -handle_text_html (CamelFormatter *formatter, CamelDataWrapper *wrapper) -{ - CamelStream *wrapper_output_stream; - gchar tmp_buffer[4096]; - gint nb_bytes_read; - gboolean empty_text = TRUE; - - - debug ("handle_text_html: entered\n"); - - /* get the output stream of the data wrapper */ - wrapper_output_stream = camel_data_wrapper_get_output_stream (wrapper); - - camel_stream_reset (wrapper_output_stream); - - /* write the header */ - camel_stream_write_string (formatter->priv->stream, - "\n\n"); - - do { - - /* read next chunk of text */ - nb_bytes_read = camel_stream_read (wrapper_output_stream, - tmp_buffer, - 4096); - - /* If there's any text, write it to the stream */ - if (nb_bytes_read > 0) { - - empty_text = FALSE; - - /* write the buffer to the formater output stream */ - camel_stream_write (formatter->priv->stream, tmp_buffer, nb_bytes_read); - } - - - } while (!camel_stream_eos (wrapper_output_stream)); - - - if (empty_text) { - debug ("Warning: handle_text_html: html part is empty!\n"); - camel_stream_write_string (formatter->priv->stream, - "(empty)"); - } - - debug ("handle_text_html: exiting\n"); -} - -static void -handle_image (CamelFormatter *formatter, CamelDataWrapper *wrapper) -{ - gchar* uuid; - gchar* tag; - - debug ("handle_image: entered\n"); - - uuid = lookup_unique_id (formatter->priv->current_root, wrapper); - - tag = g_strdup_printf ("\n", uuid); - camel_stream_write_string (formatter->priv->stream, tag); - - g_free (uuid); - g_free (tag); - - debug ("handle_image: exiting\n"); -} - -static void -handle_vcard (CamelFormatter *formatter, CamelDataWrapper *wrapper) -{ - gchar* vcard = NULL; - debug ("handle_vcard: entered\n"); - - camel_stream_write_string (formatter->priv->stream, - "\n\n"); -// camel_stream_write_string (formatter->priv->stream, vcard); -// g_free (vcard); - - debug ("handle_vcard: exiting\n"); -} - -static void -handle_mime_part (CamelFormatter *formatter, - CamelDataWrapper *wrapper) -{ - CamelMimePart* mime_part; - CamelDataWrapper* message_contents; - - g_assert (formatter); - g_assert (wrapper); - g_assert (CAMEL_IS_MIME_PART (wrapper)); - - mime_part = CAMEL_MIME_PART (wrapper); - message_contents = - camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)); - - g_assert (message_contents); - - debug ("handle_mime_part: entered\n"); - camel_stream_write_string (formatter->priv->stream, - "\n\n"); - -// camel_stream_write_string (formatter->priv->stream, -// "
\n\n"); - - /* dispatch the correct handler function for the mime type */ - call_handler_function (formatter, message_contents, - MIME_TYPE_WHOLE (mime_part), - MIME_TYPE_MAIN (mime_part)); - - /* close up the table we opened */ -// camel_stream_write_string (formatter->priv->stream, -// "\n\n
\n\n"); - - debug ("handle_mime_part: exiting\n"); -} - - -/* - * multipart-alternative helper function -- - * returns NULL if no text/html or text/plan msg is found - */ -static CamelMimePart* -find_preferred_displayable_body_part_in_multipart_alternative ( - CamelMultipart* multipart) -{ - int i, max_multiparts; - CamelMimePart* html_part = NULL; - CamelMimePart* plain_part = NULL; - - /* find out out many parts are in it...*/ - max_multiparts = camel_multipart_get_number (multipart); - - /* TODO: DO LEAF-LOOKUP HERE FOR OTHER MIME-TYPES!!! */ - - for (i = 0; i < max_multiparts; i++) { - CamelMimeBodyPart* body_part = - camel_multipart_get_part (multipart, i); - - if (!strcase_equal (MIME_TYPE_MAIN (body_part), "text")) - continue; - - if (strcase_equal (MIME_TYPE_SUB (body_part), "plain")) { - plain_part = CAMEL_MIME_PART (body_part); - } - else if (strcase_equal (MIME_TYPE_SUB (body_part), "html")) { - html_part = CAMEL_MIME_PART (body_part); - } - } - - if (html_part) - return html_part; - if (plain_part) - return plain_part; - return NULL; -} - - -/* called for each body part in a multipart/mixed */ -static void -print_camel_body_part (CamelMimeBodyPart* body_part, - CamelFormatter* formatter, - gboolean* text_printed_yet) -{ - CamelDataWrapper* contents = - camel_medium_get_content_object (CAMEL_MEDIUM (body_part)); - gboolean is_text = - strcase_equal (MIME_TYPE_MAIN (body_part), "text"); - - if (is_text && *text_printed_yet) - return; - - call_handler_function (formatter, contents, MIME_TYPE_WHOLE (body_part), - MIME_TYPE_MAIN (body_part)); - camel_stream_write_string (formatter->priv->stream, "\n
\n"); -} - - - -/* Our policy here is this: - (1) print text/(plain|html) parts found - (2) print vcards and images inline - (3) treat all other parts as attachments */ -static void -handle_multipart_mixed (CamelFormatter *formatter, - CamelDataWrapper *wrapper) -{ - CamelMultipart* mp; - gboolean text_printed_yet = FALSE; - - g_assert (formatter); - g_assert (wrapper); - g_assert (CAMEL_IS_MULTIPART (wrapper)); - - mp = CAMEL_MULTIPART (wrapper); - g_assert (mp); - -// debug ("handle_multipart_mixed: entered\n"); - - - { - int i, max_multiparts; - - max_multiparts = camel_multipart_get_number (mp); - for (i = 0; i < max_multiparts; i++) { - CamelMimeBodyPart* body_part = - camel_multipart_get_part (mp, i); - - print_camel_body_part (body_part, formatter, &text_printed_yet); - } - } - - -// debug ("handle_multipart_mixed: exiting\n"); -} - -static void -handle_multipart_related (CamelFormatter *formatter, - CamelDataWrapper *wrapper) -{ - CamelMultipart* mp = CAMEL_MULTIPART (wrapper); - debug ("handle_multipart_related: entered\n"); - - debug ("handle_multipart_related: NYI!!\n"); - - /* TODO: read RFC, in terms of how a one message - may refer to another object */ - - debug ("handle_multipart_related: exiting\n"); -} - -/* - The current policy for multipart/alternative is this: - - if (we find a text/html body part) - we print it - else if (we find a text/plain body part) - we print it - else - we print nothing -*/ -static void -handle_multipart_alternative (CamelFormatter *formatter, - CamelDataWrapper *wrapper) -{ - CamelMultipart* multipart = CAMEL_MULTIPART (wrapper); - CamelMimePart* mime_part; - - debug ("handle_multipart_alternative: entered\n"); - - mime_part = - find_preferred_displayable_body_part_in_multipart_alternative( - multipart); - if (mime_part) { - - CamelDataWrapper* contents = - camel_medium_get_content_object ( - CAMEL_MEDIUM (mime_part)); - - call_handler_function (formatter, contents, - MIME_TYPE_WHOLE (mime_part), - MIME_TYPE_MAIN (mime_part)); - } - - debug ("handle_multipart_alternative: exiting\n"); -} - -static void -handle_unknown_type (CamelFormatter *formatter, - CamelDataWrapper *wrapper) -{ - gchar* tag; - CamelDataWrapper* root = formatter->priv->current_root; - char* uid = lookup_unique_id (root, wrapper); - - debug ("handle_unknown_type: entered\n"); - - tag = g_strdup_printf ("click-me-to-save\n", - uid); - - camel_stream_write_string (formatter->priv->stream, tag); - - debug ("handle_unknown_type: exiting\n"); -} - -/*----------------------------------------------------------------------* - * Standard Gtk+ class functions - *----------------------------------------------------------------------*/ - -CamelFormatter* -camel_formatter_new () -{ - return (gtk_type_new (CAMEL_FORMATTER_TYPE)); -} - - -static void -_finalize (GtkObject* object) -{ - CamelFormatter *formatter = CAMEL_FORMATTER (object); - - if (formatter->priv->attachments) - g_hash_table_destroy (formatter->priv->attachments); - - g_free (formatter->priv); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -camel_formatter_class_init (CamelFormatterClass *camel_formatter_class) -{ - GtkObjectClass *gtk_object_class = - GTK_OBJECT_CLASS (camel_formatter_class); - - parent_class = gtk_type_class (gtk_object_get_type ()); - - mime_function_table = - g_hash_table_new (g_str_hash, strcase_equal); - -#define ADD_HANDLER(a,b) g_hash_table_insert (mime_function_table, a, b) - - /* hook up mime types to functions that handle them */ - ADD_HANDLER ("text/plain", handle_text_plain); - ADD_HANDLER ("text/richtext", handle_text_plain); - ADD_HANDLER ("text/html", handle_text_html); - ADD_HANDLER ("multipart/alternative", handle_multipart_alternative); - ADD_HANDLER ("multipart/related", handle_multipart_related); - ADD_HANDLER ("multipart/mixed", handle_multipart_mixed); - ADD_HANDLER ("message/rfc822", handle_mime_part); - ADD_HANDLER ("image/", handle_image); - ADD_HANDLER ("vcard/", handle_vcard); - - /* body parts don't have mime parts per se, so camel - sticks on the following one */ - ADD_HANDLER ("mime/body-part", handle_mime_part); - - /* virtual method overload */ - gtk_object_class->finalize = _finalize; -} - - -static void -camel_formatter_init (gpointer object, gpointer klass) -{ - CamelFormatter* cmf = CAMEL_FORMATTER (object); - cmf->priv = g_new (CamelFormatterPrivate, 1); - cmf->priv->attachments = NULL; -} - - -GtkType -camel_formatter_get_type (void) -{ - static GtkType camel_formatter_type = 0; - - if (!camel_formatter_type) { - GtkTypeInfo camel_formatter_info = - { - "CamelFormatter", - sizeof (CamelFormatter), - sizeof (CamelFormatterClass), - (GtkClassInitFunc) camel_formatter_class_init, - (GtkObjectInitFunc) camel_formatter_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_formatter_type = gtk_type_unique ( - gtk_object_get_type (), - &camel_formatter_info); - } - - return camel_formatter_type; -} diff --git a/camel/camel-formatter.h b/camel/camel-formatter.h deleted file mode 100644 index e0090c7bfd..0000000000 --- a/camel/camel-formatter.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - - -/*--------------------------------*-C-*---------------------------------* - * - * Author : - * Matt Loper - * - * Copyright 2000, Helix Code, Inc. (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 Street #330, Boston, MA 02111-1307, USA. - * - *----------------------------------------------------------------------*/ - -#ifndef CAMEL_FORMATTER_H -#define CAMEL_FORMATTER_H - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#include -#include "camel-types.h" - -#define CAMEL_FORMATTER_TYPE (camel_formatter_get_type ()) -#define CAMEL_FORMATTER(obj) (GTK_CHECK_CAST((obj), CAMEL_FORMATTER_TYPE, CamelFormatter)) -#define CAMEL_FORMATTER_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_FORMATTER_TYPE, CamelFormatterClass)) -#define CAMEL_IS_FORMATTER(o) (GTK_CHECK_TYPE((o), CAMEL_FORMATTER_TYPE)) - -typedef struct _CamelFormatterPrivate CamelFormatterPrivate; - -struct _CamelFormatter -{ - GtkObject parent_object; - CamelFormatterPrivate *priv; -}; - -typedef struct { - GtkObjectClass parent_class; -} CamelFormatterClass; - - -/* Standard Gtk function */ -GtkType camel_formatter_get_type (void); - -/* Public functions */ -CamelFormatter* camel_formatter_new (void); - -void camel_formatter_mime_message_to_html (CamelFormatter* formatter, - CamelMimeMessage* mime_message, - CamelStream* header_stream, - CamelStream* body_stream); - -void camel_formatter_wrapper_to_html (CamelFormatter* formatter, - CamelDataWrapper* data_wrapper, - CamelStream* header_stream); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif // CAMEL_FORMATTER_H - diff --git a/camel/camel-log.c b/camel/camel-log.c deleted file mode 100644 index 970986a5ad..0000000000 --- a/camel/camel-log.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include "camel-log.h" - -int camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; -FILE *camel_log_file_descriptor = NULL; - -void -camel_log(guint level, const gchar *format, ... ) -{ - va_list args; - if (camel_log_file_descriptor == NULL) - camel_log_file_descriptor = stdout; - - if (level<=camel_debug_level) - { - va_start(args, format); - vfprintf(camel_log_file_descriptor, format, args); - va_end (args); - } -} diff --git a/camel/camel-log.h b/camel/camel-log.h deleted file mode 100644 index 5337c79f4d..0000000000 --- a/camel/camel-log.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include -#include - -extern int camel_debug_level; -extern FILE *camel_log_file_descriptor; - -#define CAMEL_LOG_LEVEL_NO_LOG 0 -#define CAMEL_LOG_LEVEL_STRANGE 5 -#define CAMEL_LOG_LEVEL_WARNING 6 -#define CAMEL_LOG_LEVEL_TRACE 8 -#define CAMEL_LOG_LEVEL_FULL_DEBUG 10 - -/* #define CAMEL_HARD_LOG_LEVEL CAMEL_LOG_LEVEL_TRACE */ - -/* the idea here is to be able to have a hard maximum log -level, given at compilation time, and a soft one, given at -runtime (with camel_debug_level) */ - -#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_STRANGE -#define CAMEL_LOG_STRANGE(args...) camel_log(CAMEL_LOG_LEVEL_STRANGE, ##args) -#else /* CAMEL_LOG_LEVEL_STRANGE */ -#define CAMEL_LOG_STRANGE(args...) -#endif /* CAMEL_LOG_LEVEL_STRANGE */ - -#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_WARNING -#define CAMEL_LOG_WARNING(args...) camel_log(CAMEL_LOG_LEVEL_WARNING, ##args) -#else /* CAMEL_LOG_LEVEL_WARNING */ -#define CAMEL_LOG_WARNING(args...) -#endif /* CAMEL_LOG_LEVEL_WARNING */ - -#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_TRACE -#define CAMEL_LOG_TRACE(args...) camel_log(CAMEL_LOG_LEVEL_TRACE, ##args) -#else /* CAMEL_LOG_LEVEL_TRACE */ -#define CAMEL_LOG_TRACE(args...) -#endif /* CAMEL_LOG_LEVEL_TRACE */ - -#if CAMEL_HARD_LOG_LEVEL>=CAMEL_LOG_LEVEL_FULL_DEBUG -#define CAMEL_LOG_FULL_DEBUG(args...) camel_log(CAMEL_LOG_LEVEL_FULL_DEBUG, ##args) -#else /* CAMEL_LOG_LEVEL_FULL_DEBUG */ -#define CAMEL_LOG_FULL_DEBUG(args...) -#endif /* CAMEL_LOG_LEVEL_FULL_DEBUG */ - - - - -extern void camel_log(guint level, const gchar *format, ... ); - -#endif /* CAMEL_LOG_H */ diff --git a/camel/camel-marshal-utils.c b/camel/camel-marshal-utils.c deleted file mode 100644 index ece61d79fc..0000000000 --- a/camel/camel-marshal-utils.c +++ /dev/null @@ -1,374 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-marshal-utils.c : marshal utils */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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; iparams_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; - in_params; - i++, params++) - { - gchar *error; - - params->name = NULL; - params->type = (func_def->params_type) [i]; - CAMEL_ARG_COLLECT_VALUE (params, - var_args, - error); - if (error) - { - failed = TRUE; - CAMEL_LOG_FULL_DEBUG ("CamelMarshall::_collect_params(): %s", error); - g_free (error); - } - } - return (failed); -} - - - -/** - * camel_marshal_create_op: create an operation - * @func_def: function definition object - * @func: function to call - * - * create a function ready to be executed. The - * vari - * - * - * Return value: operation ready to be executed - **/ -CamelOp * -camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...) -{ - GtkArg *params; - gboolean error; - CamelOp *op; - va_list args; - - g_assert (func_def); - - op = camel_op_new (func_def); - op->func = func; - - va_start (args, func); - error = _collect_params (op->params, func_def, args); - va_end (args); - - if (error) { - camel_op_free (op); - return NULL; - } else - return (op); -} - - - - -/** - * camel_op_new: return a new CamelOp object - * - * The obtained object must be destroyed with - * camel_op_free () - * - * Return value: the newly allocated CamelOp object - **/ -CamelOp * -camel_op_new (CamelFuncDef *func_def) -{ - CamelOp *op; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::new\n"); - g_static_mutex_lock (&op_chunk_mutex); - if (!op_chunk) - op_chunk = g_mem_chunk_create (CamelOp, - NB_OP_CHUNKS, - G_ALLOC_AND_FREE); - g_static_mutex_unlock (&op_chunk_mutex); - - op = g_chunk_new (CamelOp, op_chunk); - op->func_def = func_def; - op->params = g_new (GtkArg, func_def->n_params); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::new\n"); - return op; -} - -/** - * camel_op_free: free a CamelOp object allocated with camel_op_new - * @op: CamelOp object to free - * - * Free a CamelOp object allocated with camel_op_new () - * this routine won't work with CamelOp objects allocated - * with other allocators. - **/ -void -camel_op_free (CamelOp *op) -{ - CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::free\n"); - g_free (op->params); - g_chunk_free (op, op_chunk); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::free\n"); -} - - -/** - * camel_op_run: run an operation - * @op: the operation object - * - * run an operation - * - **/ -void -camel_op_run (CamelOp *op) -{ - GtkArg *params; - gboolean error; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::run\n"); - g_assert (op); - g_assert (op->func_def); - g_assert (op->params); - - op->func_def->marshal (op->func, op->params); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::run\n"); -} - - - - -/** - * camel_op_set_user_data: set the private field - * @op: operation - * @user_data: private field - * - * associate a field to an operation object - **/ -void -camel_op_set_user_data (CamelOp *op, gpointer user_data) -{ - CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::set_user_data\n"); - g_assert (op); - op->user_data = user_data; - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::set_user_data\n"); -} - - -/** - * camel_op_get_user_data: return the private field - * @op: operation object - * - * return the private field associated to - * an operation object. - * - * Return value: - **/ -gpointer -camel_op_get_user_data (CamelOp *op) -{ - CAMEL_LOG_FULL_DEBUG ("Entering CamelOp::get_user_data\n"); - g_assert (op); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOp::get_user_data\n"); - return op->user_data; -} - - - -/* misc marshaller */ - - -typedef void (*CamelMarshal_NONE__POINTER_INT) (gpointer arg1, - gint arg2); -void camel_marshal_NONE__POINTER_INT (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_INT rfunc; - - CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT\n"); - rfunc = (CamelMarshal_NONE__POINTER_INT) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_INT(args[1])); - CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT\n"); -} - - - - - -typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER) (gpointer arg1, - gint arg2, - gpointer arg3); -void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_INT_POINTER rfunc; - - CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT_POINTER\n"); - rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_INT(args[1]), - GTK_VALUE_POINTER(args[2])); - CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT_POINTER\n"); -} - - -typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER) (gpointer arg1, - gboolean arg2, - gpointer arg3); -void camel_marshal_NONE__POINTER_BOOL_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_BOOL_POINTER rfunc; - - CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_BOOL_POINTER\n"); - rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_BOOL(args[1]), - GTK_VALUE_POINTER(args[2])); - CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_BOOL_POINTER\n"); -} - - -typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) (gpointer arg1, - gint arg2, - gpointer arg3, - gpointer arg4); -void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_INT_POINTER_POINTER rfunc; - - CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_INT_POINTER_POINTER\n"); - rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_INT(args[1]), - GTK_VALUE_POINTER(args[2]), - GTK_VALUE_POINTER(args[3])); - CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_INT_POINTER_POINTER\n"); -} - - - -typedef void (*CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) (gpointer arg1, - gboolean arg2, - gpointer arg3, - gpointer arg4); -void camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER rfunc; - - CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER\n"); - rfunc = (CamelMarshal_NONE__POINTER_BOOL_POINTER_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_BOOL(args[1]), - GTK_VALUE_POINTER(args[2]), - GTK_VALUE_POINTER(args[3])); - CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_BOOL_POINTER_POINTER\n"); -} - - - -typedef void (*CamelMarshal_NONE__POINTER_POINTER_POINTER) (gpointer arg1, - gpointer arg2, - gpointer arg3); -void camel_marshal_NONE__POINTER_POINTER_POINTER (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__POINTER_POINTER_POINTER rfunc; - - CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__POINTER_POINTER_POINTER\n"); - rfunc = (CamelMarshal_NONE__POINTER_POINTER_POINTER) func; - (* rfunc) (GTK_VALUE_POINTER(args[0]), - GTK_VALUE_POINTER(args[1]), - GTK_VALUE_POINTER(args[2])); - CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__POINTER_POINTER_POINTER\n"); -} - - -typedef void (*CamelMarshal_NONE__INT) (gint arg1); -void camel_marshal_NONE__INT (CamelFunc func, - GtkArg *args) -{ - CamelMarshal_NONE__INT rfunc; - - CAMEL_LOG_FULL_DEBUG ("Entering camel_marshal_NONE__INT\n"); - rfunc = (CamelMarshal_NONE__INT) func; - (* rfunc) (GTK_VALUE_INT (args[0])); - CAMEL_LOG_FULL_DEBUG ("Leaving camel_marshal_NONE__INT\n"); -} - - - - - - diff --git a/camel/camel-marshal-utils.h b/camel/camel-marshal-utils.h deleted file mode 100644 index 8ca9901ba2..0000000000 --- a/camel/camel-marshal-utils.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-maeshal-utils.h : marshal utils */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 - - -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 1410545c5e..0000000000 --- a/camel/camel-medium.c +++ /dev/null @@ -1,262 +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 - * - * 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 -#include "camel-medium.h" -#include -#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 -_free_header (gpointer key, gpointer value, gpointer data) -{ - g_free (key); - g_free (value); -} - -static void -_finalize (GtkObject *object) -{ - CamelMedium *medium = CAMEL_MEDIUM (object); - - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMedium::finalize\n"); - - if (medium->headers) { - g_hash_table_foreach (medium->headers, _free_header, NULL); - 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, g_strdup (header_name), - g_strdup (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 *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) -{ - - 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 8365d91344..0000000000 --- a/camel/camel-medium.h +++ /dev/null @@ -1,93 +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 - * - * 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 -#include "camel-types.h" -#include "camel-data-wrapper.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)) - - -struct _CamelMedium -{ - CamelDataWrapper parent_object; - - GHashTable *headers; - - CamelDataWrapper *content; /* part real content */ - -}; - - - -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 ffc8314d1f..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 - * - * 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 -#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) -{ - 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) -{ - camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), "mime/body-part"); -} - - - - -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 (void) -{ - 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 b6b137e0cd..0000000000 --- a/camel/camel-mime-body-part.h +++ /dev/null @@ -1,84 +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 - * - * 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 }*/ - -#include -#include "camel-types.h" -#include "camel-mime-part.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); -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 8fe1764f96..0000000000 --- a/camel/camel-mime-message.c +++ /dev/null @@ -1,718 +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 - * - * 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 -#include "camel-mime-message.h" -#include -#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_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (object), - "message/rfc822"); - - 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 8de1e05585..0000000000 --- a/camel/camel-mime-message.h +++ /dev/null @@ -1,166 +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 - * - * 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 }*/ - -#include -#include "camel-types.h" -#include "camel-mime-part.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, - const 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 fe3c175cb3..0000000000 --- a/camel/camel-mime-part-utils.c +++ /dev/null @@ -1,192 +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 - * - * 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 -#include "gmime-content-field.h" -#include "string-utils.h" -#include "camel-log.h" -#include "gmime-utils.h" -#include "camel-simple-data-wrapper.h" -#include "data-wrapper-repository.h" - -#include "camel-mime-part-utils.h" - - - -/* declare this function because it is public - but it must not be called except here */ -void camel_mime_part_set_content_type (CamelMimePart *mime_part, - gchar *content_type); - - -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; ilen; i++) { - cur_header = (Rfc822Header *)header_array->data + i; - camel_medium_add_header ( CAMEL_MEDIUM (mime_part), - cur_header->name, - cur_header->value); - g_free (cur_header->name); - g_free (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); - /* here we should have a mime type */ - g_assert (content_type); - 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); - - /* - * create the content object data wrapper with the type - * returned by the data wrapper repository - */ - 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); - - /* set the input stream for the content object */ - camel_data_wrapper_set_input_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_content_from_stream " - "content parsed\n"); - - CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils:: Leaving _construct_content_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); - - if (nb_bytes_read_chunk>0) { - nb_bytes_read_total += nb_bytes_read_chunk; - - while (nb_bytes_read_chunk >0) { - g_byte_array_set_size (buffer, nb_bytes_read_total + STREAM_READ_CHUNK_SZ); - nb_bytes_read_chunk = camel_stream_read (stream, - buffer->data + nb_bytes_read_total, - STREAM_READ_CHUNK_SZ); - nb_bytes_read_total += nb_bytes_read_chunk; - } - } - - g_byte_array_set_size (buffer, nb_bytes_read_total); - CAMEL_LOG_FULL_DEBUG ("CamelMimePartUtils::store_stream_in_buffer entering\n"); - -} diff --git a/camel/camel-mime-part-utils.h b/camel/camel-mime-part-utils.h deleted file mode 100644 index 7edbf5d603..0000000000 --- a/camel/camel-mime-part-utils.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-mime-part-utils : Utility for mime parsing and so on */ - - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 bfd511ca13..0000000000 --- a/camel/camel-mime-part.c +++ /dev/null @@ -1,979 +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 - * - * 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 -#include -#include "camel-mime-part.h" -#include -#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" -#include "camel-mime-part-utils.h" -#include "gmime-base64.h" -#include "camel-seekable-substream.h" -#include "camel-stream-b64.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) -#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_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); -static void _set_input_stream (CamelDataWrapper *data_wrapper, - CamelStream *stream); -static CamelStream * _get_output_stream (CamelDataWrapper *data_wrapper); - - -/* 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); - - - -/* from CamelMimePart */ -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; - camel_data_wrapper_class->set_input_stream = _set_input_stream; - camel_data_wrapper_class->get_output_stream = _get_output_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); - - /* 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; - CamelStream *decoded_stream; - - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object entering\n"); - - if (!medium->content ) { - stream = mime_part->content_input_stream; - decoded_stream = stream; - - switch (mime_part->encoding) { - - case CAMEL_MIME_PART_ENCODING_DEFAULT: - case CAMEL_MIME_PART_ENCODING_7BIT: - case CAMEL_MIME_PART_ENCODING_8BIT: - case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE: - break; - - case CAMEL_MIME_PART_ENCODING_BASE64: - decoded_stream = camel_stream_b64_new_with_input_stream (stream); - camel_stream_b64_set_mode (CAMEL_STREAM_B64 (decoded_stream), - CAMEL_STREAM_B64_DECODER); - break; - } - - - camel_mime_part_construct_content_from_stream (mime_part, decoded_stream); - - } else { - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_content_object part has a pointer " - "to a content object\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; - - 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_to_stream (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"); - -} - - - - -static void -_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - CamelMimePart *mime_part = CAMEL_MIME_PART (data_wrapper); - CamelSeekableStream *seekable_stream; - guint32 content_stream_inf_bound; - - - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_input_stream entering\n"); - - g_assert (CAMEL_IS_SEEKABLE_STREAM (stream)); - seekable_stream = CAMEL_SEEKABLE_STREAM (stream); - - /* call parent class implementation */ - CAMEL_DATA_WRAPPER_CLASS (parent_class)->set_input_stream (data_wrapper, stream); - - - camel_mime_part_construct_headers_from_stream (mime_part, stream); - - /* set the input stream for the content object */ - content_stream_inf_bound = camel_seekable_stream_get_current_position (seekable_stream); - mime_part->content_input_stream = - camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream, - content_stream_inf_bound, - -1); - - - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::set_input_stream leaving\n"); - -} - - -static CamelStream * -_get_output_stream (CamelDataWrapper *data_wrapper) -{ - CamelMimePart *mime_part = CAMEL_MIME_PART (data_wrapper); - CamelStream *input_stream; - CamelStream *output_stream; - /* ** FIXME : bogus bogus bogus - test test test */ - - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_output_stream leaving\n"); - input_stream = camel_data_wrapper_get_input_stream (data_wrapper); - - if (input_stream == NULL) - return NULL; - - switch (mime_part->encoding) { - - case CAMEL_MIME_PART_ENCODING_DEFAULT: - case CAMEL_MIME_PART_ENCODING_7BIT: - case CAMEL_MIME_PART_ENCODING_8BIT: - return input_stream; - - case CAMEL_MIME_PART_ENCODING_BASE64: - output_stream = camel_stream_b64_new_with_input_stream (input_stream); - camel_stream_b64_set_mode (CAMEL_STREAM_B64 (output_stream), - CAMEL_STREAM_B64_ENCODER); - return output_stream; - - case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE: - return input_stream; - } - - CAMEL_LOG_FULL_DEBUG ("CamelMimePart::get_output_stream leaving\n"); - - return NULL; -} - - -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"; - } - return ""; -} - - - -/* FIXME I am not sure this is the correct way to do this. */ -CamelMimePartEncodingType -camel_mime_part_encoding_from_string (const gchar *string) -{ - if (strcmp (string, "7bit") == 0) - return CAMEL_MIME_PART_ENCODING_7BIT; - else if (strcmp (string, "8bit") == 0) - return CAMEL_MIME_PART_ENCODING_8BIT; - else if (strcmp (string, "base64") == 0) - return CAMEL_MIME_PART_ENCODING_BASE64; - else if (strcmp (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 708091cb29..0000000000 --- a/camel/camel-mime-part.h +++ /dev/null @@ -1,154 +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 - * - * 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 -#include "camel-types.h" -#include "camel-medium.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 */ -struct _CamelMimePart -{ - 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; - CamelStream *content_input_stream; - -}; - - - -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 c44eaacb09..0000000000 --- a/camel/camel-multipart.c +++ /dev/null @@ -1,574 +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 - * - * 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 -#include "camel-log.h" -#include "gmime-content-field.h" -#include "gmime-utils.h" -#include "camel-stream-mem.h" -#include "camel-seekable-substream.h" -#include "camel-mime-body-part.h" -#include "camel-multipart.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 _set_input_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->set_input_stream = _set_input_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 (void) -{ - 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::boundary found : \"%s\"\n", 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"); -} - - - - - - - -/**********************/ -/* new implementation */ - - -/** - * _localize_part: localize one part in a multipart environement. - * @stream: the stream to read the lines from. - * @normal_boundary: end of part bundary. - * @end_boundary: end of multipart boundary. - * @end_position : end position of the mime part - * - * 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 -_localize_part (CamelStream *stream, - gchar *normal_boundary, - gchar *end_boundary, - guint32 *end_position) -{ - gchar *new_line = NULL; - gboolean end_of_part = FALSE; - gboolean last_part = FALSE; - guint32 last_position; - - /* 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 _localize_part\n"); - - g_assert (CAMEL_IS_SEEKABLE_STREAM (stream)); - - last_position = camel_seekable_stream_get_current_position (CAMEL_SEEKABLE_STREAM (stream)); - 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) { - - g_free (new_line); - - last_position = - camel_seekable_stream_get_current_position (CAMEL_SEEKABLE_STREAM (stream)); - - new_line = gmime_read_line_from_stream (stream); - } - } - - if (new_line) g_free (new_line); - else last_part = TRUE; - - *end_position = last_position; - - CAMEL_LOG_FULL_DEBUG ("CamelMultipart:: Leaving _localize_part\n"); - return (last_part); -} - - - - -static void -_set_input_stream (CamelDataWrapper *data_wrapper, CamelStream *stream) -{ - CamelMultipart *multipart = CAMEL_MULTIPART (data_wrapper); - CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream); - const gchar *boundary; - gchar *real_boundary_line; - gchar *end_boundary_line; - gboolean end_of_multipart; - CamelMimeBodyPart *body_part; - guint32 part_begining, part_end; - CamelSeekableSubstream *body_part_input_stream; - guint32 saved_stream_pos; - - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMultipart::_set_input_stream\n"); - - /* call parent class implementation */ - parent_class->set_input_stream (data_wrapper, stream); - - 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 */ - end_of_multipart = _localize_part (stream, - real_boundary_line, - end_boundary_line, - &part_end); - 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) { - /* determine the position of the begining of the part */ - part_begining = camel_seekable_stream_get_current_position (seekable_stream); - - CAMEL_LOG_FULL_DEBUG ("CamelMultipart::set_input_stream, detected a new part\n"); - body_part = camel_mime_body_part_new (); - - end_of_multipart = _localize_part (stream, - real_boundary_line, - end_boundary_line, - &part_end); - body_part_input_stream = - camel_seekable_substream_new_with_seekable_stream_and_bounds (seekable_stream, - part_begining, - part_end); - CAMEL_LOG_FULL_DEBUG ("CamelMultipart::set_input_stream, use a substream,\n" - "\tbegining = %d\n" - "\tend = %d\n",part_begining, part_end); - - /* the seekable substream may change the position of the stream - so we must save it before calling set_input_stream */ - saved_stream_pos = camel_seekable_stream_get_current_position (seekable_stream); - - camel_data_wrapper_set_input_stream (CAMEL_DATA_WRAPPER (body_part), - CAMEL_STREAM (body_part_input_stream)); - CAMEL_LOG_FULL_DEBUG ("CamelMultipart::set_input_stream," - "new body part has input stream : %p\n", body_part_input_stream); - - /* restore the stream position */ - camel_seekable_stream_seek (seekable_stream, saved_stream_pos, CAMEL_STREAM_SET); - - /* add the body part to the multipart object */ - camel_multipart_add_part (multipart, body_part); - - } - - /* g_string_assign (new_part, ""); */ - /* _localize_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::_set_input_stream\n"); -} diff --git a/camel/camel-multipart.h b/camel/camel-multipart.h deleted file mode 100644 index 25ef42e4a0..0000000000 --- a/camel/camel-multipart.h +++ /dev/null @@ -1,113 +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 - * - * 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 }*/ - -#include -#include "camel-types.h" -#include "camel-data-wrapper.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); -void camel_multipart_add_part (CamelMultipart *multipart, - CamelMimeBodyPart *part); -void camel_multipart_add_part_at (CamelMultipart *multipart, - CamelMimeBodyPart *part, - guint index); -void camel_multipart_remove_part (CamelMultipart *multipart, - CamelMimeBodyPart *part); -CamelMimeBodyPart * camel_multipart_remove_part_at (CamelMultipart *multipart, - guint index); -CamelMimeBodyPart * camel_multipart_get_part (CamelMultipart *multipart, - guint index); -guint camel_multipart_get_number (CamelMultipart *multipart); -void camel_multipart_set_parent (CamelMultipart *multipart, - CamelMimePart *parent); -CamelMimePart * camel_multipart_get_parent (CamelMultipart *multipart); -void camel_multipart_set_boundary (CamelMultipart *multipart, - gchar *boundary); -const gchar * camel_multipart_get_boundary (CamelMultipart *multipart); - - - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_MULTIPART_H */ - diff --git a/camel/camel-op-queue.c b/camel/camel-op-queue.c deleted file mode 100644 index dc9996ef38..0000000000 --- a/camel/camel-op-queue.c +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Bertrand Guiheneuf - * - * 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 -#include "camel-log.h" -#include "camel-op-queue.h" - -static GStaticMutex op_queue_mutex = G_STATIC_MUTEX_INIT; - - - -/** - * camel_op_queue_new: create a new operation queue - * - * Create a new operation queue. - * - * Return value: the newly allcated object - **/ -CamelOpQueue * -camel_op_queue_new () -{ - CamelOpQueue *op_queue; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::new\n"); - - op_queue = g_new (CamelOpQueue, 1); - op_queue->ops_tail = NULL; - op_queue->ops_head = NULL; - op_queue->service_available = TRUE; - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::new\n"); - return op_queue; -} - - -void -camel_op_queue_free (CamelOpQueue *op_queue) -{ - CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::free\n"); - g_list_free (op_queue->ops_head); - g_free (op_queue); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::free\n"); -} - -/** - * camel_op_queue_push_op: Add an operation to the queue - * @queue: queue object - * @op: operation to add - * - * Add an operation to an operation queue. - * The queue is a FIFO queue. - **/ -void -camel_op_queue_push_op (CamelOpQueue *queue, CamelOp *op) -{ - GList *new_op; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::push_op\n"); - g_assert (queue); - g_static_mutex_lock (&op_queue_mutex); - if (!queue->ops_tail) { - CAMEL_LOG_FULL_DEBUG ("CamelOpQueue::push_op queue does not exists yet. " - "Creating it\n"); - queue->ops_head = g_list_prepend (NULL, op); - queue->ops_tail = queue->ops_head; - } else - queue->ops_head = g_list_prepend (queue->ops_head, op); - g_static_mutex_unlock (&op_queue_mutex); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::push_op\n"); -} - - -/** - * camel_op_queue_pop_op: Pop the next operation pending in the queue - * @queue: queue object - * - * Pop the next operation pending in the queue. - * - * Return value: - **/ -CamelOp * -camel_op_queue_pop_op (CamelOpQueue *queue) -{ - GList *op_list; - CamelOp *op; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::pop_op\n"); - g_assert (queue); - - g_static_mutex_lock (&op_queue_mutex); - op_list = queue->ops_tail; - if (!op_list) return NULL; - - queue->ops_tail = queue->ops_tail->prev; - op = (CamelOp *)op_list->data; - g_static_mutex_unlock (&op_queue_mutex); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::pop_op\n"); - return op; -} - - -/** - * camel_op_queue_run_next_op: run the next pending operation - * @queue: queue object - * - * Run the next pending operation in the queue. - * - * Return value: TRUE if an operation was launched FALSE if there was no operation pending in the queue. - **/ -gboolean -camel_op_queue_run_next_op (CamelOpQueue *queue) -{ - CamelOp *op; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::run_next_op\n"); - op = camel_op_queue_pop_op (queue); - if (!op) return FALSE; - - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::run_next_op\n"); - return FALSE; -} - -/** - * camel_op_queue_set_service_availability: set the service availability for an operation queue - * @queue: queue object - * @available: availability flag - * - * set the service availability - **/ -void -camel_op_queue_set_service_availability (CamelOpQueue *queue, gboolean available) -{ - CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::set_service_availability\n"); - g_static_mutex_lock (&op_queue_mutex); - queue->service_available = available; - g_static_mutex_unlock (&op_queue_mutex); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::set_service_availability\n"); -} - -/** - * camel_op_queue_get_service_availability: determine if an operation queue service is available - * @queue: queue object - * - * Determine if the service associated to an operation queue is available. - * - * Return value: service availability. - **/ -gboolean -camel_op_queue_get_service_availability (CamelOpQueue *queue) -{ - gboolean available; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelOpQueue::get_service_availability\n"); - g_static_mutex_lock (&op_queue_mutex); - available = queue->service_available; - g_static_mutex_unlock (&op_queue_mutex); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelOpQueue::get_service_availability\n"); - return available; -} - diff --git a/camel/camel-op-queue.h b/camel/camel-op-queue.h deleted file mode 100644 index 2bceceb4c8..0000000000 --- a/camel/camel-op-queue.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Bertrand Guiheneuf - * - * 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 -#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 0cff8564a1..0000000000 --- a/camel/camel-provider.c +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-provider.c : provider framework */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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) { - printf ("g_module_open reports: %s\n", g_module_error ()); - CAMEL_LOG_WARNING ("CamelProvider::register_as_module Unable to load module %s\n", module_path); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n"); - return NULL; - } - - has_module_init = g_module_symbol (new_module, "camel_provider_module_init", (gpointer *)&camel_provider_module_init); - if (!has_module_init){ - CAMEL_LOG_WARNING ("CamelProvider::register_as_module loading of module %s failed,\n" - "\t Symbol camel_provider_module_init not defined in it\n", module_path); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n"); - return NULL; - } - - new_provider = camel_provider_module_init(); - new_provider->gmodule = new_module; - camel_provider_register (new_provider); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelProvider::register_as_module\n"); - return new_provider; - - -} - - - - -/* - be careful to this function, @a is expected to be - a provider, @b a protocol name (const gchar *) -*/ -static gint -_provider_protocol_find (gconstpointer a, gconstpointer b) -{ - CamelProvider *provider_a = CAMEL_PROVIDER (a); - const gchar *name_b = (const gchar *)b; - - return g_strcasecmp ( provider_a->name, name_b); -} - -/** - * camel_provider_get_for_protocol: get a registered provider for a protocol - * @protocol: protocol name (case insensitive) - * @type: provider type (transport, store, ...) - * - * Look into the list of registered provider if - * one correspond both to the protocol name - * and to the protocol type. When several providers - * exist for a same protocol, the last registered - * is returned. - * - * Return value: Matching provider or NULL if none exists. - **/ -const CamelProvider * -camel_provider_get_for_protocol (const gchar *protocol, ProviderType type) -{ - CamelProvider *current_provider = NULL; - GList *current_provider_node; - gboolean protocol_is_found; - gboolean provider_is_found; - - g_assert (protocol); - g_return_val_if_fail (_provider_list, NULL); - - current_provider_node = _provider_list; - provider_is_found = FALSE; - - while ((!provider_is_found) && current_provider_node) { - current_provider = (CamelProvider *)current_provider_node->data; - - protocol_is_found = (g_strcasecmp (protocol, current_provider->protocol) == 0); - if (protocol_is_found) - provider_is_found = (current_provider->provider_type == type); - - current_provider_node = current_provider_node->next; - } - - if (provider_is_found) return current_provider; - else return NULL; -} diff --git a/camel/camel-provider.h b/camel/camel-provider.h deleted file mode 100644 index 95df289c3b..0000000000 --- a/camel/camel-provider.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-provider.h : provider definition */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include - -#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 7b42cdc9a0..0000000000 --- a/camel/camel-recipient.c +++ /dev/null @@ -1,279 +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 - * - * 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 *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), recipient_list); - -} - - - - -/** - * camel_recipient_table_remove: Remove a recipient from a recipient table. - * @recipient_table: The recipient table object - * @recipient_type: Recipient type string. - * @recipient: Recipient to remove from the table - * - * Remove a recipient from a recipient table. The recipient is - * only removed from the recipient list corresponding to - * @recipient_type. The removed recipient is freed. - * - **/ -void -camel_recipient_table_remove (CamelRecipientTable *recipient_table, - const gchar *recipient_type, - const gchar *recipient) -{ - GList *recipients_list; - GList *new_recipients_list; - GList *old_element; - gchar *old_recipient_type; - - /* if the recipient type section does not exist, do nothing */ - if (! g_hash_table_lookup_extended (recipient_table->recipient_hash_table, - recipient_type, - (gpointer)&(old_recipient_type), - (gpointer)&(recipients_list)) - ) return; - - /* look for the recipient to remove */ - /* g_list_find_custom , use gpointer instead of gconstpointer */ - old_element = g_list_find_custom (recipients_list, (gpointer)recipient, g_strcase_equal); - if (old_element) { - /* if recipient exists, remove it */ - new_recipients_list = g_list_remove_link (recipients_list, old_element); - - /* if glist head has changed, fix up hash table */ - if (new_recipients_list != recipients_list) - g_hash_table_insert (recipient_table->recipient_hash_table, old_recipient_type, new_recipients_list); - - g_free( (gchar *)(old_element->data)); - g_list_free_1 (old_element); - } -} - - - -/** - * camel_recipient_table_get: Get the recipients corresponding to a recipient type. - * @recipient_table: The recipient table object - * @recipient_type: Recipient type string. - * - * Return the list of recipients corresponding to - * @recipient_type. The returned list is not a copy - * of the internal list used by the recipient table object - * but the list itself. It thus must not be freed. - * The recipients it contains can be modified. - * - * Return value: The list of recipients. - **/ -const GList * -camel_recipient_table_get (CamelRecipientTable *recipient_table, - const gchar *recipient_type) -{ - return (const GList *)g_hash_table_lookup (recipient_table->recipient_hash_table, recipient_type); -} - - - - -/** - * camel_recipient_foreach_recipient_type: Runs a function over over all recipients type lists. - * @recipient_table: The recipient table object. - * @func: The function to run. - * @user_data: User data to pass to the function. - * - * Runs a function over over all recipients type lists. - **/ -void -camel_recipient_foreach_recipient_type (CamelRecipientTable *recipient_table, - CRLFunc func, - gpointer user_data) -{ - g_hash_table_foreach (recipient_table->recipient_hash_table, (GHFunc)func, user_data); -} diff --git a/camel/camel-recipient.h b/camel/camel-recipient.h deleted file mode 100644 index e59171add8..0000000000 --- a/camel/camel-recipient.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-recipient.h : handle recipients (addresses) and recipiemt lists */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 - - - -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-seekable-stream.c b/camel/camel-seekable-stream.c deleted file mode 100644 index 1afb02d442..0000000000 --- a/camel/camel-seekable-stream.c +++ /dev/null @@ -1,149 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include "camel-seekable-stream.h" -#include "camel-log.h" - -static CamelStreamClass *parent_class=NULL; - - -/* Returns the class for a CamelSeekableStream */ -#define CSS_CLASS(so) CAMEL_SEEKABLE_STREAM_CLASS (GTK_OBJECT(so)->klass) - -static gint _seek (CamelSeekableStream *stream, - gint offset, - CamelStreamSeekPolicy policy); -static void _reset (CamelStream *stream); - - -static void -camel_seekable_stream_class_init (CamelSeekableStreamClass *camel_seekable_stream_class) -{ - CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_seekable_stream_class); - - parent_class = gtk_type_class (camel_stream_get_type ()); - - /* seekable stream methods */ - camel_seekable_stream_class->seek = _seek; - - /* camel stream methods overload */ - camel_stream_class->reset = _reset; -} - -GtkType -camel_seekable_stream_get_type (void) -{ - static GtkType camel_seekable_stream_type = 0; - - if (!camel_seekable_stream_type) { - GtkTypeInfo camel_seekable_stream_info = - { - "CamelSeekableStream", - sizeof (CamelSeekableStream), - sizeof (CamelSeekableStreamClass), - (GtkClassInitFunc) camel_seekable_stream_class_init, - (GtkObjectInitFunc) NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_seekable_stream_type = gtk_type_unique (camel_stream_get_type (), &camel_seekable_stream_info); - } - - return camel_seekable_stream_type; -} - - - - -static gint -_seek (CamelSeekableStream *stream, - gint offset, - CamelStreamSeekPolicy policy) -{ - g_warning ("CamelSeekableStream::seek called on default implementation \n"); - return -1; -} - - - -/** - * 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_seekable_stream_seek (CamelSeekableStream *stream, - gint offset, - CamelStreamSeekPolicy policy) -{ - return CSS_CLASS (stream)->seek (stream, offset, policy); -} - - - - -/** - * camel_seekable_stream_get_current_position: get the position of a stream - * @stream: seekable stream object - * - * Get the current position of a seekable stream. - * - * Return value: the position. - **/ -guint32 -camel_seekable_stream_get_current_position (CamelSeekableStream *stream) -{ - return stream->cur_pos; -} - - - -/* a default implementation of reset for seekable streams */ -static void -_reset (CamelStream *stream) -{ - CamelSeekableStream *seekable_stream; - - g_assert (stream); - seekable_stream = CAMEL_SEEKABLE_STREAM (stream); - - camel_seekable_stream_seek (seekable_stream, 0, CAMEL_STREAM_SET); -} - - - - - - diff --git a/camel/camel-seekable-stream.h b/camel/camel-seekable-stream.h deleted file mode 100644 index 4b630f7a5c..0000000000 --- a/camel/camel-seekable-stream.h +++ /dev/null @@ -1,92 +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 - * - * 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_SEEKABLE_STREAM_H -#define CAMEL_SEEKABLE_STREAM_H 1 - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#include -#include "camel-types.h" -#include "camel-stream.h" - -#define CAMEL_SEEKABLE_STREAM_TYPE (camel_seekable_stream_get_type ()) -#define CAMEL_SEEKABLE_STREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStream)) -#define CAMEL_SEEKABLE_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_STREAM_TYPE, CamelSeekableStreamClass)) -#define CAMEL_IS_SEEKABLE_STREAM(o) (GTK_CHECK_TYPE((o), CAMEL_SEEKABLE_STREAM_TYPE)) - - -typedef enum -{ - CAMEL_STREAM_SET, - CAMEL_STREAM_CUR, - CAMEL_STREAM_END - -} CamelStreamSeekPolicy; - - -struct _CamelSeekableStream -{ - CamelStream parent_object; - - guint32 cur_pos; /* current postion in the stream */ - -}; - - - -typedef struct { - CamelStreamClass parent_class; - - /* Virtual methods */ - gint (*seek) (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy); - - -} CamelSeekableStreamClass; - - - -/* Standard Gtk function */ -GtkType camel_seekable_stream_get_type (void); - - -/* public methods */ -gint camel_seekable_stream_seek (CamelSeekableStream *stream, - gint offset, - CamelStreamSeekPolicy policy); -guint32 camel_seekable_stream_get_current_position (CamelSeekableStream *stream); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_SEEKABLE_STREAM_H */ diff --git a/camel/camel-seekable-substream.c b/camel/camel-seekable-substream.c deleted file mode 100644 index 5e7bb72d21..0000000000 --- a/camel/camel-seekable-substream.c +++ /dev/null @@ -1,486 +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 - * - * 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 -#include "camel-seekable-substream.h" -#include "camel-log.h" - -static CamelSeekableStreamClass *parent_class=NULL; - - -/* Returns the class for a CamelSeekableSubStream */ -#define CSS_CLASS(so) CAMEL_SEEKABLE_SUBSTREAM_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 (CamelSeekableStream *stream, - gint offset, - CamelStreamSeekPolicy policy); - -static void _finalize (GtkObject *object); -static void _destroy (GtkObject *object); - -static void _init_with_seekable_stream_and_bounds (CamelSeekableSubstream *seekable_substream, - CamelSeekableStream *parent_stream, - guint32 inf_bound, - gint64 sup_bound); - - - - -static void -camel_seekable_substream_class_init (CamelSeekableSubstreamClass *camel_seekable_substream_class) -{ - CamelSeekableStreamClass *camel_seekable_stream_class = CAMEL_SEEKABLE_STREAM_CLASS (camel_seekable_substream_class); - CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_seekable_substream_class); - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_seekable_substream_class); - - parent_class = gtk_type_class (camel_seekable_stream_get_type ()); - - /* virtual method definition */ - camel_seekable_substream_class->init_with_seekable_stream_and_bounds = _init_with_seekable_stream_and_bounds; - - /* 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_seekable_stream_class->seek = _seek; - - gtk_object_class->finalize = _finalize; - gtk_object_class->destroy = _destroy; - -} - -static void -camel_seekable_substream_init (gpointer object, gpointer klass) -{ - /* does nothing */ -} - - - - -GtkType -camel_seekable_substream_get_type (void) -{ - static GtkType camel_seekable_substream_type = 0; - - if (!camel_seekable_substream_type) { - GtkTypeInfo camel_seekable_substream_info = - { - "CamelSeekableSubstream", - sizeof (CamelSeekableSubstream), - sizeof (CamelSeekableSubstreamClass), - (GtkClassInitFunc) camel_seekable_substream_class_init, - (GtkObjectInitFunc) camel_seekable_substream_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_seekable_substream_type = gtk_type_unique (camel_seekable_stream_get_type (), &camel_seekable_substream_info); - } - - return camel_seekable_substream_type; -} - - - - - - -static void -_destroy (GtkObject *object) -{ - - CAMEL_LOG_FULL_DEBUG ("Entering CamelSeekableSubstream::destroy\n"); - - /* does nothing for the moment */ - GTK_OBJECT_CLASS (parent_class)->destroy (object); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelSeekableSubstream::destroy\n"); -} - - -static void -_finalize (GtkObject *object) -{ - CamelSeekableStream *seekable_stream; - CamelSeekableSubstream *seekable_substream; - CAMEL_LOG_FULL_DEBUG ("Entering CamelSeekableSubstream::finalize\n"); - - seekable_stream = CAMEL_SEEKABLE_STREAM (object); - seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (object); - - if (seekable_substream->parent_stream) - gtk_object_unref (GTK_OBJECT (seekable_substream->parent_stream)); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelSeekableSubstream::finalize\n"); -} - - - -static void -_set_bounds (CamelSeekableSubstream *seekable_substream, guint32 inf_bound, gint64 sup_bound) -{ - CAMEL_LOG_FULL_DEBUG ("CamelSeekableSubstream::_set_bounds entering\n"); - - g_assert (seekable_substream); - g_assert (seekable_substream->parent_stream); - - /* store the bounds */ - seekable_substream->inf_bound = inf_bound; - seekable_substream->sup_bound = sup_bound; - - - seekable_substream->cur_pos = 0; - - CAMEL_LOG_FULL_DEBUG ("In CamelSeekableSubstream::_set_bounds, " - "setting inf bound to %lu, " - "sup bound to %lld, current position to %lu from %lu\n", - seekable_substream->inf_bound, seekable_substream->sup_bound, - seekable_substream->cur_pos, inf_bound); - - CAMEL_LOG_FULL_DEBUG ("CamelSeekableSubstream::_set_bounds Leaving\n"); -} - -static void -_reemit_parent_signal (CamelStream *parent_stream, gpointer user_data) -{ - CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (user_data); - - gtk_signal_emit_by_name (GTK_OBJECT (seekable_substream), "data_available"); - -} - - -static void -_init_with_seekable_stream_and_bounds (CamelSeekableSubstream *seekable_substream, - CamelSeekableStream *parent_stream, - guint32 inf_bound, - gint64 sup_bound) -{ - /* sanity checks */ - g_assert (seekable_substream); - g_assert (!seekable_substream->parent_stream); - g_assert (parent_stream); - - /* store the parent stream */ - seekable_substream->parent_stream = parent_stream; - gtk_object_ref (GTK_OBJECT (parent_stream)); - - /* set the bound of the substream */ - _set_bounds (seekable_substream, inf_bound, sup_bound); - - /* - * connect to the parent stream "data_available" - * stream so that we can reemit the signal on the - * seekable substream in case some data would - * be available for us - */ - gtk_signal_connect (GTK_OBJECT (parent_stream), - "data_available", - _reemit_parent_signal, - seekable_substream); - - gtk_signal_emit_by_name (GTK_OBJECT (seekable_substream), "data_available"); - -} - - - -CamelSeekableSubstream * -camel_seekable_substream_new_with_seekable_stream_and_bounds (CamelSeekableStream *parent_stream, - guint32 inf_bound, - gint64 sup_bound) -{ - CamelSeekableSubstream *seekable_substream; - - /* create the seekable substream */ - seekable_substream = gtk_type_new (camel_seekable_substream_get_type ()); - - /* initialize it */ - CSS_CLASS (seekable_substream)->init_with_seekable_stream_and_bounds (seekable_substream, - parent_stream, - inf_bound, - sup_bound); - return seekable_substream; -} - - - - - -/** - * _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) -{ - CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream); - CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream); - gint v; - gint nb_to_read; - guint32 parent_stream_current_position; - guint32 position_in_parent; - - g_assert (stream); - g_assert (seekable_substream->parent_stream); - - - - /* - we are doing something quite infefficient : - - each time we want to read a block, we store - the parent stream position so that we can - change it, and restore it before returning - - This may change. I don't know yet. - It may be useless to reseek every time - and is incompatible with buffering. - */ - - parent_stream_current_position = - camel_seekable_stream_get_current_position (seekable_substream->parent_stream); - - /* compute the position in the parent stream */ - position_in_parent = - seekable_stream->cur_pos + seekable_substream->inf_bound; - - /* go to our position in the parent stream */ - if (parent_stream_current_position != position_in_parent) - camel_seekable_stream_seek (seekable_substream->parent_stream, - position_in_parent, - CAMEL_STREAM_SET); - - - - /* compute how much byte should be read */ - if (seekable_substream->sup_bound != -1) - nb_to_read = - MIN (seekable_substream->sup_bound - position_in_parent, n); - else - nb_to_read = n; - - - /* Read the data */ - if (nb_to_read >0 ) - v = camel_stream_read ( CAMEL_STREAM (seekable_substream->parent_stream), - buffer, - nb_to_read); - else - v = 0; - - /* if the return value is negative, an error occured, - we must do something FIXME : handle exception */ - if (v<0) - CAMEL_LOG_FULL_DEBUG ("CamelSeekableSubstream::read v=%d\n", v); - else - seekable_stream->cur_pos += v; - - - - /* return the number of bytes read */ - return v; -} - - -/** - * _write: write 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) -{ - /* NOT VALID ON SEEKABLE SUBSTREAM */ - g_warning ("CamelSeekableSubstream:: seekable substream don't have a write method\n"); - CAMEL_LOG_WARNING ( "CamelSeekableSubstream:: seekable substream don't have a write method\n"); - return -1; -} - - - -/** - * _flush: flush pending changes - * @stream: the stream - * - * - **/ -static void -_flush (CamelStream *stream) -{ - /* NOT VALID ON SEEKABLE SUBSTREAM */ - g_warning ("CamelSeekableSubstream:: seekable substream don't have a flush method\n"); - CAMEL_LOG_WARNING ( "CamelSeekableSubstream:: seekable substream don't have a flush method\n"); -} - - - -/** - * _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\n"); - 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) -{ - CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream); - CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream); - guint32 substream_len; - gboolean eos; - - g_assert (stream); - - if (seekable_substream->sup_bound != -1) { - substream_len = seekable_substream->sup_bound - seekable_substream->inf_bound; - eos = ( seekable_stream->cur_pos >= substream_len); - } else { - eos = camel_stream_eos (CAMEL_STREAM (seekable_substream->parent_stream)); - } - - return eos; -} - - -/** - * _close: close a stream - * @stream: the stream - * - * - **/ -static void -_close (CamelStream *stream) -{ - CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream); - - g_assert (stream); - seekable_substream->open = FALSE; -} - - -static gint -_seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) -{ - CamelSeekableSubstream *seekable_substream = CAMEL_SEEKABLE_SUBSTREAM (stream); - CamelSeekableStream *seekable_stream = CAMEL_SEEKABLE_STREAM (stream); - gint64 real_offset = 0; - guint32 substream_len; - guint32 parent_pos; - gboolean seek_done = FALSE; - - substream_len = seekable_substream->sup_bound - seekable_substream->inf_bound; - - switch (policy) { - - case CAMEL_STREAM_SET: - real_offset = offset; - - break; - - case CAMEL_STREAM_CUR: - real_offset = seekable_stream->cur_pos + offset; - - break; - - case CAMEL_STREAM_END: - if (seekable_substream->sup_bound != -1) - real_offset = substream_len - offset; - else { - parent_pos = camel_seekable_stream_seek (seekable_substream->parent_stream, - offset, - CAMEL_STREAM_END); - seekable_stream->cur_pos = parent_pos - seekable_substream->inf_bound; - seek_done = TRUE; - } - - break; - - default: - return -1; - } - - if (!seek_done) { - if (real_offset > 0) { - seekable_stream->cur_pos = MIN (real_offset, substream_len); - } else - seekable_stream->cur_pos = 0; - printf ("** set in substream %p, offset=%lld\n", stream, real_offset); - } - - - return seekable_stream->cur_pos; -} - - diff --git a/camel/camel-seekable-substream.h b/camel/camel-seekable-substream.h deleted file mode 100644 index d3a177f915..0000000000 --- a/camel/camel-seekable-substream.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-seekable-substream.h : stream */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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_SEEKABLE_SUBSTREAM_H -#define CAMEL_SEEKABLE_SUBSTREAM_H 1 - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#include -#include "camel-types.h" -#include "camel-seekable-stream.h" - - -#define CAMEL_SEEKABLE_SUBSTREAM_TYPE (camel_seekable_substream_get_type ()) -#define CAMEL_SEEKABLE_SUBSTREAM(obj) (GTK_CHECK_CAST((obj), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstream)) -#define CAMEL_SEEKABLE_SUBSTREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SEEKABLE_SUBSTREAM_TYPE, CamelSeekableSubstreamClass)) -#define CAMEL_IS_SEEKABLE_SUBSTREAM(o) (GTK_CHECK_TYPE((o), CAMEL_SEEKABLE_SUBSTREAM_TYPE)) - - - - -struct _CamelSeekableSubstream -{ - CamelSeekableStream parent_object; - - /* --**-- Private fields --**-- */ - CamelSeekableStream *parent_stream; /* the stream this substream uses */ - guint32 cur_pos; /* current postion in the stream */ - guint32 inf_bound; /* first valid position */ - gint64 sup_bound; /* first invalid position */ - gboolean open; - -}; - - - -typedef struct { - CamelSeekableStreamClass parent_class; - - /* Virtual methods */ - void (*init_with_seekable_stream_and_bounds) (CamelSeekableSubstream *seekable_substream, - CamelSeekableStream *parent_stream, - guint32 inf_bound, - gint64 sup_bound); - -} CamelSeekableSubstreamClass; - - - -/* Standard Gtk function */ -GtkType camel_seekable_substream_get_type (void); - - -/* public methods */ - -/* obtain a new seekable substream */ -CamelSeekableSubstream * -camel_seekable_substream_new_with_seekable_stream_and_bounds (CamelSeekableStream *parent_stream, - guint32 inf_bound, - gint64 sup_bound); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_SEEKABLE_SUBSTREAM_H */ diff --git a/camel/camel-service.c b/camel/camel-service.c deleted file mode 100644 index 0bd2b42d01..0000000000 --- a/camel/camel-service.c +++ /dev/null @@ -1,365 +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 - * - * 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 -#include "camel-service.h" -#include "camel-log.h" -#include "camel-exception.h" - -static GtkObjectClass *parent_class=NULL; - -/* Returns the class for a CamelService */ -#define CSERV_CLASS(so) CAMEL_SERVICE_CLASS (GTK_OBJECT(so)->klass) - -static gboolean _connect(CamelService *service, CamelException *ex); -static gboolean _connect_with_url (CamelService *service, Gurl *url, - CamelException *ex); -static gboolean _disconnect(CamelService *service, CamelException *ex); -static gboolean _is_connected (CamelService *service); -static void _finalize (GtkObject *object); -static gboolean _set_url (CamelService *service, Gurl *url, - CamelException *ex); - -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_with_url = _connect_with_url; - camel_service_class->disconnect = _disconnect; - camel_service_class->is_connected = _is_connected; - - /* 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"); - - if (camel_service->url) - g_url_free (camel_service->url); - if (camel_service->session) - gtk_object_unref (GTK_OBJECT (camel_service->session)); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelService::finalize\n"); -} - - -/** - * camel_service_new: create a new CamelService or subtype - * @type: the GtkType of the class to create - * @session: the session for the service - * @url: the default URL for the service (may be NULL) - * @ex: a CamelException - * - * Creates a new CamelService (or one of its subtypes), initialized - * with the given parameters. - * - * Return value: the CamelService, or NULL. - **/ -CamelService * -camel_service_new (GtkType type, CamelSession *session, Gurl *url, - CamelException *ex) -{ - CamelService *service; - - g_assert(session); - - service = CAMEL_SERVICE (gtk_object_new (type, NULL)); - service->session = session; - gtk_object_ref (GTK_OBJECT (session)); - if (url) { - if (!_set_url (service, url, ex)) - return NULL; - } - - return service; -} - -/** - * _connect : connect to a service - * @service: object to connect - * @ex: a CamelException - * - * connect to the service using the parameters - * stored in the session it is initialized with - * - * Return value: whether or not the connection succeeded - **/ -static gboolean -_connect (CamelService *service, CamelException *ex) -{ - g_assert (service->session); - /* XXX it's possible that this should be an exception - * rather than an assertion... I'm not sure how the code - * is supposed to be used. - */ - g_assert (service->url); - - service->connected = TRUE; - return TRUE; -} - - - -/** - * camel_service_connect:connect to a service - * @service: CamelService object - * @ex: a CamelException - * - * connect to the service using the parameters - * stored in the session it is initialized with - * - * Return value: whether or not the connection succeeded - **/ -gboolean -camel_service_connect (CamelService *service, CamelException *ex) -{ - return CSERV_CLASS(service)->connect(service, ex); -} - - - -/** - * _connect_with_url: connect to the specified address - * @service: object to connect - * @url: URL describing service to connect to - * @ex: a CamelException - * - * Connect to the service, but do not use the session - * default parameters to retrieve server's address - * - * Return value: whether or not the connection succeeded - **/ -static gboolean -_connect_with_url (CamelService *service, Gurl *url, CamelException *ex) -{ - g_assert (service->session); - - if (!_set_url (service, url, ex)) - return FALSE; - - return CSERV_CLASS(service)->connect (service, ex); -} - -/** - * camel_service_connect_with_url: connect a service - * @service: the service to connect - * @url: URL describing the service to connect to - * @ex: a CamelException - * - * Connect to a service, but do not use the session - * default parameters to retrieve server's address - * - * Return value: whether or not the connection succeeded - **/ -gboolean -camel_service_connect_with_url (CamelService *service, char *url, - CamelException *ex) -{ - return CSERV_CLASS(service)->connect_with_url (service, g_url_new(url), - ex); -} - - - -/** - * _disconnect : disconnect from a service - * @service: object to disconnect - * @ex: a CamelException - * - * disconnect from the service - * - * Return value: whether or not the disconnection succeeded without - * errors. (Consult @ex if FALSE.) - **/ -static gboolean -_disconnect (CamelService *service, CamelException *ex) -{ - service->connected = FALSE; - - return TRUE; -} - - - -/** - * camel_service_disconnect: disconnect from a service - * @service: CamelService object - * @ex: a CamelException - * - * disconnect from the service - * - * Return value: whether or not the disconnection succeeded without - * errors. (Consult @ex if FALSE.) - **/ -gboolean -camel_service_disconnect (CamelService *service, CamelException *ex) -{ - return CSERV_CLASS(service)->disconnect(service, ex); -} - - - -/** - * _is_connected: test if the service object is connected - * @service: object to test - * - * Return value: whether or not the service is connected - **/ -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: whether or not the service is connected - **/ -gboolean -camel_service_is_connected (CamelService *service) -{ - return CSERV_CLASS(service)->is_connected(service); -} - - -/** - * _set_url: Validate a URL and set it as the default for a service - * @service: the CamelService - * @url_string: the URL - * @ex: a CamelException - * - * This converts the URL to a Gurl, validates it for the service, - * and sets it as the default URL for the service. - * - * Return value: success or failure - **/ -static gboolean -_set_url (CamelService *service, Gurl *url, CamelException *ex) -{ - char *url_string; - - if (service->url_flags & CAMEL_SERVICE_URL_NEED_USER && - (url->user == NULL || url->user[0] == '\0')) { - url_string = g_url_to_string (url, FALSE); - camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID, - "URL '%s' needs a username component", - url_string); - g_free (url_string); - return FALSE; - } else if (service->url_flags & CAMEL_SERVICE_URL_NEED_HOST && - (url->host == NULL || url->host[0] == '\0')) { - url_string = g_url_to_string (url, FALSE); - camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID, - "URL '%s' needs a host component", - url_string); - g_free (url_string); - return FALSE; - } else if (service->url_flags & CAMEL_SERVICE_URL_NEED_PATH && - (url->path == NULL || url->path[0] == '\0')) { - url_string = g_url_to_string (url, FALSE); - camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID, - "URL '%s' needs a path component", - url_string); - g_free (url_string); - return FALSE; - } - - if (service->url) - g_url_free (service->url); - service->url = url; - return TRUE; -} - -/** - * camel_service_get_url: get the url representing a service - * @service: the service - * - * returns the URL representing a service. The returned URL must be - * freed when it is no longer needed. For security reasons, this - * routine does not return the password. - * - * Return value: the url name - **/ -char * -camel_service_get_url (CamelService *service) -{ - return g_url_to_string(service->url, FALSE); -} - - -/** - * camel_service_get_session: return the session associated with a service - * @service: the service - * - * returns the CamelSession associated with the service. - * - * Return value: the session - **/ -CamelSession * -camel_service_get_session (CamelService *service) -{ - return service->session; -} diff --git a/camel/camel-service.h b/camel/camel-service.h deleted file mode 100644 index b6d7b70c94..0000000000 --- a/camel/camel-service.h +++ /dev/null @@ -1,101 +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 - * - * 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 -#include "camel-types.h" -#include "url-util.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)) - - - -struct _CamelService { - GtkObject parent_object; - - CamelSession *session; - gboolean connected; - Gurl *url; - int url_flags; - -}; - - - -typedef struct { - GtkObjectClass parent_class; - - gboolean (*connect) (CamelService *service, CamelException *ex); - gboolean (*connect_with_url) (CamelService *service, Gurl *url, - CamelException *ex); - gboolean (*disconnect) (CamelService *service, CamelException *ex); - - gboolean (*is_connected) (CamelService *service); - -} CamelServiceClass; - - - -/* flags for url_flags. (others can be added if needed) */ -#define CAMEL_SERVICE_URL_NEED_USER (1 << 1) -#define CAMEL_SERVICE_URL_NEED_HOST (1 << 4) -#define CAMEL_SERVICE_URL_NEED_PATH (1 << 6) - - - -/* public methods */ -CamelService *camel_service_new (GtkType type, CamelSession *session, - Gurl *url, CamelException *ex); - -gboolean camel_service_connect (CamelService *service, CamelException *ex); -gboolean camel_service_connect_with_url (CamelService *service, char *url, - CamelException *ex); -gboolean camel_service_disconnect (CamelService *service, CamelException *ex); -gboolean camel_service_is_connected (CamelService *service); -char *camel_service_get_url (CamelService *service); -CamelSession *camel_service_get_session (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 6b93cc1d3f..0000000000 --- a/camel/camel-session.c +++ /dev/null @@ -1,322 +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 - * - * 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 -#include "camel-session.h" -#include "camel-store.h" -#include "camel-transport.h" -#include "camel-exception.h" -#include "string-utils.h" -#include "url-util.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 (CamelAuthCallback authenticator) -{ - CamelSession *session = gtk_type_new (CAMEL_SESSION_TYPE); - - session->authenticator = authenticator; - return session; -} - -/** - * 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 - * @ex: a CamelException - * - * - * Return value: the newly instantiated store - **/ -CamelStore * -camel_session_get_store_from_provider (CamelSession *session, - CamelProvider *provider, - CamelException *ex) -{ - g_assert(session); - g_assert(provider); - - return CAMEL_STORE (camel_service_new (provider->object_type, - session, NULL, ex)); -} - - - -/** - * get_store_for_protocol_with_url: private helper routine - * @session: CamelSession object - * @protocol: protocol name - * @url: a URL, or NULL - * @ex: a CamelException - * - * Used by camel_session_get_store_for_protocol and - * camel_session_get_store. - * - * Return value: initialized store associated with this protocol, or NULL if no provider was found. - **/ -static CamelStore * -get_store_for_protocol_with_url (CamelSession *session, const char *protocol, - Gurl *url, CamelException *ex) -{ - const CamelProvider *provider = NULL; - - /* See if there is a provider assiciated with 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. See - * if there is a registered provider for this - * protocol. - */ - provider = camel_provider_get_for_protocol (protocol, PROVIDER_STORE); - } - if (!provider) - return NULL; - - return CAMEL_STORE (camel_service_new (provider->object_type, - session, url, ex)); -} - - -/** - * camel_session_get_store_for_protocol: get the store associated to a protocol - * @session: CamelSession object - * @protocol: protocol name - * @ex: a CamelException - * - * Return a CamelStore object associated with 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 returned. - * Otherwise, if one or more providers corresponding - * to this protocol have been registered (See - * camel_provider_register_as_module), the last registered - * one is used. - * - * Return value: store associated with this protocol, or NULL if no provider was found. - **/ -CamelStore * -camel_session_get_store_for_protocol (CamelSession *session, - const char *protocol, - CamelException *ex) -{ - return get_store_for_protocol_with_url (session, protocol, NULL, ex); -} - - - -/** - * camel_session_get_store: get a store object for an URL - * @session: session object - * @url_string: url - * @ex: a CamelException - * - * 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 char *url_string, - CamelException *ex) -{ - Gurl *url; - CamelStore *store; - - url = g_url_new (url_string); - if (url == NULL || url->protocol == NULL) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_URL_INVALID, - "Could not determine protocol for " - "URL '%s'", url_string); - return NULL; - } - - store = get_store_for_protocol_with_url (session, url->protocol, - url, ex); - if (store == NULL) - g_url_free (url); - return store; -} - - - -/** - * camel_session_query_authenticator: query the session authenticator - * @session: session object - * @prompt: prompt to use if authenticator can query the user - * @secret: whether or not the data is secret (eg, a password) - * @service: the service this query is being made by - * @item: an identifier, unique within this service, for the information - * @ex: a CamelException - * - * This function is used by a CamelService to request authentication - * information it needs to complete a connection. If the authenticator - * stores any authentication information in configuration files, it - * should use @service and @item as keys to find the right piece of - * information. If it doesn't store authentication information in config - * files, it should use the given @prompt to ask the user for the - * information. If @secret is set, the user's input should not be - * echoed back. The authenticator should set @ex to - * CAMEL_EXCEPTION_USER_CANCEL if the user did not provide the - * information. The caller must g_free() the information when it is - * done with it. - * - * Return value: the authentication information or NULL. - **/ -char * -camel_session_query_authenticator (CamelSession *session, char *prompt, - gboolean secret, - CamelService *service, char *item, - CamelException *ex) -{ - return session->authenticator (prompt, secret, service, item, ex); -} - - - -/** - * camel_session_get_transport_for_protocol: get the transport for a protocol - * @session: the session - * @protocol: protocol name - * @ex: a CamelException - * - * Return a CamelTransport object associated with a given transport - * protocol. If a provider has been set for this protocol in the - * session @session using camel_session_set_provider (), then a transport - * obtained from this provider is returned. Otherwise, if one or more - * providers corresponding to this protocol have been registered (See - * camel_provider_register_as_module), the last registered one is - * used. - * - * Return value: transport associated with this protocol, or NULL if no provider was found. - **/ -CamelTransport * -camel_session_get_transport_for_protocol (CamelSession *session, - const char *protocol, - CamelException *ex) -{ - const CamelProvider *provider = NULL; - - /* See if there is a provider assiciated with this - * protocol in this session. - */ - provider = CAMEL_PROVIDER (g_hash_table_lookup (session->transport_provider_list, protocol)); - if (!provider) { - /* No provider was found in this session. See - * if there is a registered provider for this - * protocol. - */ - provider = camel_provider_get_for_protocol (protocol, PROVIDER_TRANSPORT); - } - if (!provider) - return NULL; - - return CAMEL_TRANSPORT (gtk_object_new (provider->object_type, NULL)); -} diff --git a/camel/camel-session.h b/camel/camel-session.h deleted file mode 100644 index 838731b03c..0000000000 --- a/camel/camel-session.h +++ /dev/null @@ -1,98 +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 - * - * 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 -#include "camel-types.h" -#include "camel-provider.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)) - - -typedef char *(*CamelAuthCallback) (char *prompt, gboolean secret, - CamelService *service, char *item, - CamelException *ex); - - -struct _CamelSession -{ - GtkObject parent_object; - - CamelAuthCallback authenticator; - 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 (CamelAuthCallback authenticator); -void camel_session_set_provider (CamelSession *session, CamelProvider *provider); -CamelStore *camel_session_get_store_for_protocol (CamelSession *session, - const gchar *protocol, - CamelException *ex); -CamelStore *camel_session_get_store (CamelSession *session, - const char *url_string, - CamelException *ex); -CamelTransport *camel_session_get_transport_for_protocol (CamelSession *session, - const char *protocol, - CamelException *ex); -char *camel_session_query_authenticator (CamelSession *session, char *prompt, - gboolean secret, - CamelService *service, char *item, - CamelException *ex); - -#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 0b1fd3f396..0000000000 --- a/camel/camel-simple-data-wrapper-stream.c +++ /dev/null @@ -1,299 +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 -#endif - -#include "camel-simple-data-wrapper-stream.h" -#include "camel-simple-data-wrapper.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, wrapper_stream->current_position + 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 (CamelSeekableStream *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 - offset; - break; - default: - g_warning ("Unknown CamelStreamSeekPolicy %d.", policy); - return -1; - } - - if (new_position<0) - new_position = 0; - else if (new_position>=wrapper_stream->wrapper->byte_array->len) - new_position = wrapper_stream->wrapper->byte_array->len-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; - CamelStreamClass *stream_class; - CamelSeekableStreamClass *seek_class; - - object_class = (GtkObjectClass*) klass; - stream_class = (CamelStreamClass *)klass; - seek_class = (CamelSeekableStreamClass *)klass; - - stream_class->read = read; - stream_class->write = write; - stream_class->flush = flush; - stream_class->available = available; - stream_class->eos = eos; - stream_class->close = close; - - seek_class->seek = seek; - - object_class->destroy = destroy; - - 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; -#if 0 - gtk_signal_connect (GTK_OBJECT (wrapper), "destroy", - wrapper_destroy_cb, stream); -#endif -} - -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 23ba42df3e..0000000000 --- a/camel/camel-simple-data-wrapper-stream.h +++ /dev/null @@ -1,69 +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__ - -#include -#include "camel-types.h" -#include "camel-seekable-stream.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 _CamelSimpleDataWrapperStreamClass CamelSimpleDataWrapperStreamClass; - -struct _CamelSimpleDataWrapperStream { - CamelSeekableStream parent; - - CamelSimpleDataWrapper *wrapper; - gint current_position; -}; - -struct _CamelSimpleDataWrapperStreamClass { - CamelSeekableStreamClass 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 f4b7afd5f9..0000000000 --- a/camel/camel-simple-data-wrapper.c +++ /dev/null @@ -1,247 +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 - * - * 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 - -#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 CamelStream * _get_output_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_output_stream = _get_output_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 (void) -{ - 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; -} - - -static CamelStream * -_get_output_stream (CamelDataWrapper *data_wrapper) -{ - - CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::get_output_stream leaving\n"); - return camel_data_wrapper_get_input_stream (data_wrapper); - CAMEL_LOG_FULL_DEBUG ("CamelSimpleDataWrapper::get_output_stream leaving\n"); - -} diff --git a/camel/camel-simple-data-wrapper.h b/camel/camel-simple-data-wrapper.h deleted file mode 100644 index fe89af5545..0000000000 --- a/camel/camel-simple-data-wrapper.h +++ /dev/null @@ -1,79 +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 - * - * 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 -#include "camel-types.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)) - - -struct _CamelSimpleDataWrapper -{ - CamelDataWrapper parent_object; - - GByteArray *byte_array; - CamelStream *stream; -}; - - - -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); -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 5428dde2e2..0000000000 --- a/camel/camel-store.c +++ /dev/null @@ -1,145 +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 - * - * 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 -#include "camel-store.h" -#include "camel-exception.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, CamelException *ex); -static CamelFolder *_get_root_folder(CamelStore *store, CamelException *ex); -static CamelFolder *_get_default_folder(CamelStore *store, CamelException *ex); -static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex); - -static void -camel_store_class_init (CamelStoreClass *camel_store_class) -{ - - parent_class = gtk_type_class (camel_service_get_type ()); - - /* virtual method definition */ - 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; -} - - - - - - - -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; -} - - - - -static CamelFolder * -_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex) -{ - 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, CamelException *ex) -{ - return CS_CLASS(store)->get_folder (store, folder_name, ex); -} - - -/** - * 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 toplevel folder. - **/ -static CamelFolder * -_get_root_folder (CamelStore *store, CamelException *ex) -{ - 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, CamelException *ex) -{ - return NULL; -} diff --git a/camel/camel-store.h b/camel/camel-store.h deleted file mode 100644 index afcc308317..0000000000 --- a/camel/camel-store.h +++ /dev/null @@ -1,80 +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 - * - * 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 -#include "camel-types.h" -#include "camel-service.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; - -}; - - - -typedef struct { - CamelServiceClass parent_class; - - CamelFolder * (*get_folder) (CamelStore *store, - const gchar *folder_name, - CamelException *ex); - CamelFolder * (*get_root_folder) (CamelStore *store, - CamelException *ex); - CamelFolder * (*get_default_folder) (CamelStore *store, - CamelException *ex); - -} CamelStoreClass; - - -/* public methods */ - -/* Standard Gtk function */ -GtkType camel_store_get_type (void); - -CamelFolder * camel_store_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_STORE_H */ diff --git a/camel/camel-stream-b64.c b/camel/camel-stream-b64.c deleted file mode 100644 index 3b97b11aad..0000000000 --- a/camel/camel-stream-b64.c +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include "camel-stream-b64.h" - - - - -static CamelStreamClass *parent_class = NULL; - -static guchar char_to_six_bits [256] = { - 128, 128, 128, 128, 128, 128, 128, 128, /* 0 .. 7 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 8 .. 15 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 16 .. 23 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 24 .. 31 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 32 .. 39 */ - 128, 128, 128, 62, 128, 128, 128, 63, /* 40 .. 47 */ - 52, 53, 54, 55, 56, 57, 58, 59, /* 48 .. 55 */ - 60, 61, 128, 128, 128, 64, 128, 128, /* 56 .. 63 */ - 128, 0, 1, 2, 3, 4, 5, 6, /* 64 .. 71 */ - 7, 8, 9, 10, 11, 12, 13, 14, /* 72 .. 79 */ - 15, 16, 17, 18, 19, 20, 21, 22, /* 80 .. 87 */ - 23, 24, 25, 128, 128, 128, 128, 128, /* 88 .. 95 */ - 128, 26, 27, 28, 29, 30, 31, 32, /* 96 .. 103 */ - 33, 34, 35, 36, 37, 38, 39, 40, /* 104 .. 111 */ - 41, 42, 43, 44, 45, 46, 47, 48, /* 112 .. 119 */ - 49, 50, 51, 128, 128, 128, 128, 128, /* 120 .. 127 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 128 .. 135 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 136 .. 143 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 144 .. 151 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 152 .. 159 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 160 .. 167 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 168 .. 175 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 176 .. 183 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 184 .. 191 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 192 .. 199 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 200 .. 207 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 208 .. 215 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 216 .. 223 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 224 .. 231 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 232 .. 239 */ - 128, 128, 128, 128, 128, 128, 128, 128, /* 240 .. 247 */ - 128, 128, 128, 128, 128, 128, 128, 128 /* 248 .. 255 */ -}; - - -static gchar six_bits_to_char[65] = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - -/* Returns the class for a CamelStreamB64 */ -#define CSB64_CLASS(so) CAMEL_STREAM_B64_CLASS (GTK_OBJECT(so)->klass) - -static void init_with_input_stream__static (CamelStreamB64 *stream_b64, - CamelStream *input_stream); - -static gint read__static (CamelStream *stream, - gchar *buffer, - gint n); - -static void reset__static (CamelStream *stream); - -static gint read_decode__static (CamelStream *stream, - gchar *buffer, - gint n); -static gboolean eos__static (CamelStream *stream); - -static void -camel_stream_b64_class_init (CamelStreamB64Class *camel_stream_b64_class) -{ - CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_b64_class); - - - parent_class = gtk_type_class (camel_stream_get_type ()); - - /* virtual method definition */ - camel_stream_b64_class->init_with_input_stream = init_with_input_stream__static; - - - /* virtual method overload */ - camel_stream_class->read = read__static; - camel_stream_class->eos = eos__static; - camel_stream_class->reset = reset__static; - - /* signal definition */ - -} - -GtkType -camel_stream_b64_get_type (void) -{ - static GtkType camel_stream_b64_type = 0; - - if (!camel_stream_b64_type) { - GtkTypeInfo camel_stream_b64_info = - { - "CamelStreamB64", - sizeof (CamelStreamB64), - sizeof (CamelStreamB64Class), - (GtkClassInitFunc) camel_stream_b64_class_init, - (GtkObjectInitFunc) NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_stream_b64_type = gtk_type_unique (camel_stream_get_type (), &camel_stream_b64_info); - } - - return camel_stream_b64_type; -} - - -static void -reemit_available_signal__static (CamelStream *parent_stream, gpointer user_data) -{ - gtk_signal_emit_by_name (GTK_OBJECT (user_data), "data_available"); -} - -static void -init_with_input_stream__static (CamelStreamB64 *stream_b64, - CamelStream *input_stream) -{ - g_assert (stream_b64); - g_assert (input_stream); - - - - /* by default, the stream is in decode mode */ - stream_b64->mode = CAMEL_STREAM_B64_DECODER; - - stream_b64->eos = FALSE; - stream_b64->decode_status.keep = 0; - stream_b64->decode_status.state = 0; - - - stream_b64->input_stream = input_stream; - - gtk_object_ref (GTK_OBJECT (input_stream)); - - /* - * connect to the parent stream "data_available" - * stream so that we can reemit the signal on the - * seekable substream in case some data would - * be available for us - */ - gtk_signal_connect (GTK_OBJECT (input_stream), - "data_available", - reemit_available_signal__static, - stream_b64); - - - /* bootstrapping signal */ - gtk_signal_emit_by_name (GTK_OBJECT (stream_b64), "data_available"); - - -} - - - -CamelStream * -camel_stream_b64_new_with_input_stream (CamelStream *input_stream) -{ - CamelStreamB64 *stream_b64; - - stream_b64 = gtk_type_new (camel_stream_b64_get_type ()); - CSB64_CLASS (stream_b64)->init_with_input_stream (stream_b64, input_stream); - - return CAMEL_STREAM (stream_b64); -} - - - - -void -camel_stream_b64_set_mode (CamelStreamB64 *stream_b64, - CamelStreamB64Mode mode) -{ - g_assert (stream_b64); - stream_b64->mode = mode; -} - - - - -static gint -read__static (CamelStream *stream, - gchar *buffer, - gint n) -{ - CamelStreamB64 *stream_b64 = CAMEL_STREAM_B64 (stream); - - g_assert (stream); - - - if (stream_b64->mode == CAMEL_STREAM_B64_DECODER) - return read_decode__static (stream, buffer, n); - - return 0; -} - - - -static gint read_decode__static (CamelStream *stream, - gchar *buffer, - gint n) -{ - CamelStreamB64 *stream_b64 = CAMEL_STREAM_B64 (stream); - CamelStream64DecodeStatus *status; - CamelStream *input_stream; - guchar six_bits_value; - gint nb_read_in_input; - guchar c; - gint j = 0; - - g_assert (stream); - input_stream = stream_b64->input_stream; - - g_assert (input_stream); - status = &(stream_b64->decode_status); - - - /* state = (CamelStream64DecodeState *) - ((gchar *)stream_b64 + G_STRUCT_OFFSET (CamelStreamB64, decode_state)) */ - - nb_read_in_input = camel_stream_read (input_stream, &c, 1); - - while ((nb_read_in_input >0 ) && (jstream != 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 22c3eaef0c..0000000000 --- a/camel/camel-stream-data-wrapper.h +++ /dev/null @@ -1,71 +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__ - -#include -#include "camel-types.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 _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 f2aab64910..0000000000 --- a/camel/camel-stream-fs.c +++ /dev/null @@ -1,550 +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 - * - * 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 -#include "camel-stream-fs.h" -#include -#include -#include -#include -#include -#include -#include "camel-log.h" - -static CamelSeekableStreamClass *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 gboolean _available (CamelStream *stream); -static gboolean _eos (CamelStream *stream); -static void _close (CamelStream *stream); -static gint _seek (CamelSeekableStream *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_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint32 sup_bound); -static void _init_with_name (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode); -static void _init_with_name_and_bounds (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode, - guint32 inf_bound, gint32 sup_bound); - -static void -camel_stream_fs_class_init (CamelStreamFsClass *camel_stream_fs_class) -{ - CamelSeekableStreamClass *camel_seekable_stream_class = CAMEL_SEEKABLE_STREAM_CLASS (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_seekable_stream_get_type ()); - - /* virtual method definition */ - camel_stream_fs_class->init_with_fd = _init_with_fd; - camel_stream_fs_class->init_with_fd_and_bounds = _init_with_fd_and_bounds; - camel_stream_fs_class->init_with_name = _init_with_name; - camel_stream_fs_class->init_with_name_and_bounds = _init_with_name_and_bounds; - - /* 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_seekable_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; - stream->eof = FALSE; -} - - -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_seekable_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 -_set_bounds (CamelStreamFs *stream_fs, guint32 inf_bound, guint32 sup_bound) -{ - - printf ("sup_bounds = %u\n", sup_bound); - /* store the bounds */ - stream_fs->inf_bound = inf_bound; - stream_fs->sup_bound = sup_bound; - - /* go to the first position */ - lseek (stream_fs->fd, inf_bound, SEEK_SET); - - CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos = inf_bound; - - CAMEL_LOG_FULL_DEBUG ("In CamelStreamFs::_set_bounds, " - "setting inf bound to %u, " - "sup bound to %ld, current postion to %u from %u\n", - stream_fs->inf_bound, stream_fs->sup_bound, - CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos, inf_bound); - -} - - - - -static void -_init_with_fd (CamelStreamFs *stream_fs, int fd) -{ - stream_fs->fd = fd; - stream_fs->inf_bound = 0; - stream_fs->sup_bound = -1; - CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos = 0; -} - - - - -static void -_init_with_fd_and_bounds (CamelStreamFs *stream_fs, int fd, guint32 inf_bound, gint32 sup_bound) -{ - - CSFS_CLASS (stream_fs)->init_with_fd (stream_fs, fd); - _set_bounds (stream_fs, inf_bound, sup_bound); - -} - - - -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 | O_NONBLOCK; - else - flags = O_RDONLY | O_NONBLOCK; - } else { - if (mode & CAMEL_STREAM_FS_WRITE) - flags = O_WRONLY | O_CREAT | O_NONBLOCK; - else - return; - } - - if ( (mode & CAMEL_STREAM_FS_READ) && !(mode & CAMEL_STREAM_FS_WRITE) ) - if (v == -1) { - stream_fs->fd = -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); - - gtk_signal_emit_by_name (GTK_OBJECT (stream_fs), "data_available"); - -} - - - -static void -_init_with_name_and_bounds (CamelStreamFs *stream_fs, const gchar *name, CamelStreamFsMode mode, - guint32 inf_bound, gint32 sup_bound) -{ - CSFS_CLASS (stream_fs)->init_with_name (stream_fs, name, mode); - _set_bounds (stream_fs, inf_bound, (gint32)sup_bound); - CAMEL_LOG_FULL_DEBUG ("In CamelStreamFs::init_with_name_and_bounds, " - "setting inf bound to %u, " - "sup bound to %ld, current postion to %u\n", - stream_fs->inf_bound, stream_fs->sup_bound, - CAMEL_SEEKABLE_STREAM (stream_fs)->cur_pos); -} - - - - -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); - if (stream_fs->fd == -1) { - gtk_object_destroy (GTK_OBJECT (stream_fs)); - return NULL; - } - - return CAMEL_STREAM (stream_fs); -} - - -CamelStream * -camel_stream_fs_new_with_name_and_bounds (const gchar *name, CamelStreamFsMode mode, - guint32 inf_bound, gint32 sup_bound) -{ - CamelStreamFs *stream_fs; - stream_fs = gtk_type_new (camel_stream_fs_get_type ()); - CSFS_CLASS (stream_fs)->init_with_name_and_bounds (stream_fs, name, mode, inf_bound, sup_bound); - - 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); -} - - - -CamelStream * -camel_stream_fs_new_with_fd_and_bounds (int fd, guint32 inf_bound, gint32 sup_bound) -{ - 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_and_bounds (stream_fs, fd, inf_bound, sup_bound); - - 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) -{ - CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream); - gint v; - gint nb_to_read; - - if (stream_fs->sup_bound != -1) - nb_to_read = MIN (stream_fs->sup_bound - CAMEL_SEEKABLE_STREAM (stream)->cur_pos, n); - else - nb_to_read = n; - - do { - v = read ( (CAMEL_STREAM_FS (stream))->fd, buffer, nb_to_read); - } while (v == -1 && errno == EINTR); - if (v<0) - CAMEL_LOG_FULL_DEBUG ("CamelStreamFs::read v=%d\n", v); - else - CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v; - - if (v == 0) - stream_fs->eof = TRUE; - - return v; -} - - -/** - * _write: write 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) -{ - CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream); - int v; - gint nb_to_write; - - g_assert (stream); - g_assert (stream_fs->fd); - CAMEL_LOG_FULL_DEBUG ( "CamelStreamFs:: entering write. n=%d\n", n); - - if (stream_fs->sup_bound != -1) - nb_to_write = MIN (stream_fs->sup_bound - CAMEL_SEEKABLE_STREAM (stream)->cur_pos, n); - else - nb_to_write = n; - - do { - v = write ( stream_fs->fd, buffer, nb_to_write); - } 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 - - if (v>0) - CAMEL_SEEKABLE_STREAM (stream)->cur_pos += v; - - 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 gboolean -_available (CamelStream *stream) -{ - g_warning ("Not implemented yet"); - return FALSE; -} - - -/** - * _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) -{ - CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream); - - g_assert (stream_fs); - return stream_fs->eof; -} - - -/** - * _close: close a stream - * @stream: the stream - * - * - **/ -static void -_close (CamelStream *stream) -{ - close ((CAMEL_STREAM_FS (stream))->fd); -} - - -static gint -_seek (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy) -{ - int whence; - gint return_position; - gint real_offset; - CamelStreamFs *stream_fs = CAMEL_STREAM_FS (stream); - -#if 0 - /* because we don't know what is going to happen, we - set the eof stream to false so that a reread can - occur */ - stream_fs->eof = FALSE; -#endif - switch (policy) { - case CAMEL_STREAM_SET: - real_offset = MAX (stream_fs->inf_bound + offset, stream_fs->inf_bound); - if (stream_fs->sup_bound > 0) - real_offset = MIN (real_offset, stream_fs->sup_bound); - whence = SEEK_SET; - break; - - case CAMEL_STREAM_CUR: - if ((stream_fs->sup_bound != -1) && ((CAMEL_SEEKABLE_STREAM (stream)->cur_pos + offset) > stream_fs->sup_bound)) { - real_offset = stream_fs->sup_bound; - whence = SEEK_SET; - } else if ((CAMEL_SEEKABLE_STREAM (stream)->cur_pos + offset) < stream_fs->inf_bound) { - real_offset = stream_fs->inf_bound; - whence = SEEK_SET; - } else - { - real_offset = offset; - whence = SEEK_CUR; - } - break; - - case CAMEL_STREAM_END: - if (stream_fs->sup_bound != -1) { - real_offset = stream_fs->sup_bound - offset; - whence = SEEK_SET; - } else { - real_offset = offset; - whence = SEEK_END; - } - - - break; - default: - return -1; - } - - - - printf ("***** Seeking : real_offset=%d, whence=%d\n", real_offset, whence); - return_position = lseek (stream_fs->fd, real_offset, whence) - stream_fs->inf_bound; - printf ("*** *** *** *** ***\n"); - - CAMEL_SEEKABLE_STREAM (stream)->cur_pos = return_position; - - - return return_position; -} - - - - - - - - - - - diff --git a/camel/camel-stream-fs.h b/camel/camel-stream-fs.h deleted file mode 100644 index 9a1477ebaa..0000000000 --- a/camel/camel-stream-fs.h +++ /dev/null @@ -1,113 +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 - * - * 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 -#include "camel-types.h" -#include "camel-seekable-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; - - -struct _CamelStreamFs -{ - - CamelSeekableStream parent_object; - - gchar *name; /* name of the underlying file */ - gboolean eof; /* are we at the end of the file ? */ - gint fd; /* file descriptor on the underlying file */ - guint32 inf_bound; /* first valid position */ - gint32 sup_bound; /* last valid position, -1 means, no sup bound */ - -}; - - - -typedef struct { - CamelSeekableStreamClass parent_class; - - /* Virtual methods */ - void (*init_with_fd) (CamelStreamFs *stream_fs, - int fd); - void (*init_with_fd_and_bounds) (CamelStreamFs *stream_fs, - int fd, guint32 inf_bound, - gint32 sup_bound); - - void (*init_with_name) (CamelStreamFs *stream_fs, - const gchar *name, - CamelStreamFsMode mode); - void (*init_with_name_and_bounds) (CamelStreamFs *stream_fs, - const gchar *name, - CamelStreamFsMode mode, - guint32 inf_bound, - gint32 sup_bound); - -} 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_name_and_bounds (const gchar *name, - CamelStreamFsMode mode, - guint32 inf_bound, - gint32 sup_bound); - -CamelStream * camel_stream_fs_new_with_fd (int fd); -CamelStream * camel_stream_fs_new_with_fd_and_bounds (int fd, - guint32 inf_bound, - gint32 sup_bound); - -#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 6dd1b804cf..0000000000 --- a/camel/camel-stream-mem.c +++ /dev/null @@ -1,288 +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 - * - * 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 -#include "camel-stream-mem.h" -#include -#include -#include -#include -#include "camel-log.h" - -static CamelStreamClass *parent_class=NULL; - - -/* Returns the class for a CamelStreamMEM */ -#define CSM_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 (CamelSeekableStream *stream, gint offset, CamelStreamSeekPolicy policy); - -static void _finalize (GtkObject *object); - -static void -camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class) -{ - CamelSeekableStreamClass *camel_seekable_stream_class = CAMEL_SEEKABLE_STREAM_CLASS (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_seekable_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_seekable_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 (CamelSeekableStream *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 6c9534f24e..0000000000 --- a/camel/camel-stream-mem.h +++ /dev/null @@ -1,90 +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 - * - * 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 -#include "camel-types.h" -#include "camel-seekable-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; - - -struct _CamelStreamMem -{ - CamelSeekableStream parent_object; - - GByteArray *buffer; - gint position; - CamelStreamMemMode mode; - -}; - - - -typedef struct { - CamelSeekableStreamClass 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 77d3f4af39..0000000000 --- a/camel/camel-stream.c +++ /dev/null @@ -1,244 +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 - * - * 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 -#include "camel-stream.h" - - -enum { - DATA_AVAILABLE, - LAST_SIGNAL -}; - -static guint camel_stream_signals[LAST_SIGNAL] = { 0 }; - -static GtkObjectClass *parent_class = NULL; - - -/* Returns the class for a CamelStream */ -#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 void -camel_stream_class_init (CamelStreamClass *camel_stream_class) -{ - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (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->close = NULL; - - /* virtual method overload */ - - /* signal definition */ - camel_stream_signals[DATA_AVAILABLE] = - gtk_signal_new ("data_available", - GTK_RUN_LAST, - gtk_object_class->type, - GTK_SIGNAL_OFFSET (CamelStreamClass, data_available), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (gtk_object_class, camel_stream_signals, LAST_SIGNAL); - -} - -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: %TRUE if some data is available for reading, %FALSE otherwise - **/ -gboolean -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_reset: reset a stream - * @stream: the stream object - * - * Reset a stream, that is put it in a state - * where it can be read from the begining. - * All streams in camel are not seekable, - * but they must all be resettable. - * - **/ -void -camel_stream_reset (CamelStream *stream) -{ - CS_CLASS (stream)->reset (stream); -} - - - - -/***************** 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 7da73e4a5e..0000000000 --- a/camel/camel-stream.h +++ /dev/null @@ -1,108 +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 - * - * 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 -#include "camel-types.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)) - - -struct _CamelStream -{ - GtkObject parent_object; - -}; - - - -typedef struct { - GtkObjectClass parent_class; - - /* Virtual methods */ - - void (*data_available) (CamelStream *stream); /* default "data_available" signal handler */ - - gint (*read) (CamelStream *stream, gchar *buffer, gint n); - gint (*write) (CamelStream *stream, const gchar *buffer, gint n); - void (*flush) (CamelStream *stream); - gboolean (*available) (CamelStream *stream); - gboolean (*eos) (CamelStream *stream); - void (*close) (CamelStream *stream); - void (*reset) (CamelStream *stream); -} 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); -gboolean camel_stream_available (CamelStream *stream); -gboolean camel_stream_eos (CamelStream *stream); -void camel_stream_close (CamelStream *stream); -void camel_stream_reset (CamelStream *stream); - - - - -/* 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 53fda08bab..0000000000 --- a/camel/camel-thread-proxy.c +++ /dev/null @@ -1,565 +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 - * - * 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 -#include "camel-log.h" -#include "camel-marshal-utils.h" -#include "camel-thread-proxy.h" -#include -#include -#include -#include - - - -/* 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 (void) -{ - 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) -{ - 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; - 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; - - 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[]) -{ - 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 a82a19c87f..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 - * - * 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); -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-transport.c b/camel/camel-transport.c deleted file mode 100644 index ad4dfc6bc7..0000000000 --- a/camel/camel-transport.c +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-transport.c : Abstract class for an email transport */ - -/* - * - * Author : - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (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 -#include "camel-transport.h" -#include "camel-exception.h" -#include "camel-log.h" - -/* Returns the class for a CamelTransport */ -#define CT_CLASS(so) CAMEL_TRANSPORT_CLASS (GTK_OBJECT(so)->klass) - -GtkType -camel_transport_get_type (void) -{ - static GtkType camel_transport_type = 0; - - if (!camel_transport_type) { - GtkTypeInfo camel_transport_info = - { - "CamelTransport", - sizeof (CamelTransport), - sizeof (CamelTransportClass), - (GtkClassInitFunc) NULL, - (GtkObjectInitFunc) NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_transport_type = gtk_type_unique (CAMEL_SERVICE_TYPE, &camel_transport_info); - } - - return camel_transport_type; -} - - -/** - * camel_transport_can_send: Determine if a message is send-able on a transport - * @transport: the transport - * @message: the message - * - * Determines if a CamelMedium is of an appropriate subclass to send - * via the given @transport. (Mail transports are not able to send - * netnews articles, and vice versa.) - * - * Return value: TRUE or FALSE - **/ -gboolean -camel_transport_can_send (CamelTransport *transport, CamelMedium *message) -{ - return CT_CLASS (transport)->can_send (transport, message); -} - -/** - * camel_transport_send: Send a message via a transport - * @transport: the transport - * @message: the message - * @ex: a CamelException - * - * Sends the message to the recipients indicated in the message. - * - * Return value: success or failure. - **/ -gboolean -camel_transport_send (CamelTransport *transport, CamelMedium *message, - CamelException *ex) -{ - return CT_CLASS (transport)->send (transport, message, ex); -} - -/** - * camel_transport_send_to: Send a message non-standard recipients - * @transport: the transport - * @message: the message - * @recipients: the recipients - * @ex: a CamelException - * - * Sends the message to the given recipients, rather than to the - * recipients indicated in the message. - * - * Return value: success or failure. - **/ -gboolean -camel_transport_send_to (CamelTransport *transport, CamelMedium *message, - GList *recipients, CamelException *ex) -{ - return CT_CLASS (transport)->send_to (transport, message, - recipients, ex); -} diff --git a/camel/camel-transport.h b/camel/camel-transport.h deleted file mode 100644 index 1e41f4ac71..0000000000 --- a/camel/camel-transport.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-transport.h : Abstract class for an email transport */ - -/* - * - * Author : - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (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_TRANSPORT_H -#define CAMEL_TRANSPORT_H 1 - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#include -#include "camel-types.h" -#include "camel-service.h" - -#define CAMEL_TRANSPORT_TYPE (camel_transport_get_type ()) -#define CAMEL_TRANSPORT(obj) (GTK_CHECK_CAST((obj), CAMEL_TRANSPORT_TYPE, CamelTransport)) -#define CAMEL_TRANSPORT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_TRANSPORT_TYPE, CamelTransportClass)) -#define CAMEL_IS_TRANSPORT(o) (GTK_CHECK_TYPE((o), CAMEL_TRANSPORT_TYPE)) - - -struct _CamelTransport -{ - CamelService parent_object; - -}; - - - -typedef struct { - CamelServiceClass parent_class; - - gboolean (*can_send) (CamelTransport *transport, CamelMedium *message); - gboolean (*send) (CamelTransport *transport, CamelMedium *message, - CamelException *ex); - gboolean (*send_to) (CamelTransport *transport, - CamelMedium *message, GList *recipients, - CamelException *ex); -} CamelTransportClass; - - -/* public methods */ -gboolean camel_transport_can_send (CamelTransport *transport, - CamelMedium *message); - -gboolean camel_transport_send (CamelTransport *transport, - CamelMedium *message, - CamelException *ex); - -gboolean camel_transport_send_to (CamelTransport *transport, - CamelMedium *message, - GList *recipients, - CamelException *ex); - -/* Standard Gtk function */ -GtkType camel_transport_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_TRANSPORT_H */ diff --git a/camel/camel-types.h b/camel/camel-types.h deleted file mode 100644 index c070404e95..0000000000 --- a/camel/camel-types.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Copyright 2000 Helix Code, Inc. (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_TYPES_H -#define CAMEL_TYPES_H 1 - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -typedef struct _CamelDataWrapper CamelDataWrapper; -typedef struct _CamelException CamelException; -typedef struct _CamelFolder CamelFolder; -typedef struct _CamelFolderSummary CamelFolderSummary; -typedef struct _CamelFormatter CamelFormatter; -typedef struct _CamelMedium CamelMedium; -typedef struct _CamelMimeBodyPart CamelMimeBodyPart; -typedef struct _CamelMimeMessage CamelMimeMessage; -typedef struct _CamelMimePart CamelMimePart; -typedef struct _CamelMultipart CamelMultipart; -typedef struct _CamelSeekableStream CamelSeekableStream; -typedef struct _CamelSeekableSubstream CamelSeekableSubstream; -typedef struct _CamelService CamelService; -typedef struct _CamelSession CamelSession; -typedef struct _CamelSimpleDataWrapper CamelSimpleDataWrapper; -typedef struct _CamelSimpleDataWrapperStream CamelSimpleDataWrapperStream; -typedef struct _CamelStore CamelStore; -typedef struct _CamelStream CamelStream; -typedef struct _CamelStreamBufferedFs CamelStreamBufferedFs; -typedef struct _CamelStreamDataWrapper CamelStreamDataWrapper; -typedef struct _CamelStreamFs CamelStreamFs; -typedef struct _CamelStreamMem CamelStreamMem; -typedef struct _CamelTransport CamelTransport; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_TYPES_H */ diff --git a/camel/camel.c b/camel/camel.c deleted file mode 100644 index 63a5698801..0000000000 --- a/camel/camel.c +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include "camel.h" - -gint -camel_init(void) -{ - - -#ifdef ENABLE_THREADS -#ifdef G_THREADS_ENABLED - g_thread_init (NULL); -#else /* G_THREADS_ENABLED */ - printf ("Threads are not supported by your version of glib\n"); -#endif /* G_THREADS_ENABLED */ -#endif /* ENABLE_THREADS */ - - return data_wrapper_repository_init (); -} diff --git a/camel/camel.h b/camel/camel.h deleted file mode 100644 index 98d2248218..0000000000 --- a/camel/camel.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -gint camel_init (void); - -#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 def74e4413..0000000000 --- a/camel/data-wrapper-repository.c +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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-simple-data-wrapper.h" -#include "camel-mime-message.h" -#include "camel-multipart.h" -#include -#include "hash-table-utils.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_strcase_hash, g_strcase_equal); - data_wrapper_repository_set_data_wrapper_type ("multipart", camel_multipart_get_type()); - - /* this is a temporary default so that Michael can use get_stream on text messages */ - data_wrapper_repository_set_data_wrapper_type ("text", camel_simple_data_wrapper_get_type()); - - /* this is for matt the great lopper */ - data_wrapper_repository_set_data_wrapper_type ("message/rfc822", camel_mime_message_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; - - printf("looking up type '%s'\n", mime_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)>k_type); - if (exists) { /* the complete mime type exists, return it */ - printf( "exists!\n"); - 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)>k_type); - - if (exists) /* the main mime type association exists */ - return gtk_type; - else return camel_simple_data_wrapper_get_type(); - } - - - - -} - diff --git a/camel/data-wrapper-repository.h b/camel/data-wrapper-repository.h deleted file mode 100644 index ec73025764..0000000000 --- a/camel/data-wrapper-repository.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#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 3611cc5247..0000000000 --- a/camel/gmime-base64.c +++ /dev/null @@ -1,106 +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 -#include "gmime-base64.h" - -#define BSIZE 512 - -/* - * 64-based alphabet used by the the Base64 enconding - */ -static char *base64_alphabet = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -/** - * gmime_encode_base64_to_stream: - * @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_to_stream (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 output, 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 5dca9c0ff9..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_to_stream (CamelStream *input, CamelStream *output); - -#endif diff --git a/camel/gmime-content-field.c b/camel/gmime-content-field.c deleted file mode 100644 index bec9721e0a..0000000000 --- a/camel/gmime-content-field.c +++ /dev/null @@ -1,382 +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 - * - * 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 -#include "gmime-content-field.h" -#include "string-utils.h" -#include "camel-log.h" -#include -#include "hash-table-utils.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_strcase_hash, g_strcase_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 *) ¶meter); - 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) { - CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string, leaving\n"); - return; - } - CAMEL_LOG_FULL_DEBUG ("GMimeContentField::construct_from_string, All checks done\n"); - CAMEL_LOG_FULL_DEBUG ("GMimeContentField::construct_from_string the complete header is\n" - "-------------------\n%s\n-------------------\n", string); - /* find the type */ - while ( (itype = type; - CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime type : \"%s\"\n", type); - if (i >= len-1) { - content_field->subtype = NULL; - - CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string only found the type leaving\n"); - return; - } - - first = i+1; - /* find the subtype, if any */ - if (string[i++] == '/') { - while ( (isubtype = subtype; - CAMEL_LOG_TRACE ( "GMimeContentField::construct_from_string, Found mime subtype: \"%s\"\n", subtype); - if (i >= len-1) { - CAMEL_LOG_FULL_DEBUG ( "GMimeContentField::construct_from_string found the subtype but no parameter, leaving\n"); - return; - } - } - } - first = i+1; - - /* parse parameters list */ - param_end = FALSE; - do { - while ( (i - * - * 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 -#include -#include "camel-stream.h" - -typedef struct { - - gchar *type; - gchar *subtype; - GHashTable *parameters; - - gint ref; - -} GMimeContentField; - -GMimeContentField *gmime_content_field_new (const gchar *type, const gchar *subtype); -void gmime_content_field_ref (GMimeContentField *content_field); -void gmime_content_field_unref (GMimeContentField *content_field); - -void gmime_content_field_set_parameter (GMimeContentField *content_field, const gchar *attribute, const gchar *value); -void gmime_content_field_write_to_stream (GMimeContentField *content_field, CamelStream *stream); -void gmime_content_field_construct_from_string (GMimeContentField *content_field, const gchar *string); -void gmime_content_field_free (GMimeContentField *content_field); -gchar * gmime_content_field_get_mime_type (GMimeContentField *content_field); -const gchar *gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar *name); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* GMIME_CONTENT_FIELD_H */ diff --git a/camel/gmime-rfc2047.c b/camel/gmime-rfc2047.c deleted file mode 100644 index 8dad887849..0000000000 --- a/camel/gmime-rfc2047.c +++ /dev/null @@ -1,491 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gmime-rfc2047.c: implemention of RFC2047 */ - -/* - * Author : - * Bertrand Guiheneuf - * - * 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 - */ - -#include -#include -#include -#include - -#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;i0;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 and the comment starter/ender ) - - identify the best character set for each word - - merge words which share a character set, allow jumping and merging with words which - would be ok to encode in non-US-ASCII. - - if we have to use 2 character sets, try and collapse them into one. - - (e.g. if one word contains letters in latin-1, and another letters in latin-2, use - latin-2 for the first word as well if possible). - - finally : - - if utf-8 will still be used, use it for everything. - - and then, at last, generate the encoded text, using base64/quoted-printable for - each word depending upon which is more efficient. - - TODO : - create a priority list of encodings - - i.e. - - US-ASCII, ISO-8859-1, ISO-8859-2, ISO-8859-3, KOI8, - - Should survey for most popular charsets : - what do people usually use for the following scripts? - - * Chinese/Japanese/Korean - * Greek - * Cyrillic - - (any other scripts commonly used in mail/news?) - - This algorithm is probably far from optimal, but should be - reasonably efficient for simple cases. (and almost free if - the text is just in US-ASCII : like 99% of the text that will - pass through it) - - - - current status : - - Algorithm now partially implemented. - - */ - - g_free(words); - g_free(temp); - - return encoded; -} diff --git a/camel/gmime-rfc2047.h b/camel/gmime-rfc2047.h deleted file mode 100644 index 6efd8cc243..0000000000 --- a/camel/gmime-rfc2047.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gmime-rfc2047.c: implemention of RFC2047 */ - -/* - * Author : - * Bertrand Guiheneuf - * - * 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 - */ - -#ifndef GMIME_RFC2047_H -#define GMIME_RFC2047_H 1 -#include - -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 7ceb0219ec..0000000000 --- a/camel/gmime-utils.c +++ /dev/null @@ -1,293 +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 - * - * 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 -#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"); - CAMEL_LOG_FULL_DEBUG ( "\theader name : %s\n", header_name); - 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; - CAMEL_LOG_FULL_DEBUG ( "write_header_with_glist_to_stream:: writing value : %s\n", current); - 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"); - -} - - - -/* - this is a blocking version of the - header parsing. Need to change when - fs streams are non blocking -*/ -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; - 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 '\r': CAMEL_LOG_FULL_DEBUG ( "gmime-utils::get_header_table_from_stream " - "****** FOUND A \\r******* \n"); - 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 { - - if (camel_stream_eos (stream)) { - - 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 { - - if (camel_stream_eos (stream)) - 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 cf352cb798..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 - * - * 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 -#include -#include - -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 eb89c2aa28..0000000000 --- a/camel/gstring-util.c +++ /dev/null @@ -1,345 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gstring-util : utilities for gstring object */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#include "gstring-util.h" -#include "camel-log.h" -#include - -/** - * 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=first) && (tmp[pos]!=sep)); - } else { - pos = first; - do { - pos++; - } while ((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: - **/ -gint -g_string_equal_for_hash (gconstpointer v, gconstpointer v2) -{ - return strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0; -} - -gint -g_string_equal_for_glist (gconstpointer v, gconstpointer v2) -{ - return !strcmp ( ((const GString*)v)->str, ((const GString*)v2)->str) == 0; -} - - -/** - * g_string_hash: computes a hash value for a Gstring - * @v: Gstring object - * - * - * - * Return value: - **/ -guint -g_string_hash (gconstpointer v) -{ - return g_str_hash(((const GString*)v)->str); -} - - - - -/* utility func : frees a GString element in a GList */ -static void -__g_string_list_free_string (gpointer data, gpointer user_data) -{ - GString *string = (GString *)data; - g_string_free(string, TRUE); -} - - -void -g_string_list_free (GList *string_list) -{ - g_list_foreach(string_list, __g_string_list_free_string, NULL); - g_list_free(string_list); -} - - - - - - -GList * -g_string_split (GString *string, char sep, gchar *trim_chars, GStringTrimOption trim_options) -{ - GList *result = NULL; - gint first, last, pos; - gchar *str; - gchar *new_str; - GString *new_gstring; - - g_assert (string); - str = string->str; - if (!str) return NULL; - - first = 0; - last = strlen(str) - 1; - - /* strip leading and trailing separators */ - while ( (first<=last) && (str[first]==sep) ) - first++; - while ( (first<=last) && (str[last]==sep) ) - last--; - - - CAMEL_LOG_FULL_DEBUG ("g_string_split:: trim options: %d\n", trim_options); - - while (first<=last) { - pos = first; - /* find next separator */ - while ((pos<=last) && (str[pos]!=sep)) pos++; - if (first != pos) { - new_str = g_strndup (str+first, pos-first); - new_gstring = g_string_new (new_str); - g_free (new_str); - /* could do trimming in line to speed up this code */ - if (trim_chars) g_string_trim (new_gstring, trim_chars, trim_options); - result = g_list_append (result, new_gstring); - } - first = pos + 1; - } - - return result; -} - - -void -g_string_trim (GString *string, gchar *chars, GStringTrimOption options) -{ - gint first_ok; - gint last_ok; - guint length; - gchar *str; - - CAMEL_LOG_FULL_DEBUG ("**\nentering g_string_trim::\n"); - - if ((!string) || (!string->str)) - return; - str = string->str; - length = strlen (str); - if (!length) - return; - - first_ok = 0; - last_ok = length - 1; - - CAMEL_LOG_FULL_DEBUG ("g_string_trim:: trim_options:%d\n", options); - if (options & GSTRING_TRIM_STRIP_LEADING) - while ( (first_ok <= last_ok) && (strchr (chars, str[first_ok])) ) - first_ok++; - - if (options & GSTRING_TRIM_STRIP_TRAILING) - while ( (first_ok <= last_ok) && (strchr (chars, str[last_ok])) ) - last_ok++; - CAMEL_LOG_FULL_DEBUG ("g_string_trim::\n\t\"%s\":first ok:%d last_ok:%d\n", - string->str, first_ok, last_ok); - - if (first_ok > 0) - g_string_erase (string, 0, first_ok); - - if (last_ok < length-1) - g_string_truncate (string, last_ok - first_ok +1); - -} diff --git a/camel/gstring-util.h b/camel/gstring-util.h deleted file mode 100644 index 10bbac3a56..0000000000 --- a/camel/gstring-util.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* gstring-util : utilities for gstring object */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 - -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 8415095f63..0000000000 --- a/camel/hash-table-utils.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* generic utilities for hash tables */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#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; - guint h=0, g; - - for(p = s; *p != '\0'; p += 1) { - h = ( h << 4 ) + toupper(*p); - if ( ( g = h & 0xf0000000 ) ) { - h = h ^ (g >> 24); - h = h ^ g; - } - } - - return h /* % M */; -} - - - -/***/ diff --git a/camel/hash-table-utils.h b/camel/hash-table-utils.h deleted file mode 100644 index 99d33f59a0..0000000000 --- a/camel/hash-table-utils.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* generic utilities for hash tables */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 7363eaec40..0000000000 --- a/camel/md5-utils.c +++ /dev/null @@ -1,391 +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 - -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 (MD5Context *ctx, guchar digest[16]) -{ - 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); -} - - - - -/* 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<>(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 (&ctx, digest); - -} - - -/** - * 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 (&ctx, digest); - -} - - - - -/** - * 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; - - printf("generating checksum\n"); - - 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 (&ctx, digest); - - printf("checksum done\n"); -} - - - - diff --git a/camel/md5-utils.h b/camel/md5-utils.h deleted file mode 100644 index e4569dd54a..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 -#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 (MD5Context *ctx, guchar digest[16]); - - -#endif /* MD5_UTILS_H */ diff --git a/camel/providers/.cvsignore b/camel/providers/.cvsignore deleted file mode 100644 index 3dda72986f..0000000000 --- a/camel/providers/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile.in -Makefile 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 . - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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; (ilen) && (!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; (ilen) && (!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; ilen; 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 . - * - * 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 -#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 . - * - * 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 . - * - * 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 . - * - * 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 -#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 . - * - * 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 - -#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 -#include -#include -#include -#include -#include -#include -#include - -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_filelen; 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; ilen; 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 . - * - * 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 -#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 ebcccacd23..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 . - * - * 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 - -#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 -#include -#include -#include -#include -#include -#include -#include - -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; ilen; 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 (&ctx, uid); -} - - - - -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 . - * - * 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 -#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 . - * - * 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 -#include "mh-utils.h" - -#include - -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 . - * - * 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 - -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 ea9b1f3136..0000000000 --- a/camel/providers/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = mbox sendmail -# 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 . - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 . - * - * 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 -#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 . - * - * 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 . - * - * 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 . - * - * 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 -#include "camel-store.h" - -#define CAMEL_MAILDIR_STORE_TYPE (camel_maildir_store_get_type ()) -#define CAMEL_MAILDIR_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStore)) -#define CAMEL_MAILDIR_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MAILDIR_STORE_TYPE, CamelMaildirStoreClass)) -#define IS_CAMEL_MAILDIR_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MAILDIR_STORE_TYPE)) - - -typedef struct { - CamelStore parent_object; - - gchar *toplevel_dir; -} CamelMaildirStore; - - - -typedef struct { - CamelStoreClass parent_class; - - -} CamelMaildirStoreClass; - - -/* public methods */ - -/* Standard Gtk function */ -GtkType camel_maildir_store_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_MAILDIR_STORE_H */ - - diff --git a/camel/providers/mbox/.cvsignore b/camel/providers/mbox/.cvsignore deleted file mode 100644 index fd6b811c68..0000000000 --- a/camel/providers/mbox/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/camel/providers/mbox/Makefile.am b/camel/providers/mbox/Makefile.am deleted file mode 100644 index 13f09b9d7b..0000000000 --- a/camel/providers/mbox/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = - -libcamelmboxincludedir = $(includedir)/camel - - -providerdir = $(pkglibdir)/camel-providers/$(VERSION) - -provider_LTLIBRARIES = libcamelmbox.la - -INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ - -I$(top_srcdir)/intl \ - $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel \ - -I$(top_srcdir)/libibex \ - -I$(top_srcdir)/filter - -libcamelmbox_la_SOURCES = \ - camel-mbox-folder.c \ - camel-mbox-parser.c \ - camel-mbox-provider.c \ - camel-mbox-store.c \ - camel-mbox-summary.c \ - camel-mbox-search.c \ - camel-mbox-utils.c - -libcamelmboxinclude_HEADERS = \ - camel-mbox-folder.h \ - camel-mbox-parser.h \ - camel-mbox-store.h \ - camel-mbox-summary.h \ - camel-mbox-search.h \ - camel-mbox-utils.h - - -libcamelmbox_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) - -#libcamelmbox_la_LIBADD = $(top_builddir)/filter/libfilter.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS) -libcamelmbox_la_LIBADD = $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS) - -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 45390c3928..0000000000 --- a/camel/providers/mbox/camel-mbox-folder.c +++ /dev/null @@ -1,1135 +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 */ - -/* - * Author : Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code . - * - * 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 - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "camel-mbox-folder.h" -#include "camel-mbox-store.h" -#include "string-utils.h" -#include "camel-log.h" -#include "camel-stream-buffered-fs.h" -#include "camel-folder-summary.h" -#include "camel-mbox-summary.h" -#include "camel-mbox-parser.h" -#include "camel-mbox-utils.h" -#include "md5-utils.h" -#include "gmime-utils.h" -#include "camel-mbox-search.h" -#include "camel-data-wrapper.h" -#include "camel-mime-message.h" - -#include "camel-exception.h" - -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 (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, - gchar separator, CamelException *ex); -static void _set_name(CamelFolder *folder, const gchar *name, CamelException *ex); - - -static void _open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex); -static void _close (CamelFolder *folder, gboolean expunge, CamelException *ex); -static gboolean _exists (CamelFolder *folder, CamelException *ex); -static gboolean _create(CamelFolder *folder, CamelException *ex); -static gboolean _delete (CamelFolder *folder, gboolean recurse, CamelException *ex); -static gboolean _delete_messages (CamelFolder *folder, CamelException *ex); -static GList *_list_subfolders (CamelFolder *folder, CamelException *ex); -/* 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 GList *_get_uid_list (CamelFolder *folder, CamelException *ex); -static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex); -#if 0 -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); -#endif - -static GList *search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex); - -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 = _init; - camel_folder_class->set_name = _set_name; - camel_folder_class->open = _open; - camel_folder_class->close = _close; - camel_folder_class->exists = _exists; - camel_folder_class->create = _create; - camel_folder_class->delete = _delete; - camel_folder_class->delete_messages = _delete_messages; - camel_folder_class->list_subfolders = _list_subfolders; - /* 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->get_uid_list = _get_uid_list; -#if 0 - camel_folder_class->expunge = _expunge; - camel_folder_class->copy_message_to = _copy_message_to; - camel_folder_class->get_message_uid = _get_message_uid; -#endif - camel_folder_class->get_message_by_uid = _get_message_by_uid; - - camel_folder_class->search_by_expression = search_by_expression; - - 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 (CamelFolder *folder, CamelStore *parent_store, - CamelFolder *parent_folder, const gchar *name, gchar separator, - CamelException *ex) -{ - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder); - - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::init_with_store\n"); - - /* call parent method */ - parent_class->init (folder, parent_store, parent_folder, - name, separator, ex); - if (camel_exception_get_id (ex)) return; - - /* we assume that the parent init - 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 = camel_folder_summary_new (); - - mbox_folder->folder_file_path = NULL; - mbox_folder->summary_file_path = NULL; - mbox_folder->folder_dir_path = NULL; - mbox_folder->index_file_path = NULL; - mbox_folder->internal_summary = NULL; - mbox_folder->uid_array = NULL; - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::init_with_store\n"); -} - - - -/* internal method used to : - - test for the existence of a summary file - - test the sync between the summary and the mbox file - - load the summary or create it if necessary -*/ -static void -_check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelException *ex) -{ - CamelFolder *folder = CAMEL_FOLDER (mbox_folder); - GArray *message_info_array; - gboolean summary_file_exists; - gboolean summary_file_is_sync; - GArray *mbox_summary_info; - gint mbox_file_fd; - guint32 next_uid; - guint32 file_size; - - /* test for the existence of the summary file */ - summary_file_exists = (access (mbox_folder->summary_file_path, F_OK) == 0); - - /* if the summary file exists, test if the - md5 of the mbox file is still in sync - with the one we had computed the last time - we saved the summary file */ - if (summary_file_exists) { - - summary_file_is_sync = - camel_mbox_check_summary_sync (mbox_folder->summary_file_path, - mbox_folder->folder_file_path, - ex); - if (camel_exception_get_id (ex)) return; - } - - - /* in the case where the summary does not exist - or is not in sync with the mbox file - regenerate it */ - if ( !(summary_file_exists && summary_file_is_sync)) { - - /* parse the mbox folder and get some - information about the messages */ - - mbox_file_fd = open (mbox_folder->folder_file_path, O_RDONLY); - message_info_array = camel_mbox_parse_file (mbox_file_fd, - "From ", - 0, - &file_size, - &next_uid, - TRUE, - NULL, - 0, - ex); - - close (mbox_file_fd); - if (camel_exception_get_id (ex)) { - return; - } - - - next_uid = camel_mbox_write_xev (mbox_folder->folder_file_path, - message_info_array, &file_size, next_uid, ex); - - if (camel_exception_get_id (ex)) { - /* ** FIXME : free the preparsed information */ - return; - } - - mbox_summary_info = - parsed_information_to_mbox_summary (message_info_array); - - /* **FIXME : Free the parsed information structure */ - - /* allocate an internal summary object */ - mbox_folder->internal_summary = g_new (CamelMboxSummary, 1); - - /* generate the folder md5 signature */ - md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->internal_summary->md5_digest); - - /* store the number of messages as well as the summary array */ - mbox_folder->internal_summary->nb_message = mbox_summary_info->len; - mbox_folder->internal_summary->next_uid = next_uid; - mbox_folder->internal_summary->mbox_file_size = file_size; - mbox_folder->internal_summary->message_info = mbox_summary_info; - - } else { - /* every thing seems ok, just read the summary file from disk */ - mbox_folder->internal_summary = camel_mbox_load_summary (mbox_folder->summary_file_path, ex); - } - - /* copy the internal summary information to the external - folder summary used by the display engines */ - camel_mbox_summary_append_internal_to_external (mbox_folder->internal_summary, folder->summary, 0); -} - - - -static void -_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex) -{ - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder); - //struct dirent *dir_entry; - //struct stat stat_buf; - - - if (folder->open_state == FOLDER_OPEN) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID_STATE, - "folder is already open"); - return; - } - - - - /* get (or create) uid list */ - //if (!(mbox_load_uid_list (mbox_folder) > 0)) - // mbox_generate_uid_list (mbox_folder); - - _check_get_or_maybe_generate_summary_file (mbox_folder, ex); -} - - -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); - - /* save the folder summary on disc */ - camel_mbox_save_summary (mbox_folder->internal_summary, mbox_folder->summary_file_path, 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; - - 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); - g_free (mbox_folder->index_file_path); - - 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); - - mbox_folder->folder_file_path = g_strdup_printf ("%s/%s", root_dir_path, folder->full_name); - mbox_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary", root_dir_path, folder->full_name); - mbox_folder->folder_dir_path = g_strdup_printf ("%s/%s.sdb", root_dir_path, folder->full_name); - mbox_folder->index_file_path = g_strdup_printf ("%s/%s.ibex", root_dir_path, 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; - 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; - } - - mbox_folder = CAMEL_MBOX_FOLDER(folder); - - - /* 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; - } - - - /* we should not check for that here */ -#if 0 - /* check if the mbox directory exists */ - access_result = access (mbox_folder->folder_dir_path, F_OK); - if (access_result < 0) { - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::exists errot when executing access on %s\n", - mbox_folder->folder_dir_path); - CAMEL_LOG_FULL_DEBUG (" Full error text is : %s\n", strerror(errno)); - camel_exception_set (ex, - CAMEL_EXCEPTION_SYSTEM, - strerror(errno)); - return FALSE; - } - 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; -#endif - - - /* check if the mbox file exists */ - stat_error = stat (mbox_folder->folder_file_path, &stat_buf); - if (stat_error == -1) - return FALSE; - - exists = S_ISREG (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_dir_path; - - if (!(folder_file_path || folder_dir_path)) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID, - "invalid folder path. Use set_name ?"); - return FALSE; - } - - - /* if the folder already exists, simply return */ - folder_already_exists = camel_folder_exists (folder,ex); - if (camel_exception_get_id (ex)) return FALSE; - - if (folder_already_exists) return TRUE; - - - /* create the directory for the subfolders */ - mkdir_error = mkdir (folder_dir_path, dir_mode); - if (mkdir_error == -1) goto io_error; - - - /* create the mbox file */ - /* it must be rw for the user and none for the others */ - old_umask = umask (0700); - creat_fd = open (folder_file_path, - O_WRONLY | O_CREAT | O_APPEND, - S_IRUSR | S_IWUSR); - umask (old_umask); - if (creat_fd == -1) goto io_error; - close (creat_fd); - - /* create the summary object */ - mbox_folder->internal_summary = g_new (CamelMboxSummary, 1); - mbox_folder->internal_summary->nb_message = 0; - mbox_folder->internal_summary->next_uid = 1; - mbox_folder->internal_summary->mbox_file_size = 0; - mbox_folder->internal_summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation)); - - return TRUE; - - /* exception handling for io errors */ - io_error : - - CAMEL_LOG_WARNING ("CamelMboxFolder::create, error when creating %s and %s\n", - folder_dir_path, folder_file_path); - CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno)); - - if (errno == EACCES) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "You don't have the permission to create the mbox file."); - return FALSE; - } else { - camel_exception_set (ex, - CAMEL_EXCEPTION_SYSTEM, - "Unable to create the mbox file."); - return FALSE; - } -} - - - - - - - - -static gboolean -_delete (CamelFolder *folder, gboolean recurse, CamelException *ex) -{ - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); - const gchar *folder_file_path, *folder_dir_path; - gint rmdir_error = 0; - gint unlink_error = 0; - gboolean folder_already_exists; - - /* check if the folder object exists */ - if (!folder) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_NULL, - "folder object is NULL"); - return FALSE; - } - - - /* in the case where the folder does not exist, - return immediatly */ - folder_already_exists = camel_folder_exists (folder, ex); - if (camel_exception_get_id (ex)) return FALSE; - - if (!folder_already_exists) return TRUE; - - - /* call default implementation. - It should delete the messages in the folder - and recurse the operation to subfolders */ - parent_class->delete (folder, recurse, ex); - - - /* get the paths of what we need to be deleted */ - folder_file_path = mbox_folder->folder_file_path; - folder_dir_path = mbox_folder->folder_file_path; - - if (!(folder_file_path || folder_dir_path)) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID, - "invalid folder path. Use set_name ?"); - return FALSE; - } - - - /* physically delete the directory */ - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::delete removing directory %s\n", folder_dir_path); - rmdir_error = rmdir (folder_dir_path); - if (rmdir_error == -1) - switch errno { - case EACCES : - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "Not enough permission to delete the mbox folder"); - return FALSE; - break; - - case ENOTEMPTY : - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_NON_EMPTY, - "mbox folder not empty. Cannot delete it. Maybe use recurse flag ?"); - return FALSE; - break; - default : - camel_exception_set (ex, - CAMEL_EXCEPTION_SYSTEM, - "Unable to delete the mbox folder."); - return FALSE; - } - - /* physically delete the file */ - unlink_error = unlink (folder_dir_path); - if (unlink_error == -1) - switch errno { - case EACCES : - case EPERM : - case EROFS : - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "Not enough permission to delete the mbox file"); - return FALSE; - break; - - case EFAULT : - case ENOENT : - case ENOTDIR : - case EISDIR : - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID_PATH, - "Invalid mbox file"); - return FALSE; - break; - - default : - camel_exception_set (ex, - CAMEL_EXCEPTION_SYSTEM, - "Unable to delete the mbox folder."); - return FALSE; - } - - - return TRUE; -} - - - - -gboolean -_delete_messages (CamelFolder *folder, CamelException *ex) -{ - - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); - const gchar *folder_file_path; - gboolean folder_already_exists; - int creat_fd; - mode_t old_umask; - - - /* check if the folder object exists */ - if (!folder) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_NULL, - "folder object is NULL"); - return FALSE; - } - - /* in the case where the folder does not exist, - return immediatly */ - folder_already_exists = camel_folder_exists (folder, ex); - if (camel_exception_get_id (ex)) return FALSE; - - if (!folder_already_exists) return TRUE; - - - - /* get the paths of the mbox file we need to delete */ - folder_file_path = mbox_folder->folder_file_path; - - if (!folder_file_path) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID, - "invalid folder path. Use set_name ?"); - return FALSE; - } - - - /* create the mbox file */ - /* it must be rw for the user and none for the others */ - old_umask = umask (0700); - creat_fd = open (folder_file_path, - O_WRONLY | O_TRUNC, - S_IRUSR | S_IWUSR); - umask (old_umask); - if (creat_fd == -1) goto io_error; - close (creat_fd); - - return TRUE; - - /* exception handling for io errors */ - io_error : - - CAMEL_LOG_WARNING ("CamelMboxFolder::create, error when deleting files %s\n", - folder_file_path); - CAMEL_LOG_FULL_DEBUG ( " Full error text is : %s\n", strerror(errno)); - - if (errno == EACCES) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "You don't have the permission to write in the mbox file."); - return FALSE; - } else { - camel_exception_set (ex, - CAMEL_EXCEPTION_SYSTEM, - "Unable to write in the mbox file."); - return FALSE; - } - - -} - - - - - - - - - -static GList * -_list_subfolders (CamelFolder *folder, CamelException *ex) -{ - GList *subfolder_name_list = NULL; - - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); - const gchar *folder_dir_path; - gboolean folder_exists; - - struct stat stat_buf; - gint stat_error = 0; - //GList *file_list; - gchar *entry_name; - gchar *full_entry_name; - gchar *real_folder_name; - struct dirent *dir_entry; - DIR *dir_handle; - gboolean folder_suffix_found; - - //gchar *io_error_text; - - - - /* check if the folder object exists */ - if (!folder) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_NULL, - "folder object is NULL"); - return FALSE; - } - - - /* in the case the folder does not exist, - raise an exception */ - folder_exists = camel_folder_exists (folder, ex); - if (camel_exception_get_id (ex)) return FALSE; - - if (!folder_exists) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID, - "Inexistant folder."); - return FALSE; - } - - - /* get the mbox subfolders directories */ - folder_dir_path = mbox_folder->folder_file_path; - if (!folder_dir_path) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INVALID, - "Invalid folder path. Use set_name ?"); - return FALSE; - } - - - dir_handle = opendir (folder_dir_path); - - /* read the first entry in the directory */ - dir_entry = readdir (dir_handle); - while ((stat_error != -1) && (dir_entry != NULL)) { - - /* get the name of the next entry in the dir */ - entry_name = dir_entry->d_name; - full_entry_name = g_strdup_printf ("%s/%s", folder_dir_path, entry_name); - stat_error = stat (full_entry_name, &stat_buf); - g_free (full_entry_name); - - /* is it a directory ? */ - if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) { - /* yes, add it to the list */ - if (entry_name[0] != '.') { - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::list_subfolders adding " - "%s\n", entry_name); - - /* if the folder is a netscape folder, remove the - ".sdb" from the name */ - real_folder_name = string_prefix (entry_name, ".sdb", &folder_suffix_found); - /* stick here the tests for other folder suffixes if any */ - - if (!folder_suffix_found) real_folder_name = g_strdup (entry_name); - - /* add the folder name to the list */ - subfolder_name_list = g_list_append (subfolder_name_list, - real_folder_name); - } - } - /* read next entry */ - dir_entry = readdir (dir_handle); - } - - closedir (dir_handle); - - return subfolder_name_list; - - - - /* io exception handling */ - switch errno { - case EACCES : - - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "Unable to list the directory. Full Error text is : %s ", - strerror (errno)); - break; - - case ENOENT : - case ENOTDIR : - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INVALID_PATH, - "Invalid mbox folder path. Full Error text is : %s ", - strerror (errno)); - break; - - default : - camel_exception_set (ex, - CAMEL_EXCEPTION_SYSTEM, - "Unable to delete the mbox folder."); - - } - - g_list_free (subfolder_name_list); - return NULL; -} - - - - -static gint -_get_message_count (CamelFolder *folder, CamelException *ex) -{ - - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); - gint message_count; - - g_assert (folder); - g_assert (mbox_folder->internal_summary); - - message_count = mbox_folder->internal_summary->nb_message; - - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::get_message_count found %d messages\n", message_count); - return message_count; -} - - -static void -_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex) -{ - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); - //guint new_msg_number; - CamelStream *output_stream; - guint32 tmp_file_size; - guint32 next_uid; - gint tmp_file_fd; - GArray *message_info_array; - GArray *mbox_summary_info; - gchar *tmp_message_filename; - gint fd1, fd2; - - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::append_message\n"); - - tmp_message_filename = g_strdup_printf ("%s.tmp", mbox_folder->folder_file_path); - /* write the message itself */ - output_stream = camel_stream_fs_new_with_name (tmp_message_filename, CAMEL_STREAM_FS_WRITE); - if (output_stream != NULL) { - camel_stream_write_string (output_stream, "From - \n"); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), output_stream); - } - camel_stream_close (output_stream); - - /* at this point we have saved the message to a - temporary file, now, we have to add the x-evolution - field and also update the main summary summary */ - - /* - First : parse the mbox file, but only from the - position where the message has been added, - wich happens to be the last postion in the - mbox file before we added the message. - This position is still stored in the summary - for the moment - */ - next_uid = mbox_folder->internal_summary->next_uid; - tmp_file_fd = open (tmp_message_filename, O_RDONLY); - message_info_array = camel_mbox_parse_file (tmp_file_fd, - "From - ", - 0, - &tmp_file_size, - &next_uid, - TRUE, - NULL, - 0, - ex); - - close (tmp_file_fd); - - /* get the value of the last available UID - as saved in the summary file */ - next_uid = mbox_folder->internal_summary->next_uid; - - /* - OK, this is not very efficient, we should not use the same - method as for parsing an entire mail file, - but I have no time to write a simpler parser - */ - next_uid = camel_mbox_write_xev (tmp_message_filename, - message_info_array, &tmp_file_size, next_uid, ex); - - if (camel_exception_get_id (ex)) { - /* ** FIXME : free the preparsed information */ - return; - } - - mbox_summary_info = - parsed_information_to_mbox_summary (message_info_array); - - - - - /* store the number of messages as well as the summary array */ - mbox_folder->internal_summary->nb_message += 1; - mbox_folder->internal_summary->next_uid = next_uid; - - ((CamelMboxSummaryInformation *)(mbox_summary_info->data))->position += mbox_folder->internal_summary->mbox_file_size; - mbox_folder->internal_summary->mbox_file_size += tmp_file_size; - - camel_mbox_summary_append_entries (mbox_folder->internal_summary, mbox_summary_info); - - /* append the new entry of the internal summary to - the external summary */ - camel_mbox_summary_append_internal_to_external (mbox_folder->internal_summary, - folder->summary, - mbox_folder->internal_summary->nb_message-1); - - g_array_free (mbox_summary_info, TRUE); - - - /* append the temporary file message to the mbox file */ - fd1 = open (tmp_message_filename, O_RDONLY); - fd2 = open (mbox_folder->folder_file_path, - O_WRONLY | O_CREAT | O_APPEND, - S_IRUSR | S_IWUSR); - - if (fd2 == -1) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not open the mbox folder file for appending the message\n" - "\t%s\n" - "Full error is : %s\n", - mbox_folder->folder_file_path, - strerror (errno)); - return; - } - - camel_mbox_copy_file_chunk (fd1, - fd2, - tmp_file_size, - ex); - close (fd1); - close (fd2); - - /* remove the temporary file */ - unlink (tmp_message_filename); - - /* generate the folder md5 signature */ - md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->internal_summary->md5_digest); - - - g_free (tmp_message_filename); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::append_message\n"); -} - - - - -static GList * -_get_uid_list (CamelFolder *folder, CamelException *ex) -{ - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); - GArray *message_info_array; - CamelMboxSummaryInformation *message_info; - GList *uid_list = NULL; - int i; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::get_uid_list\n"); - - message_info_array = mbox_folder->internal_summary->message_info; - - for (i=0; ilen; i++) { - - message_info = (CamelMboxSummaryInformation *)(message_info_array->data) + i; - uid_list = g_list_prepend (uid_list, g_strdup_printf ("%u", message_info->uid)); - } - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n"); - - return uid_list; -} - - - - - - - - -static CamelMimeMessage * -_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex) -{ - - CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(folder); - GArray *message_info_array; - CamelMboxSummaryInformation *message_info; - guint32 searched_uid; - int i; - gboolean uid_found; - CamelStream *message_stream; - CamelMimeMessage *message = NULL; - CamelStore *parent_store; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::get_uid_list\n"); - - searched_uid = strtoul(uid, (char **)NULL, 10); - - message_info_array = mbox_folder->internal_summary->message_info; - i=0; - uid_found = FALSE; - - /* first, look for the message that has the searched uid */ - while ((ilen) && (!uid_found)) { - message_info = (CamelMboxSummaryInformation *)(message_info_array->data) + i; - uid_found = (message_info->uid == searched_uid); - i++; - } - - /* if the uid was not found, raise an exception and return */ - if (!uid_found) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INVALID_UID, - "uid %s not found in the folder", - uid); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n"); - return NULL; - } - - /* at this point, the message_info structure - contains the informations concerning the - message that was searched for */ - - /* create a stream bound to the message */ - message_stream = camel_stream_fs_new_with_name_and_bounds (mbox_folder->folder_file_path, - CAMEL_STREAM_FS_READ, - message_info->position, - message_info->position + message_info->size); - - - /* get the parent store */ - parent_store = camel_folder_get_parent_store (folder, ex); - if (camel_exception_get_id (ex)) { - gtk_object_unref (GTK_OBJECT (message_stream)); - return NULL; - } - - - message = camel_mime_message_new_with_session (camel_service_get_session (CAMEL_SERVICE (parent_store))); - camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message), message_stream); - - - - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxFolder::get_uid_list\n"); - return message; -} - -static GList * -search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex) -{ - return camel_mbox_folder_search_by_expression(folder, expression, ex); -} diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h deleted file mode 100644 index 76288d5c3c..0000000000 --- a/camel/providers/mbox/camel-mbox-folder.h +++ /dev/null @@ -1,83 +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 */ - -/* - * - * Author : Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code . - * - * 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 -#include "camel-folder.h" -#include "camel-mbox-summary.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; - - CamelFolderSummary *external_summary; - /* the external summary is intended to be read by callers */ - - gchar *folder_file_path; /* contains the messages */ - gchar *summary_file_path; /* contains the messages summary */ - gchar *folder_dir_path; /* contains the subfolders */ - gchar *index_file_path; /* index of body contents */ - - CamelMboxSummary *internal_summary; /* internal summary object */ - GList *uid_array; - -} CamelMboxFolder; - - - -typedef struct { - CamelFolderClass parent_class; - - /* Virtual methods */ - -} CamelMboxFolderClass; - - -/* public methods */ - -/* Standard Gtk function */ -GtkType camel_mbox_folder_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_MBOX_FOLDER_H */ diff --git a/camel/providers/mbox/camel-mbox-parser.c b/camel/providers/mbox/camel-mbox-parser.c deleted file mode 100644 index d730c07aa6..0000000000 --- a/camel/providers/mbox/camel-mbox-parser.c +++ /dev/null @@ -1,901 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-mbox-parser.c : mbox folder parser */ - -/* - * - * Author : Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code . - * - * 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 -#include "camel-mbox-parser.h" -#include "camel-mbox-utils.h" -#include "camel-log.h" -#include "camel-exception.h" -#include -#include -#include -#include -#include -#include - - - -#define MBOX_PARSER_BUF_SIZE 10000 - -#define MBOX_PARSER_FROM_KW "from:" -#define MBOX_PARSER_FROM_KW_SZ 5 - -#define MBOX_PARSER_DATE_KW "date:" -#define MBOX_PARSER_DATE_KW_SZ 5 - -#define MBOX_PARSER_SUBJECT_KW "subject:" -#define MBOX_PARSER_SUBJECT_KW_SZ 8 - -#define MBOX_PARSER_TO_KW "to:" -#define MBOX_PARSER_TO_KW_SZ 3 - -#define MBOX_PARSER_X_EVOLUTION_KW "x-evolution:" -#define MBOX_PARSER_X_EVOLUTION_KW_SZ 12 - -/* the maximum lentgh of all the previous keywords */ -#define MBOX_PARSER_MAX_KW_SIZE 12 - - -#define MBOX_PARSER_SUMMARY_SIZE 150 - - - - - - -typedef struct { - - int fd; /* file descriptor of the mbox file */ - glong real_position; /* real position in the file */ - - - gchar *message_delimiter; /* message delimiter string */ - guint message_delimiter_length; - - guint message_summary_size; /* how many characters from the begining of the - mail to put into the message summary */ - - GArray *preparsed_messages; /* array of MessagePreParsingInfo */ - CamelMboxParserMessageInfo current_message_info; /* used to store curent info */ - gboolean is_pending_message; /* is there some message information pending ? */ - - /* buffer info */ - gchar *buffer; /* temporary buffer */ - guint left_chunk_size; /* size of the left chunk in the temp buffer */ - guint last_position; /* last position that can be compared to a keyword */ - guint current_position; /* current position in the temp buffer */ - - /* other */ - GString *tmp_string; /* temporary string to fill the headers in */ - - - -} CamelMboxPreParser; - - -/* clear a preparsing info structure */ -static void -clear_message_info (CamelMboxParserMessageInfo *preparsing_info) -{ - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::clear_message_info\n"); - - preparsing_info->message_position = 0; - preparsing_info->size = 0; - preparsing_info->from = NULL; - preparsing_info->date = NULL; - preparsing_info->subject = NULL; - preparsing_info->priority = NULL; - preparsing_info->references = NULL; - preparsing_info->body_summary = NULL; - preparsing_info->end_of_headers_offset = 0; - - preparsing_info->x_evolution_offset = 0; - preparsing_info->status = 0; - preparsing_info->uid = 0; - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::clear_message_info\n"); -} - - - -/** - * new_parser: create a new parser object - * @fd: file descriptor opened on the mbox file - * @message_delimiter: the string that announce the start of a new message. - * - * Create a new parser object. This object is the place where are - * stored all the information concerning the parsing process. - * - * Return value: The newly created parser object. - **/ -static CamelMboxPreParser * -new_parser (int fd, - const gchar *message_delimiter) -{ - CamelMboxPreParser *parser; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::ew_parser\n"); - - parser = g_new0 (CamelMboxPreParser, 1); - - parser->fd = fd; - parser->buffer = g_new (gchar, MBOX_PARSER_BUF_SIZE); - parser->current_position = 0; - parser->message_delimiter = g_strdup (message_delimiter); - parser->message_delimiter_length = strlen (message_delimiter); - parser->real_position = 0; - parser->preparsed_messages = g_array_new (FALSE, FALSE, sizeof (CamelMboxParserMessageInfo)); - parser->message_summary_size = MBOX_PARSER_SUMMARY_SIZE; - - parser->left_chunk_size = MAX (parser->message_delimiter_length, MBOX_PARSER_MAX_KW_SIZE); - - parser->tmp_string = g_string_sized_new (1000); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::ew_parser\n"); - - return parser; -} - - - -/** - * parser_free: free the parser object - * @parser: the parser objet to free. - * - * it is important to notice that all structures allocated - * in new_parser () are freed ** EXCEPT ** the message - * information array, i.e. the preparsed_messages - * field. - **/ -static void -parser_free (CamelMboxPreParser *parser) -{ - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parser_free\n"); - - g_free (parser->buffer); - g_free (parser->message_delimiter); - g_string_free (parser->tmp_string, TRUE); - g_free (parser); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::parser_free\n"); -} - - - - -/* ** handle exceptions here */ -/** - * initialize_buffer: read the first chunk of data in the buffer - * @parser: parser object to fill - * @first_position: position to start the read at - * - * read the first chunk of data from the mbox file. - * - **/ -static void -initialize_buffer (CamelMboxPreParser *parser, - glong first_position) -{ - gint seek_res; - gint buf_nb_read; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::intialize_buffer\n"); - - g_assert (parser); - - /* set the search start position */ - seek_res = lseek (parser->fd, first_position, SEEK_SET); - //if (seek_res == (off_t)-1) goto io_error; - - - /* the first part of the buffer is filled with newlines, - but the next time a chunk of buffer is read, it will - be filled with the last bytes of the previous chunk. - This allows simple g_strcasecmp to test for the presence of - the keyword */ - memset (parser->buffer, '\n', parser->left_chunk_size); - do { - buf_nb_read = read (parser->fd, parser->buffer + parser->left_chunk_size, - MBOX_PARSER_BUF_SIZE - parser->left_chunk_size); - } while ((buf_nb_read == -1) && (errno == EINTR)); - /* ** check for an error here */ - - if (buf_nb_read < MBOX_PARSER_BUF_SIZE - parser->left_chunk_size) { - /* fill the end of the buffer with 0\ */ - memset (parser->buffer + buf_nb_read + parser->left_chunk_size, '\0', - MIN (parser->left_chunk_size, MBOX_PARSER_BUF_SIZE - buf_nb_read - parser->left_chunk_size)); - }; - - parser->last_position = MIN (buf_nb_read + parser->left_chunk_size + 1, - MBOX_PARSER_BUF_SIZE - parser->left_chunk_size); - parser->current_position = parser->left_chunk_size; - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n"); - -} - - - - -/** - * read_next_buffer_chunk: read the next chunk of data in the mbox file - * @parser: parser object - * - * read the next chunk of data in the mbox file. - * Routine copies the last part of the buffer at - * the begining are concatenate the read data to - * it. This allows strcmp of keywords in the buffer, - * until the last postion. That means you can - * do a strcmp (buffer, keyword) for any of the - * keyword defined at the begining of this file. - * - **/ -static void -read_next_buffer_chunk (CamelMboxPreParser *parser) -{ - gint buf_nb_read; - - g_assert (parser); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n"); - - /* read the next chunk of data in the folder file : */ - /* - first, copy the last bytes from the previous - chunk at the begining of the new one. */ - memcpy (parser->buffer, - parser->buffer + MBOX_PARSER_BUF_SIZE - parser->left_chunk_size, - parser->left_chunk_size); - - /* - then read the next chunk on disk */ - do { - buf_nb_read = read (parser->fd, - parser->buffer + parser->left_chunk_size, - MBOX_PARSER_BUF_SIZE - parser->left_chunk_size); - } while ((buf_nb_read == -1) && (errno == EINTR)); - /* ** check for an error here */ - - if (buf_nb_read < MBOX_PARSER_BUF_SIZE - parser->left_chunk_size) { - /* fill the end of the buffer with 0\ */ - memset (parser->buffer + buf_nb_read + parser->left_chunk_size, '\0', - MIN (parser->left_chunk_size, MBOX_PARSER_BUF_SIZE - buf_nb_read - parser->left_chunk_size)); - }; - - parser->last_position = MIN (buf_nb_read + parser->left_chunk_size + 1, - MBOX_PARSER_BUF_SIZE - parser->left_chunk_size); - - parser->current_position = 0; - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::intialize_buffer\n"); - -} - - - -/** - * goto_next_char: go one postion forward in the buffer - * @parser: parser object - * - * goto one position forward in the buffer. If necessary, - * read the next chunk of data in the file. - * - **/ -static void -goto_next_char (CamelMboxPreParser *parser) -{ - - if (parser->current_position < parser->last_position - 1) - parser->current_position++; - else - read_next_buffer_chunk (parser); - - parser->real_position++; - -} - - - - - - - -/** - * advance_n_chars: go n positions forward in the buffer. - * @parser: parser object - * @n: number of characters to advance. - * - **/ -static void -advance_n_chars (CamelMboxPreParser *parser, guint n) -{ - - gint position_to_the_end; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::advnce_n_chars\n"); - - position_to_the_end = parser->last_position - parser->current_position; - - if (n < position_to_the_end) - parser->current_position += n; - else { - read_next_buffer_chunk (parser); - parser->current_position = n - position_to_the_end; - } - - parser->real_position += n; - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::advance_n_chars\n"); -} - - - - - - -/* called when the buffer has detected the begining of - a new message. This routine is supposed to simply - store the previous message information and - clean the temporary structure used to store - the informations */ - - -/** - * new_message_detected: routine to call when a new message has been detected - * @parser: parser object. - * - * this routine must be called when the keyword determining the - * begining of a new message has been detected. It pushes the - * information fetched for the last message into the message information - * array. Also, it gets the parser to the end of the line. - **/ -static void -new_message_detected (CamelMboxPreParser *parser) -{ - - gchar c; - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::new_message_detected\n"); - - /* if we were filling a message information - save it in the message information array */ - - if (parser->is_pending_message) { - parser->current_message_info.size = - parser->real_position - parser->current_message_info.message_position; - g_array_append_vals (parser->preparsed_messages, (gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info), 1); - } - - clear_message_info ( &(parser->current_message_info)); - - /* go to the end of the line */ - do { - - c = parser->buffer[parser->current_position]; - goto_next_char (parser); - - } while (c != '\n'); - - /* save message position in the message information structure */ - (parser->current_message_info).message_position = parser->real_position; - - parser->is_pending_message = TRUE; - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::new_message_detected\n"); -} - - - - - - - -/** - * read_header: read the header content contained after the current position. - * @parser: the parser object. - * @header_content: a pointer on a (char *) variable to feed with the obtained header string. - * - * This routine must be called when the parser has detected a header - * and it wants the header content to be stored. The parser current position - * must EXACTLY be located at the begining of the header content line. - * For example, if the file contains the line : - * from:Bertrand Guiheneuf - * - * When this routine is called, the parser must be located - * on the "B" of "Bertrand". - * - * When this routine returns, the parser is located just - * after the "\n" at the end of the header content. - * - **/ -static void -read_header (CamelMboxPreParser *parser, gchar **header_content) -{ - gboolean space = FALSE; - gboolean newline = FALSE; - gboolean header_end = FALSE; - gchar *buffer; - gchar c; - - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::read_header\n"); - - g_assert (parser); - - /* reset the header buffer string */ - parser->tmp_string = g_string_truncate (parser->tmp_string, 0); - - buffer = parser->buffer; - - /* read the current character */ - c = buffer[parser->current_position]; - - while (! ((c == '\0') || header_end )) { - - if (space) { - if (c == ' ' && c == '\t') - goto next_char; - else - space = FALSE; - } - - if (newline) { - if (c == ' ' && c == '\t') { - - space = TRUE; - newline = FALSE; - goto next_char; - } else { - - header_end = TRUE; - continue; - } - } - - if (c == '\n') { - newline = TRUE; - goto next_char; - } - - /* feed the header content */ - parser->tmp_string = g_string_append_c (parser->tmp_string, c); - - next_char: /* read next char in the buffer */ - goto_next_char (parser); - /* read the current character */ - c = buffer[parser->current_position]; - } - - - /* copy the buffer in the preparsing information structure */ - *header_content = g_strndup (parser->tmp_string->str, parser->tmp_string->len); - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::read_header\n"); - -} - - - - - - - -/** - * read_message_begining: read the first characters of a message body - * @parser: parser object - * @message_summary: a pointer on a (gchar *) variable where the obtained string will be stored. - * - * Read the first lines of a message. When calling this routine, the - * parser must be located at the begining of the message body. - * - * Return value: if the parsing inside this routine last read a newline, then %TRUE is returned, otherwise %FALSE is returned - **/ -static gboolean -read_message_begining (CamelMboxPreParser *parser, gchar **message_summary) -{ - guint nb_read = 0; - gchar *buffer; - gboolean new_message = FALSE; - guint nb_line = 0; - g_assert (parser); - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::read_message_begining\n"); - - /* reset the header buffer string */ - parser->tmp_string = g_string_truncate (parser->tmp_string, 0); - - buffer = parser->buffer; - /* the message should not be filled character by - character but there is no g_string_n_append - function, so for the moment, this is a lazy - implementation */ - while (! (buffer[parser->current_position] != '\0') && - (nb_line <2) && (nb_readmessage_summary_size) && - (!new_message)) { - - - /* test if we are not at the end of the message */ - if (buffer[parser->current_position] == '\n') { - - nb_line++; - goto_next_char (parser); - if ((buffer[parser->current_position] == '\0') || - (g_strncasecmp (parser->buffer + parser->current_position, - parser->message_delimiter, - parser->message_delimiter_length) == 0)) { - new_message = TRUE; - continue; - } else { - /* we're not at the end, so let's just add the cr to the summary */ - parser->tmp_string = g_string_append_c (parser->tmp_string, - '\n'); - nb_read++; - continue; - } - - - } - - parser->tmp_string = g_string_append_c (parser->tmp_string, - buffer[parser->current_position]); - nb_read++; - goto_next_char (parser); - } - - *message_summary = g_strndup (parser->tmp_string->str, parser->tmp_string->len); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxParser::read_message_begining\n"); - - return new_message; -} - - - - - - - - - - -/** - * camel_mbox_parse_file: read an mbox file and parse it. - * @fd: file descriptor opened on the mbox file. - * @message_delimiter: character string delimiting the beginig of a new message - * @start_position: poition in the file where to start the parsing. - * @get_message_summary: should the parser retrieve the begining of the messages - * @status_callback: function to call peridically to indicate the progress of the parser - * @status_interval: floating value between 0 and 1 indicate how often to call @status_callback. - * @user_data: user data that will be passed to the callback function - * - * This routine parses an mbox file and retreives both the message starting positions and - * some of the informations contained in the message. Those informations are mainly - * some RFC822 headers values but also (optionally) the first characters of the mail - * body. The @get_message_summary parameter allows to enable or disable this option. - * - * - * Return value: An array of CamelMboxParserMessageInfo containing the informations on each message parsed in the file - **/ -GArray * -camel_mbox_parse_file (int fd, - const gchar *message_delimiter, - glong start_position, - guint32 *file_size, - guint32 *next_uid, - gboolean get_message_summary, - camel_mbox_preparser_status_callback *status_callback, - double status_interval, - gpointer user_data) -{ - CamelMboxPreParser *parser; - gboolean is_parsing_a_message = FALSE; - gchar c; - struct stat stat_buf; - gint fstat_result; - glong total_file_size; - int last_status = 0; - int real_interval; - gboolean newline; - GArray *return_value; - gchar *x_ev_header_content; - guint32 next_available_uid = 1; - - - g_assert (next_uid); - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parse_file\n"); - - /* get file size */ - fstat_result = fstat (fd, &stat_buf); - if (fstat_result == -1) { - g_warning ("Manage exception here \n"); - } - - total_file_size = stat_buf.st_size; - real_interval = status_interval * total_file_size; - - - /* create the parser */ - parser = new_parser (fd, message_delimiter); - - /* initialize the temporary char buffer */ - initialize_buffer (parser, start_position); - - /* the first line is indeed at the begining of a new line ... */ - newline = TRUE; - - while (parser->buffer[parser->current_position] != '\0') { - - - - - /* read the current character */ - if (!newline) { - c = parser->buffer[parser->current_position]; - newline = (c == '\n'); - goto_next_char (parser); - } - - if (newline) { - - /* check if we reached a status milestone */ - if ( status_callback && ((parser->real_position - last_status) > real_interval)) { - last_status += real_interval; - status_callback ((double)last_status / (double)total_file_size, - user_data); - } - - /* is the next part a message delimiter ? */ - if (strncmp (parser->buffer + parser->current_position, - parser->message_delimiter, - parser->message_delimiter_length) == 0) { - - is_parsing_a_message = TRUE; - new_message_detected (parser); - newline = TRUE; - continue; - } - - - if (is_parsing_a_message) { - /* we could find the headers in a clever way, like - storing them in a list of pair - [keyword, offset_in_CamelMboxParserMessageInfo] - I am too busy for now. Contribution welcome */ - - /* is the next part a "from" header ? */ - if (g_strncasecmp (parser->buffer + parser->current_position, - MBOX_PARSER_FROM_KW, - MBOX_PARSER_FROM_KW_SZ) == 0) { - - advance_n_chars (parser, MBOX_PARSER_FROM_KW_SZ); - read_header (parser, (gchar **) ((gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + - G_STRUCT_OFFSET (CamelMboxParserMessageInfo, from))); - - newline = TRUE; - continue; - } - - /* is the next part a "Date" header ? */ - if (g_strncasecmp (parser->buffer + parser->current_position, - MBOX_PARSER_DATE_KW, - MBOX_PARSER_DATE_KW_SZ) == 0) { - - advance_n_chars (parser, MBOX_PARSER_DATE_KW_SZ); - read_header (parser, (gchar **) ((gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + - G_STRUCT_OFFSET (CamelMboxParserMessageInfo, date))); - - newline = TRUE; - continue; - } - - - /* is the next part a "Subject" header ? */ - if (g_strncasecmp (parser->buffer + parser->current_position, - MBOX_PARSER_SUBJECT_KW, - MBOX_PARSER_SUBJECT_KW_SZ) == 0) { - - advance_n_chars (parser, MBOX_PARSER_SUBJECT_KW_SZ); - read_header (parser, (gchar **) ((gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + - G_STRUCT_OFFSET (CamelMboxParserMessageInfo, subject))); - - newline = TRUE; - continue; - } - - - /* is the next part a "To" header ? */ - if (g_strncasecmp (parser->buffer + parser->current_position, - MBOX_PARSER_TO_KW, - MBOX_PARSER_TO_KW_SZ) == 0) { - - advance_n_chars (parser, MBOX_PARSER_TO_KW_SZ); - read_header (parser, (gchar **) ((gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + - G_STRUCT_OFFSET (CamelMboxParserMessageInfo, to))); - - newline = TRUE; - continue; - } - - - /* is the next part a "X-evolution" header ? */ - if (g_strncasecmp (parser->buffer + parser->current_position, - MBOX_PARSER_X_EVOLUTION_KW, - MBOX_PARSER_X_EVOLUTION_KW_SZ) == 0) { - - /* in the case of the evolution private field, we store - the field position as well as its length because - we will have to change them */ - parser->current_message_info.x_evolution_offset = parser->real_position - - parser->current_message_info.message_position; - advance_n_chars (parser, MBOX_PARSER_X_EVOLUTION_KW_SZ); - - /* read the header */ - read_header (parser, &x_ev_header_content); - - /* parse it and put the result in the uid and status fields */ - camel_mbox_xev_parse_header_content (x_ev_header_content, - (guint32 *) ((gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + - G_STRUCT_OFFSET (CamelMboxParserMessageInfo, uid)), - (guchar *) ((gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + - G_STRUCT_OFFSET (CamelMboxParserMessageInfo, status))); - g_free (x_ev_header_content); - next_available_uid = MAX (next_available_uid, parser->current_message_info.uid); - - newline = TRUE; - continue; - } - - - - - /* is it an empty line ? */ - if (parser->buffer[parser->current_position] == '\n') { - - parser->current_message_info.end_of_headers_offset = - parser->real_position - parser->current_message_info.message_position; - - goto_next_char (parser); - if (get_message_summary) - newline = read_message_begining (parser, (gchar **) ((gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info) + - G_STRUCT_OFFSET (CamelMboxParserMessageInfo, body_summary))); - - is_parsing_a_message = FALSE; - continue; - } - } - newline = FALSE; - } - - } - - /* if there is a pending message information put it in the array */ - if (parser->is_pending_message) { - parser->current_message_info.size = - parser->real_position - parser->current_message_info.message_position; - g_array_append_vals (parser->preparsed_messages, (gchar *)parser + - G_STRUCT_OFFSET (CamelMboxPreParser, current_message_info), 1); - } - - return_value = parser->preparsed_messages; - *file_size = parser->real_position; - *next_uid = next_available_uid; - /* free the parser */ - parser_free (parser); - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxParser::parse_file\n"); - - return return_value; -} - - - - - - - - - - -#ifdef MBOX_PARSER_TEST -/* to build the test : - - gcc -O3 -I/opt/gnome/lib/glib/include `glib-config --cflags` -o test_parser -DMBOX_PARSER_TEST -I ../.. -I ../../.. -I /usr/lib/glib/include camel-mbox-parser.c `glib-config --libs` -lm - - - */ - - -#include - -static void -status (double done, gpointer user_data) -{ - printf ("%d %% done\n", (int)floor (done * 100)); -} -int -main (int argc, char **argv) -{ - int test_file_fd; - int i; - int file_size; - int next_uid; - GArray *message_positions; - CamelMboxParserMessageInfo *message_info; - gchar tmp_buffer[50]; - - tmp_buffer[49] = '\0'; - - if (argc<2) { - printf("usage: %s mbox\n", argv[0]); - return 1; - } - - test_file_fd = open (argv[1], O_RDONLY); - message_positions = camel_mbox_parse_file (test_file_fd, - "From ", - 0, - &file_size, - &next_uid, - TRUE, - status, - 0.05, - NULL); - - printf ("Found %d messages \n", message_positions->len); - - - for (i=0; ilen; i++) { - - message_info = ((CamelMboxParserMessageInfo *)(message_positions->data)) + i; - printf ("\n\n** Message %d : \n", i); - printf ("Size : %d\n", message_info->size); - printf ("From: %s\n", message_info->from); - printf ("Date: %s\n", message_info->date); - printf ("Subject: %s\n", message_info->subject); - printf ("Summary: %s\n", message_info->body_summary) ; - - - lseek (test_file_fd, message_info->message_position, SEEK_SET); - read (test_file_fd, tmp_buffer, 49); - printf ("File content at position %d : \n===\n%s\n===\n", message_info->message_position, tmp_buffer); - - } - - - - return 0; -} - - - - -#endif /* MBOX_PARSER_TEST */ diff --git a/camel/providers/mbox/camel-mbox-parser.h b/camel/providers/mbox/camel-mbox-parser.h deleted file mode 100644 index 1c49ea55c6..0000000000 --- a/camel/providers/mbox/camel-mbox-parser.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-mbox-parser.c : mbox folder parser */ - -/* - * - * Author : Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code . - * - * 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 -#include "camel-log.h" -#include "camel-exception.h" - - -typedef struct { - - glong message_position; - glong size; - - gchar *from; - gchar *to; - gchar *date; - gchar *subject; - gchar *priority; - gchar *references; - gchar *body_summary; - gshort end_of_headers_offset; - - gchar *x_evolution; - gshort x_evolution_offset; - guint32 uid; - guchar status; - -} CamelMboxParserMessageInfo; - - -typedef void camel_mbox_preparser_status_callback (double percentage_done, gpointer user_data); - - -GArray * -camel_mbox_parse_file (int fd, - const gchar *message_delimiter, - glong start_position, - guint32 *file_size, - guint32 *next_uid, - gboolean get_message_summary, - camel_mbox_preparser_status_callback *status_callback, - double status_interval, - gpointer user_data); - diff --git a/camel/providers/mbox/camel-mbox-provider.c b/camel/providers/mbox/camel-mbox-provider.c deleted file mode 100644 index a63d832d5d..0000000000 --- a/camel/providers/mbox/camel-mbox-provider.c +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-mbox-provider.c: mbox provider registration code */ - -/* - * Authors : - * Bertrand Guiheneuf - * - * Copyright (C) 2000 HelixCode (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-mbox-store.h" -#include "camel-provider.h" -#include "camel-log.h" - - -static CamelProvider _mbox_provider = { - (GtkType) 0, - PROVIDER_STORE, - "mbox", - "Camel default mbox provider", - "This the first full fledged local mail provider", - (GModule *) NULL -}; - -CamelProvider * -camel_provider_module_init (void); - - -CamelProvider * -camel_provider_module_init (void) -{ - _mbox_provider.object_type = camel_mbox_store_get_type(); - return &_mbox_provider; -} - - - diff --git a/camel/providers/mbox/camel-mbox-search.c b/camel/providers/mbox/camel-mbox-search.c deleted file mode 100644 index 70dac7741a..0000000000 --- a/camel/providers/mbox/camel-mbox-search.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright 2000 HelixCode (http://www.helixcode.com). - * - * Author : - * Michael Zucchi - - * 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 -#include -#include -#include - - -#include -#include -#include "camel/camel-folder-summary.h" -#include "camel/camel-mime-message.h" -#include "camel/camel-mime-part.h" -#include "camel/camel-stream.h" -#include "camel/camel-stream-fs.h" -#include "camel/camel.h" -#include "camel-mbox-folder.h" - -#include "camel-mbox-search.h" -/* #define HAVE_FILTER */ -#ifdef HAVE_FILTER -#include "filter-sexp.h" - -#define HAVE_IBEX -#ifdef HAVE_IBEX -#include "ibex.h" -#endif - -#define p(x) /* parse debug */ -#define r(x) /* run debug */ -#define d(x) /* general debug */ - - -/* - - Matching operators: - - list = (body-contains string+) - bool = (body-contains string+) - Returns a list of all messages containing any of the strings in the message. - If within a match-all, then returns true for the current message. - - list = (match-all bool-expr) - Returns a list of all messages for which the bool expression is true. - The bool-expr is evaluated for each message in turn. - It is more efficient not to perform body-content comparisons inside a - match-all operator. - - int = (date-sent) - Returns a time_t of the date-sent of the message. - - bool = (header-contains string string+) - Returns true if the current message (inside a match-all operator) - has a header 'string1', which contains any of the following strings. -*/ - - -struct _searchcontext { - int whatever; - - CamelFolder *folder; - -#ifdef HAVE_IBEX - ibex *index; /* index of content for this folder */ -#endif - - CamelFolderSummary *summary; - const GArray *message_info; - - CamelMessageInfo *message_current; /* when performing a (match operation */ -}; - -struct _glib_sux_donkeys { - int count; - GPtrArray *uids; -}; -/* or, store all unique values */ -static void -g_lib_sux_htor(char *key, int value, struct _glib_sux_donkeys *fuckup) -{ - g_ptr_array_add(fuckup->uids, key); -} - -static FilterSEXPResult * -func_body_contains(struct _FilterSEXP *f, int argc, struct _FilterSEXPResult **argv, void *data) -{ - FilterSEXPResult *r; - int i, j; - struct _searchcontext *ctx = data; - - if (ctx->message_current) { - int truth = FALSE; - - r = filter_sexp_result_new(FSEXP_RES_BOOL); - if (ctx->index) { - for (i=0;itype == FSEXP_RES_STRING) { - truth = ibex_find_name(ctx->index, ctx->message_current->uid, argv[i]->value.string); - } else { - g_warning("Invalid type passed to body-contains match function"); - } - } - } else { - g_warning("Cannot perform indexed query with no index"); - } - r->value.bool = truth; - } else { - r = filter_sexp_result_new(FSEXP_RES_ARRAY_PTR); - - if (ctx->index) { - if (argc==1) { - /* common case */ - r->value.ptrarray = ibex_find(ctx->index, argv[0]->value.string); - } else { - GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal); - GPtrArray *pa; - struct _glib_sux_donkeys lambdafoo; - - /* this sux, perform an or operation on the result(s) of each word */ - for (i=0;itype == FSEXP_RES_STRING) { - pa = ibex_find(ctx->index, argv[i]->value.string); - for (j=0;jlen;j++) { - g_hash_table_insert(ht, g_ptr_array_index(pa, j), (void *)1); - } - g_ptr_array_free(pa, FALSE); - } - } - lambdafoo.uids = g_ptr_array_new(); - g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htor, &lambdafoo); - r->value.ptrarray = lambdafoo.uids; - } - } else { - r->value.ptrarray = g_ptr_array_new(); - } - } - - return r; -} - -static FilterSEXPResult * -func_date_sent(struct _FilterSEXP *f, int argc, struct _FilterSEXPResult **argv, void *data) -{ - FilterSEXPResult *r; - struct _searchcontext *ctx = data; - - r = filter_sexp_result_new(FSEXP_RES_INT); - - if (ctx->message_current) { - g_warning("FIXME: implement date parsing ..."); - /* r->value.number = get_date(ctx->message_current); */ - } else { - r->value.number = time(0); - } - return r; -} - - -static FilterSEXPResult * -func_match_all(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - int i; - FilterSEXPResult *r, *r1; - struct _searchcontext *ctx = data; - - if (argc>1) { - g_warning("match-all only takes a single argument, other arguments ignored"); - } - r = filter_sexp_result_new(FSEXP_RES_ARRAY_PTR); - r->value.ptrarray = g_ptr_array_new(); - - for (i=0;imessage_info->len;i++) { - if (argc>0) { - ctx->message_current = &g_array_index(ctx->message_info, CamelMessageInfo, i); - r1 = filter_sexp_term_eval(f, argv[0]); - if (r1->type == FSEXP_RES_BOOL) { - if (r1->value.bool) - g_ptr_array_add(r->value.ptrarray, ctx->message_current->uid); - } else { - g_warning("invalid syntax, matches require a single bool result"); - } - filter_sexp_result_free(r1); - } else { - g_ptr_array_add(r->value.ptrarray, ctx->message_current->uid); - } - } - ctx->message_current = NULL; - - return r; -} - -static FilterSEXPResult * -func_header_contains(struct _FilterSEXP *f, int argc, struct _FilterSEXPResult **argv, void *data) -{ - FilterSEXPResult *r; - struct _searchcontext *ctx = data; - int truth = FALSE; - - r(printf("executing header-contains\n")); - - /* are we inside a match-all? */ - if (ctx->message_current && argc>1 - && argv[0]->type == FSEXP_RES_STRING) { - char *headername, *header; - int i; - - /* only a subset of headers are supported .. */ - headername = argv[0]->value.string; - if (!strcasecmp(headername, "subject")) { - header = ctx->message_current->subject; - } else if (!strcasecmp(headername, "date")) { - header = ctx->message_current->date; - } else if (!strcasecmp(headername, "from")) { - header = ctx->message_current->sender; - } else { - g_warning("Performing query on unknown header: %s", headername); - header = NULL; - } - - if (header) { - for (i=1;itype == FSEXP_RES_STRING - && strstr(header, argv[i]->value.string)) { - printf("%s got a match with %s of %s\n", ctx->message_current->uid, header, argv[i]->value.string); - truth = TRUE; - break; - } - } - } - } - r = filter_sexp_result_new(FSEXP_RES_BOOL); - r->value.bool = truth; - - return r; -} - - -/* 'builtin' functions */ -static struct { - char *name; - FilterSEXPFunc *func; - int type; /* set to 1 if a function can perform shortcut evaluation, or - doesn't execute everything, 0 otherwise */ -} symbols[] = { - { "body-contains", func_body_contains, 0 }, - { "date-sent", func_date_sent, 0 }, - { "match-all", (FilterSEXPFunc *)func_match_all, 1 }, - { "header-contains", func_header_contains, 0 }, -}; - -GList * -camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex) -{ - int i; - struct _searchcontext ctx; - GList *matches = NULL; - FilterSEXP *f; - FilterSEXPResult *r; - - /* setup our expression evaluator */ - f = filter_sexp_new(); - - /* setup out context */ - ctx.folder = folder; - ctx.summary = camel_folder_get_summary(folder, ex); - ctx.message_info = camel_folder_summary_get_message_info_list(ctx.summary); - ctx.message_current = NULL; - ctx.index = ibex_open(CAMEL_MBOX_FOLDER(folder)->index_file_path, FALSE); - if (!ctx.index) { - perror("Cannot open index file"); - } - - for(i=0;itype == FSEXP_RES_ARRAY_PTR) { - d(printf("got result ...\n")); - for (i=0;ivalue.ptrarray->len;i++) { - d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i))); - matches = g_list_prepend(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i))); - } - filter_sexp_result_free(r); - } else { - printf("no result!\n"); - } - - if (ctx.index) - ibex_close(ctx.index); - - gtk_object_unref((GtkObject *)ctx.summary); - gtk_object_unref((GtkObject *)f); - - return matches; -} - -#else /* HAVE_FILTER */ - -GList * -camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex) -{ - return NULL; -} - -#endif /*! HAVE_FILTER */ diff --git a/camel/providers/mbox/camel-mbox-search.h b/camel/providers/mbox/camel-mbox-search.h deleted file mode 100644 index d232624386..0000000000 --- a/camel/providers/mbox/camel-mbox-search.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef _CAMEL_MBOX_SEARCH_H -#define _CAMEL_MBOX_SEARCH_H - -#include "camel-mbox-folder.h" - -GList *camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex); - -#endif /* ! _CAMEL_MBOX_SEARCH_H */ - diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c deleted file mode 100644 index d0eea3f996..0000000000 --- a/camel/providers/mbox/camel-mbox-store.c +++ /dev/null @@ -1,123 +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) 2000 HelixCode . - * - * 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 -#include "camel-log.h" - -#include "camel-mbox-store.h" -#include "camel-mbox-folder.h" -#include "camel-exception.h" -#include "url-util.h" - -/* 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 CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex); - - -static void -camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class) -{ - CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mbox_store_class); - - /* virtual method overload */ - camel_store_class->get_folder = _get_folder; -} - - - -static void -camel_mbox_store_init (gpointer object, gpointer klass) -{ - CamelService *service = CAMEL_SERVICE (object); - - service->url_flags = CAMEL_SERVICE_URL_NEED_PATH; -} - - - - -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; -} - - -const gchar * -camel_mbox_store_get_toplevel_dir (CamelMboxStore *store) -{ - Gurl *url = CAMEL_SERVICE (store)->url; - - g_assert(url != NULL); - return url->path; -} - - - -static CamelFolder * -_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex) -{ - CamelMboxFolder *new_mbox_folder; - CamelFolder *new_folder; - - /* check if folder has already been created */ - /* call the standard routine for that when */ - /* it is done ... */ - - CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxStore::get_folder\n"); - new_mbox_folder = gtk_type_new (CAMEL_MBOX_FOLDER_TYPE); - new_folder = CAMEL_FOLDER (new_mbox_folder); - - /* XXX We shouldn't be passing NULL here, but it's equivalent to - * what was there before, and there's no - * CamelMboxFolder::get_subfolder yet anyway... - */ - CF_CLASS (new_folder)->init (new_folder, store, NULL, - folder_name, '/', ex); - - CAMEL_LOG_FULL_DEBUG ("Leaving CamelMboxStore::get_folder\n"); - - 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 e33688066f..0000000000 --- a/camel/providers/mbox/camel-mbox-store.h +++ /dev/null @@ -1,69 +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) 2000 HelixCode . - * - * 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 -#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; - -} CamelMboxStore; - - - -typedef struct { - CamelStoreClass parent_class; - -} CamelMboxStoreClass; - - -/* public methods */ - -/* Standard Gtk function */ -GtkType camel_mbox_store_get_type (void); - -const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_MBOX_STORE_H */ - - diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c deleted file mode 100644 index 51946f1789..0000000000 --- a/camel/providers/mbox/camel-mbox-summary.c +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code . - - * 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 - -#include "camel-log.h" -#include "camel-exception.h" -#include "camel-mbox-folder.h" -#include "camel-mbox-summary.h" -#include "camel-folder-summary.h" -#include "md5-utils.h" - - -#include -#include -#include -#include -#include -#include -#include -#include - - -void -camel_mbox_save_summary (CamelMboxSummary *summary, const gchar *filename, CamelException *ex) -{ - CamelMboxSummaryInformation *msg_info; - guint cur_msg; - guint field_lgth; - gint fd; - gint write_result; - - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary entering \n"); - - fd = open (filename, - O_WRONLY | O_CREAT | O_TRUNC, - S_IRUSR | S_IWUSR); - if (fd == -1) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not create the mbox summary file\n" - "\t%s\n" - "Full error is : %s\n", - filename, - strerror (errno)); - return; - } - - /* compute and write the mbox file md5 signature */ - //md5_get_digest_from_file (filename, summary->md5_digest); - - /* write the number of messages + the md5 signatures - + next UID + mbox file size */ - write_result = write (fd, summary, G_STRUCT_OFFSET (CamelMboxSummary, message_info)); - - - for (cur_msg=0; cur_msg < summary->nb_message; cur_msg++) { - - msg_info = (CamelMboxSummaryInformation *)(summary->message_info->data) + cur_msg; - - /* write message position + message size - + x-evolution offset + uid + status */ - write (fd, (gchar *)msg_info, - sizeof (guint32) + 2 * sizeof (guint) + - sizeof (guint32) + sizeof (guchar)); - - /* write subject */ - field_lgth = msg_info->subject ? strlen (msg_info->subject) : 0; - write (fd, &field_lgth, sizeof (guint)); - if (field_lgth) - write (fd, msg_info->subject, 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); - - /* write to */ - field_lgth = msg_info->to ? strlen (msg_info->to) : 0; - write (fd, &field_lgth, sizeof (gint)); - if (field_lgth) - write (fd, msg_info->to, field_lgth); - - /* write date */ - field_lgth = msg_info->date ? strlen (msg_info->date) : 0; - write (fd, &field_lgth, sizeof (guint)); - if (field_lgth) - write (fd, msg_info->date, field_lgth); - - - } - - close (fd); - - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary leaving \n"); -} - - - - - -CamelMboxSummary * -camel_mbox_load_summary (const gchar *filename, CamelException *ex) -{ - CamelMboxSummaryInformation *msg_info; - guint cur_msg; - guint field_lgth; - gint fd; - CamelMboxSummary *summary; - gint read_result; - - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary entering \n"); - - fd = open (filename, O_RDONLY); - if (fd == -1) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not open the mbox summary file\n" - "\t%s\n" - "Full error is : %s\n", - filename, - strerror (errno)); - return NULL; - } - summary = g_new0 (CamelMboxSummary, 1); - - /* read the message number, the md5 signature - and the next available UID + mbox file size */ - read_result = read (fd, summary, G_STRUCT_OFFSET (CamelMboxSummary, message_info)); - - - summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation)); - summary->message_info = g_array_set_size (summary->message_info, summary->nb_message); - - - for (cur_msg=0; cur_msg < summary->nb_message; cur_msg++) { - - msg_info = (CamelMboxSummaryInformation *)(summary->message_info->data) + cur_msg; - - /* read message position + message size - + x-evolution offset + uid + status */ - read (fd, (gchar *)msg_info, - sizeof (guint32) + 2 * sizeof (guint) + - sizeof (guint32) + sizeof (guchar)); - - - /* read the subject */ - read (fd, &field_lgth, sizeof (gint)); - if (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 the sender */ - read (fd, &field_lgth, sizeof (gint)); - if (field_lgth > 0) { - msg_info->sender = g_new0 (gchar, field_lgth + 1); - read (fd, msg_info->sender, field_lgth); - } else - msg_info->sender = NULL; - - /* read the "to" field */ - read (fd, &field_lgth, sizeof (gint)); - if (field_lgth > 0) { - msg_info->to = g_new0 (gchar, field_lgth + 1); - read (fd, msg_info->to, field_lgth); - } else - msg_info->to = NULL; - - /* read the "date" field */ - read (fd, &field_lgth, sizeof (gint)); - if (field_lgth > 0) { - msg_info->date = g_new0 (gchar, field_lgth + 1); - read (fd, msg_info->date, field_lgth); - } else - msg_info->date = NULL; - - - - - } - - close (fd); - return summary; -} - - - - - - - - - -gboolean -camel_mbox_check_summary_sync (gchar *summary_filename, - gchar *mbox_filename, - CamelException *ex) - -{ - gint fd; - guchar summary_md5[16]; - guchar real_md5[16]; - - - CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::save_summary entering \n"); - - fd = open (summary_filename, O_RDONLY); - if (fd == -1) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not open the mbox summary file\n" - "\t%s\n" - "Full error is : %s\n", - summary_filename, - strerror (errno)); - return FALSE; - } - - /* skip the message number field */ - lseek (fd, sizeof (guint), SEEK_SET); - - /* read the md5 signature stored in the summary file */ - read (fd, summary_md5, sizeof (guchar) * 16); - close (fd); - /* ** FIXME : check for exception in all these operations */ - - /* compute the actual md5 signature on the - mbox file */ - md5_get_digest_from_file (mbox_filename, real_md5); - - return (strncmp (real_md5, summary_md5, 16) == 0); -} - - - - - -void -camel_mbox_summary_append_entries (CamelMboxSummary *summary, GArray *entries) -{ - - summary->message_info = g_array_append_vals (summary->message_info, entries->data, entries->len); - -} - - - - - -void -camel_mbox_summary_append_internal_to_external (CamelMboxSummary *internal, - CamelFolderSummary *external, - guint first_entry) -{ - GArray *internal_array; - GArray *external_array; - - CamelMessageInfo external_entry; - CamelMboxSummaryInformation *internal_entry; - - int i; - - - internal_array = internal->message_info; - external_array = external->message_info_list; - - /* we don't set any extra fields */ - external_entry.extended_fields = NULL; - - - for (i=first_entry; ilen; i++) { - internal_entry = (CamelMboxSummaryInformation *)(internal_array->data) + i; - - external_entry.subject = internal_entry->subject ? strdup (internal_entry->subject) : NULL; - external_entry.uid = g_strdup_printf ("%u", internal_entry->uid); - external_entry.date = internal_entry->date ? strdup (internal_entry->date) : NULL; - external_entry.sender = internal_entry->sender ? strdup (internal_entry->sender) : NULL; - - g_array_append_vals (external_array, &external_entry, 1); - - } - - -} diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h deleted file mode 100644 index af64ff7cf5..0000000000 --- a/camel/providers/mbox/camel-mbox-summary.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * - * Author : Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code (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 MBOX_SUMMARY_H -#define MBOX_SUMMARY_H 1 - -#include - - - -typedef struct { - - guint32 position; - guint size; - guint x_evolution_offset; - guint32 uid; - guchar status; - gchar *subject; - gchar *sender; - gchar *to; - gchar *date; - -} CamelMboxSummaryInformation; - - -typedef struct { - - guint nb_message; /* number of messages in the summary */ - guchar md5_digest[16]; /* md5 signature of the mbox file */ - guint32 next_uid; - guint32 mbox_file_size; - - GArray *message_info; /* array of CamelMboxSummaryInformation */ - -} CamelMboxSummary; - - -void -camel_mbox_save_summary (CamelMboxSummary *summary, const gchar *filename, CamelException *ex); - -CamelMboxSummary * -camel_mbox_load_summary (const gchar *filename, CamelException *ex); - -gboolean -camel_mbox_check_summary_sync (gchar *summary_filename, - gchar *mbox_filename, - CamelException *ex); - -void -camel_mbox_summary_append_entries (CamelMboxSummary *summary, GArray *entries); - - - -void -camel_mbox_summary_append_internal_to_external (CamelMboxSummary *internal, - CamelFolderSummary *external, - guint first_entry); - - -#endif /* MH_SUMMARY_H */ diff --git a/camel/providers/mbox/camel-mbox-utils.c b/camel/providers/mbox/camel-mbox-utils.c deleted file mode 100644 index 6a49bb869f..0000000000 --- a/camel/providers/mbox/camel-mbox-utils.c +++ /dev/null @@ -1,387 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Various utilities for the mbox provider */ - -/* - * Authors : - * Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code. - * - * 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 - */ - - -/* "xev" stands for x-evolution, which is the name of the - * evolution specific header where are stored informations - * like : - * - mail status - * - mail uid - * ... - * - * - * The evolution line has the following format : - * - * X-Evolution:XXXXX-X - * \___/ \/ - * UID ---' `- Status - * - * the UID is internally used as a 32 bits long integer, but only the first 24 bits are - * used. The UID is coded as a string on 4 characters. Each character is a 6 bits - * integer coded using the b64 alphabet. - * - */ - - -#include -#include -#include -#include -#include -#include -#include - - -#include -#include "camel-mbox-utils.h" -#include "camel-mbox-parser.h" -#include "camel-folder-summary.h" -#include "camel-mbox-summary.h" - - - -static gchar b64_alphabet[64] = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - - -static void -uid_to_string (guint32 uid, gchar string[4]) -{ - - string [0] = b64_alphabet [(uid >> 18) & 0x3f]; - string [1] = b64_alphabet [(uid >> 12) & 0x3f]; - string [2] = b64_alphabet [(uid >> 6) & 0x3f]; - string [3] = b64_alphabet [(uid ) & 0x3f]; -} - - -static guint32 -string_to_uid (gchar *string) -{ - guint32 i; - - i = - (((string [0] >= 97) ? ( string [0] - 71 ) : - ((string [0] >= 65) ? ( string [0] - 65 ) : - ((string [0] >= 48) ? ( string [0] + 4 ) : - ((string [0] == 43) ? 62 : 63 )))) << 18) - - + (((string [1] >= 97) ? ( string [1] - 71 ) : - ((string [1] >= 65) ? ( string [1] - 65 ) : - ((string [1] >= 48) ? ( string [1] + 4 ) : - ((string [1] == 43) ? 62 : 63 )))) << 12) - - - + ((((string [2] >= 97) ? ( string [2] - 71 ) : - ((string [2] >= 65) ? ( string [2] - 65 ) : - ((string [2] >= 48) ? ( string [2] + 4 ) : - ((string [2] == 43) ? 62 : 63 ))))) << 6) - - - + (((string [3] >= 97) ? ( string [3] - 71 ) : - ((string [3] >= 65) ? ( string [3] - 65 ) : - ((string [3] >= 48) ? ( string [3] + 4 ) : - ((string [3] == 43) ? 62 : 63 ))))); - - return i; - -} - - -static gchar -flag_to_string (guchar status) -{ - return b64_alphabet [status & 0x3f]; -} - - -static guchar -string_to_flag (gchar string) -{ - return (string >= 97) ? ( string - 71 ) : - ((string >= 65) ? ( string - 65 ) : - ((string >= 48) ? ( string + 4 ) : - ((string == 43) ? 62 : 63 ))); -} - - - - - -void -camel_mbox_xev_parse_header_content (gchar header_content[6], - guint32 *uid, - guchar *status) -{ - - /* we assume that the first 4 characters of the header content - are actually the uid stuff. If somebody messed with it ... - toooo bad. - */ - *uid = string_to_uid (header_content); - *status = string_to_flag (header_content[5]); -} - -void -camel_mbox_xev_write_header_content (gchar header_content[6], - guint32 uid, - guchar status) -{ - uid_to_string (uid, header_content); - header_content[5] = flag_to_string (status); - header_content[4] = '-'; -} - - - - - - -void -camel_mbox_copy_file_chunk (gint fd_src, - gint fd_dest, - glong nb_bytes, - CamelException *ex) -{ - gchar buffer [1000]; - glong nb_to_read; - glong nb_read, v; - - nb_to_read = nb_bytes; - while (nb_to_read > 0) { - - do { - nb_read = read (fd_src, buffer, MIN (1000, nb_to_read)); - } while (nb_read == -1 && errno == EINTR); - - if (nb_read == -1) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not read from the mbox file\n" - "Full error is : %s\n", - strerror (errno)); - return; - } - - - nb_to_read -= nb_read; - - do { - v = write (fd_dest, buffer, nb_read); - } while (v == -1 && errno == EINTR); - - if (v == -1) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not write to the mbox copy file\n" - "Full error is : %s\n", - strerror (errno)); - return; - } - - - } - - - -} - - -guint32 -camel_mbox_write_xev (gchar *mbox_file_name, - GArray *summary_information, - guint32 *file_size, - guint32 next_uid, - CamelException *ex) -{ - gint cur_msg; - CamelMboxParserMessageInfo *cur_msg_info; - gint fd1, fd2; - guint bytes_to_copy = 0; - glong cur_pos = 0; - glong cur_offset = 0; - glong end_of_last_message; - glong next_free_uid; - gchar xev_header[20] = "X-Evolution:XXXX-X\n"; - gchar *tmp_file_name; - gchar *tmp_file_name_secure; - gint rename_result; - gint unlink_result; - - tmp_file_name = g_strdup_printf ("%s__.ev_tmp", mbox_file_name); - tmp_file_name_secure = g_strdup_printf ("%s__.ev_tmp_secure", mbox_file_name); - - fd1 = open (mbox_file_name, O_RDONLY); - fd2 = open (tmp_file_name, - O_WRONLY | O_CREAT | O_TRUNC , - S_IRUSR | S_IWUSR); - - if (fd2 == -1) { - camel_exception_setv (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not create the temporary mbox copy file\n" - "\t%s\n" - "Full error is : %s\n", - tmp_file_name, - strerror (errno)); - return next_uid; - } - - next_free_uid = next_uid; - for (cur_msg = 0; cur_msg < summary_information->len; cur_msg++) { - - cur_msg_info = (CamelMboxParserMessageInfo *)(summary_information->data) + cur_msg; - end_of_last_message = cur_msg_info->message_position + cur_msg_info->size; - - if (cur_msg_info->uid == 0) { - - bytes_to_copy = cur_msg_info->message_position - + cur_msg_info->end_of_headers_offset - - cur_pos; - - cur_pos = cur_msg_info->message_position - + cur_msg_info->end_of_headers_offset; - - camel_mbox_copy_file_chunk (fd1, fd2, bytes_to_copy, ex); - if (camel_exception_get_id (ex)) { - close (fd1); - close (fd2); - goto end; - } - - cur_msg_info->uid = next_free_uid; - cur_msg_info->status = 0; - camel_mbox_xev_write_header_content (xev_header + 12, next_free_uid, 0); - next_free_uid++; - write (fd2, xev_header, 19); - cur_offset += 19; - cur_msg_info->size += 19; - cur_msg_info->x_evolution_offset = cur_msg_info->end_of_headers_offset; - cur_msg_info->x_evolution = g_strdup_printf ("%.6s", xev_header + 12); - cur_msg_info->end_of_headers_offset += 19; - *file_size += 19; - } - cur_msg_info->message_position += cur_offset; - } - - - bytes_to_copy = end_of_last_message - cur_pos; - camel_mbox_copy_file_chunk (fd1, fd2, bytes_to_copy, ex); - - - /* close the original file as well as the - newly created one */ - close (fd1); - close (fd2); - - - - /* replace the mbox file with the temporary - file we just created */ - - /* first rename the old mbox file to a temporary file */ - rename_result = rename (mbox_file_name, tmp_file_name_secure); - if (rename_result == -1) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not rename the mbox file to a temporary file"); - goto end; - } - - /* then rename the newly created mbox file to the name - of the original one */ - rename_result = rename (tmp_file_name, mbox_file_name); - if (rename_result == -1) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not rename the X-Evolution fed file to the mbox file"); - goto end; - } - - /* finally, remove the old renamed mbox file */ - unlink_result = unlink (tmp_file_name_secure); - if (unlink_result == -1) { - camel_exception_set (ex, - CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION, - "could not remove the saved original mbox file"); - goto end; - } - - - end: /* free everything and return */ - - g_free (tmp_file_name); - g_free (tmp_file_name_secure); - return next_free_uid; -} - - - - - - -GArray * -parsed_information_to_mbox_summary (GArray *parsed_information) -{ - guint cur_msg; - CamelMboxParserMessageInfo *cur_msg_info; - GArray *mbox_summary; - CamelMboxSummaryInformation *cur_sum_info; - - mbox_summary = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation)); - mbox_summary = g_array_set_size (mbox_summary, parsed_information->len); - - for (cur_msg = 0; cur_msg < parsed_information->len; cur_msg++) { - - cur_msg_info = (CamelMboxParserMessageInfo *)(parsed_information->data) + cur_msg; - cur_sum_info = (CamelMboxSummaryInformation *)(mbox_summary->data) + cur_msg; - - cur_sum_info->position = cur_msg_info->message_position; - - cur_sum_info->size = cur_msg_info->size; - - cur_sum_info->x_evolution_offset = cur_msg_info->x_evolution_offset; - - cur_sum_info->uid = cur_msg_info->uid; - - cur_sum_info->status = cur_msg_info->status; - - cur_sum_info->subject = cur_msg_info->subject; - cur_msg_info->subject = NULL; - - cur_sum_info->sender = cur_msg_info->from; - cur_msg_info->from = NULL; - - cur_sum_info->to = cur_msg_info->to; - cur_msg_info->to = NULL; - - cur_sum_info->date = cur_msg_info->date; - cur_msg_info->date = NULL; - - } - - return mbox_summary; -} diff --git a/camel/providers/mbox/camel-mbox-utils.h b/camel/providers/mbox/camel-mbox-utils.h deleted file mode 100644 index 062a284b03..0000000000 --- a/camel/providers/mbox/camel-mbox-utils.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Various utilities for the mbox provider */ - -/* - * Authors : - * Bertrand Guiheneuf - * - * Copyright (C) 1999 Helix Code. - * - * 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_UTILS_H -#define CAMEL_MBOX_UTILS_H 1 - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - - -#include "camel-exception.h" - -void -camel_mbox_xev_parse_header_content (gchar header_content[6], - guint32 *uid, - guchar *status); - -void -camel_mbox_xev_write_header_content (gchar header_content[6], - guint32 uid, - guchar status); - -guint32 -camel_mbox_write_xev (gchar *mbox_file_name, - GArray *summary_information, - guint32 *file_size, - guint32 last_uid, - CamelException *ex); - -GArray * -parsed_information_to_mbox_summary (GArray *parsed_information); - -void -camel_mbox_copy_file_chunk (gint fd_src, - gint fd_dest, - glong nb_bytes, - CamelException *ex); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_MBOX_UTILS_H */ diff --git a/camel/providers/sendmail/.cvsignore b/camel/providers/sendmail/.cvsignore deleted file mode 100644 index cacc3c5d5f..0000000000 --- a/camel/providers/sendmail/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -Makefile.in -.deps -.libs -*.lo -*.la -*.o diff --git a/camel/providers/sendmail/Makefile.am b/camel/providers/sendmail/Makefile.am deleted file mode 100644 index aada24aee7..0000000000 --- a/camel/providers/sendmail/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = - -libcamelsendmailincludedir = $(includedir)/camel - - -providerdir = $(pkglibdir)/camel-providers/$(VERSION) - -provider_LTLIBRARIES = libcamelsendmail.la - -INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \ - -I$(top_srcdir)/intl \ - $(GTK_INCLUDEDIR) -I$(top_srcdir)/camel - -libcamelsendmail_la_SOURCES = \ - camel-sendmail-provider.c \ - camel-sendmail-transport.c - -libcamelsendmailinclude_HEADERS = \ - camel-sendmail-transport.h - -libcamelsendmail_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) - -EXTRA_DIST = diff --git a/camel/providers/sendmail/camel-sendmail-provider.c b/camel/providers/sendmail/camel-sendmail-provider.c deleted file mode 100644 index 2b1d07efcd..0000000000 --- a/camel/providers/sendmail/camel-sendmail-provider.c +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-sendmail-provider.c: sendmail provider registration code */ - -/* - * Authors : - * Dan Winship - * - * Copyright (C) 2000 Helix Code, Inc. (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-provider.h" -#include "camel-sendmail-transport.h" - -static CamelProvider _sendmail_provider = { - (GtkType) 0, - PROVIDER_TRANSPORT, - "sendmail", - "Camel sendmail provider", - "A provider to send mail via the sendmail program", - (GModule *) NULL -}; - -CamelProvider * -camel_provider_module_init (void); - - -CamelProvider * -camel_provider_module_init (void) -{ - _sendmail_provider.object_type = camel_sendmail_transport_get_type(); - return &_sendmail_provider; -} - - - diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c deleted file mode 100644 index 2feefc4b21..0000000000 --- a/camel/providers/sendmail/camel-sendmail-transport.c +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-sendmail-transport.c: Sendmail-based transport class. */ - -/* - * - * Author : - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (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 - -#include -#include -#include -#include -#include - -#include "camel-sendmail-transport.h" -#include "camel-mime-message.h" -#include "camel-data-wrapper.h" -#include "camel-stream-fs.h" -#include "camel-exception.h" - -static gboolean _can_send (CamelTransport *transport, CamelMedium *message); -static gboolean _send (CamelTransport *transport, CamelMedium *message, - CamelException *ex); -static gboolean _send_to (CamelTransport *transport, CamelMedium *message, - GList *recipients, CamelException *ex); - - -static void -camel_sendmail_transport_class_init (CamelSendmailTransportClass *camel_sendmail_transport_class) -{ - CamelTransportClass *camel_transport_class = - CAMEL_TRANSPORT_CLASS (camel_sendmail_transport_class); - - /* virtual method overload */ - camel_transport_class->can_send = _can_send; - camel_transport_class->send = _send; - camel_transport_class->send_to = _send_to; -} - -GtkType -camel_sendmail_transport_get_type (void) -{ - static GtkType camel_sendmail_transport_type = 0; - - if (!camel_sendmail_transport_type) { - GtkTypeInfo camel_sendmail_transport_info = - { - "CamelSendmailTransport", - sizeof (CamelSendmailTransport), - sizeof (CamelSendmailTransportClass), - (GtkClassInitFunc) camel_sendmail_transport_class_init, - (GtkObjectInitFunc) NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - camel_sendmail_transport_type = gtk_type_unique (CAMEL_TRANSPORT_TYPE, &camel_sendmail_transport_info); - } - - return camel_sendmail_transport_type; -} - - -static gboolean -_can_send (CamelTransport *transport, CamelMedium *message) -{ - return CAMEL_IS_MIME_MESSAGE (message); -} - - -static gboolean -_send_internal (CamelMedium *message, char **argv, CamelException *ex) -{ - int fd[2], nullfd, wstat; - sigset_t mask, omask; - CamelStream *out; - pid_t pid; - - g_assert (CAMEL_IS_MIME_MESSAGE (message)); - - if (pipe (fd) == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "Could not create pipe to sendmail: " - "%s: mail not sent", - g_strerror (errno)); - return FALSE; - } - - /* Block SIGCHLD so the calling application doesn't notice - * sendmail exiting before we do. - */ - sigemptyset (&mask); - sigaddset (&mask, SIGCHLD); - sigprocmask (SIG_BLOCK, &mask, &omask); - - switch (fork ()) { - case -1: - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "Could not fork sendmail: " - "%s: mail not sent", g_strerror (errno)); - sigprocmask (SIG_SETMASK, &omask, NULL); - return FALSE; - - case 0: - /* Child process */ - nullfd = open ("/dev/null", O_RDWR); - dup2 (fd[0], STDIN_FILENO); - dup2 (nullfd, STDOUT_FILENO); - dup2 (nullfd, STDERR_FILENO); - close (nullfd); - close (fd[1]); - - execv (SENDMAIL_PATH, argv); - _exit (255); - } - - /* Parent process. Write the message out. */ - close (fd[0]); - out = camel_stream_fs_new_with_fd (fd[1]); - camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), out); - camel_stream_close (out); - - /* Wait for sendmail to exit. */ - while (waitpid (pid, &wstat, 0) == -1 && errno == EINTR) - ; - sigprocmask (SIG_SETMASK, &omask, NULL); - - if (!WIFEXITED (wstat)) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "sendmail exited with signal %s: " - "mail not sent.", - g_strsignal (WTERMSIG (wstat))); - return FALSE; - } else if (WEXITSTATUS (wstat) != 0) { - if (WEXITSTATUS (wstat) == 255) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - "Could not execute " - SENDMAIL_PATH ": mail not sent."); - } else { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "sendmail exited with status " - "%d: mail not sent.", - WEXITSTATUS (wstat)); - } - return FALSE; - } - - return TRUE; -} - -static gboolean -_send_to (CamelTransport *transport, CamelMedium *message, - GList *recipients, CamelException *ex) -{ - GList *r; - char **argv; - int i, len; - gboolean status; - - len = g_list_length (recipients); - argv = g_malloc ((len + 4) * sizeof (char *)); - argv[0] = "sendmail"; - argv[1] = "-i"; - argv[2] = "--"; - - for (i = 1, r = recipients; i <= len; i++, r = r->next) - argv[i + 2] = r->data; - argv[i + 2] = NULL; - - status = _send_internal (message, argv, ex); - g_free (argv); - return status; -} - -static gboolean -_send (CamelTransport *transport, CamelMedium *message, - CamelException *ex) -{ - char *argv[4] = { "sendmail", "-t", "-i", NULL }; - - return _send_internal (message, argv, ex); -} diff --git a/camel/providers/sendmail/camel-sendmail-transport.h b/camel/providers/sendmail/camel-sendmail-transport.h deleted file mode 100644 index 3f3714584a..0000000000 --- a/camel/providers/sendmail/camel-sendmail-transport.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* camel-sendmail-transport.h: Sendmail-based transport class */ - -/* - * - * Author : - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (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_SENDMAIL_TRANSPORT_H -#define CAMEL_SENDMAIL_TRANSPORT_H 1 - - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - -#include "camel-transport.h" - -#define CAMEL_SENDMAIL_TRANSPORT_TYPE (camel_sendmail_transport_get_type ()) -#define CAMEL_SENDMAIL_TRANSPORT(obj) (GTK_CHECK_CAST((obj), CAMEL_SENDMAIL_TRANSPORT_TYPE, CamelSendmailTransport)) -#define CAMEL_SENDMAIL_TRANSPORT_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_SENDMAIL_TRANSPORT_TYPE, CamelSendmailTransportClass)) -#define CAMEL_IS_SENDMAIL_TRANSPORT(o) (GTK_CHECK_TYPE((o), CAMEL_SENDMAIL_TRANSPORT_TYPE)) - - -typedef struct { - CamelTransport parent_object; - -} CamelSendmailTransport; - - -typedef struct { - CamelTransportClass parent_class; - -} CamelSendmailTransportClass; - - -/* Standard Gtk function */ -GtkType camel_sendmail_transport_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* CAMEL_SENDMAIL_TRANSPORT_H */ diff --git a/camel/string-utils.c b/camel/string-utils.c deleted file mode 100644 index 757a907190..0000000000 --- a/camel/string-utils.c +++ /dev/null @@ -1,313 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* string-util : utilities for gchar* strings */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 -#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) -{ - 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 ( (firstfirst)) - 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_poslast) ) - { - 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 + 1); - string[last_ok - first_ok +1] = '\0'; - -} - - - - - -/** - * remove_suffix: remove a suffix from a string - * @s: the string to remove the suffix from. - * @suffix: the suffix to remove - * @suffix_found : suffix found flag - * - * Remove a suffix from a string. If the - * string ends with the full suffix, a copy - * of the string without the suffix is returned and - * @suffix_found is set to %TRUE. - * Otherwise, NULL is returned and - * @suffix_found is set to %FALSE. - * - * Return value: an allocated copy of the string without the suffix or NULL if the suffix was not found. - **/ -gchar * -string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found) -{ - guint s_len, suf_len; - guint suffix_pos; - char *result_string; - - g_assert (s); - g_assert (suffix); - g_assert (suffix_found); - - s_len = strlen (s); - suf_len = strlen (suffix); - - /* if the string is shorter than the suffix, do nothing */ - if (s_len < suf_len) { - *suffix_found = FALSE; - return NULL; - } - - /* theoretical position of the prefix */ - suffix_pos = s_len - suf_len; - - /* compare the right hand side of the string with the suffix */ - if (!strncmp (s+suffix_pos, suffix, suf_len)) { - - /* if the suffix matches, check that there are - characters before */ - if (suffix_pos == 0) { - result_string = NULL; - *suffix_found = TRUE; - } else { - result_string = g_strndup (s, suffix_pos); - *suffix_found = TRUE; - } - - } else { - result_string = NULL; - *suffix_found = FALSE; - } - - return result_string; -} diff --git a/camel/string-utils.h b/camel/string-utils.h deleted file mode 100644 index f37abbd08b..0000000000 --- a/camel/string-utils.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* string-util : utilities for normal gchar * strings */ - -/* - * - * Author : - * Bertrand Guiheneuf - * - * 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 - - - -typedef enum { - STRING_DICHOTOMY_NONE = 0, - STRING_DICHOTOMY_RIGHT_DIR = 1, - STRING_DICHOTOMY_STRIP_TRAILING = 2, - STRING_DICHOTOMY_STRIP_LEADING = 4 - -} StringDichotomyOption; - - -typedef enum { - STRING_TRIM_NONE = 0, - STRING_TRIM_STRIP_TRAILING = 1, - STRING_TRIM_STRIP_LEADING = 2 -} StringTrimOption; - - - -gboolean string_equal_for_glist (gconstpointer v, gconstpointer v2); - -gchar string_dichotomy (const gchar *string, gchar sep, - gchar **prefix, gchar **suffix, - StringDichotomyOption options); -void string_list_free (GList *string_list); - -GList *string_split (const gchar *string, char sep, - const gchar *trim_chars, StringTrimOption trim_options); -void string_trim (gchar *string, const gchar *chars, - StringTrimOption options); - -gchar *string_prefix (const gchar *s, const gchar *suffix, gboolean *suffix_found); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* STRING_UTIL_H */ diff --git a/camel/url-util.c b/camel/url-util.c deleted file mode 100644 index 37a433888d..0000000000 --- a/camel/url-util.c +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* url-util.c : utility functions to parse URLs */ - - -/* - * Authors : - * Bertrand Guiheneuf - * Dan Winship - * - * Copyright 1999, 2000 Helix Code, Inc. (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 URLs following the general scheme: - * protocol://user;AUTH=mech:password@host:port/name - * where name is a path-like string (ie dir1/dir2/....) See RFC 1738 - * for the complete description of Uniform Resource Locators. The - * ";AUTH=mech" addition comes from RFC 2384, "POP URL Scheme". - */ - -/* XXX TODO: - * recover the words between #'s or ?'s after the path - * % escapes - */ - -#include -#include -#include "url-util.h" - -/** - * g_url_new: create a Gurl object from a string - * - * @url_string: The string containing the URL to scan - * - * This routine takes a gchar and parses it as a - * URL of the form: - * protocol://user;AUTH=mech: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 are 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; - char *semi, *colon, *at, *slash; - - g_url = g_new (Gurl,1); - - /* Find protocol: initial substring until "://" */ - colon = strchr (url_string, ':'); - if (colon && !strncmp (colon, "://", 3)) { - g_url->protocol = g_strndup (url_string, colon - url_string); - url_string = colon + 3; - } else - g_url->protocol = NULL; - - /* If there is an @ sign, look for user, authmech, and - * password before it. - */ - at = strchr (url_string, '@'); - if (at) { - colon = strchr (url_string, ':'); - if (colon && colon < at) - g_url->passwd = g_strndup (colon + 1, at - colon - 1); - else { - g_url->passwd = NULL; - colon = at; - } - - semi = strchr(url_string, ';'); - if (semi && semi < colon && !strncasecmp (semi, ";auth=", 6)) - g_url->authmech = g_strndup (semi + 6, colon - semi - 6); - else { - g_url->authmech = NULL; - semi = colon; - } - - g_url->user = g_strndup (url_string, semi - url_string); - url_string = at + 1; - } else - g_url->user = g_url->passwd = g_url->authmech = NULL; - - /* Find host (required) and port. */ - slash = strchr (url_string, '/'); - colon = strchr (url_string, ':'); - if (slash && colon > slash) - colon = 0; - - if (colon) { - g_url->host = g_strndup (url_string, colon - url_string); - if (slash) - g_url->port = g_strndup (colon + 1, slash - colon - 1); - else - g_url->port = g_strdup (colon + 1); - } else if (slash) { - g_url->host = g_strndup (url_string, slash - url_string); - g_url->port = NULL; - } else { - g_url->host = g_strdup (url_string); - g_url->port = NULL; - } - - /* setup a fallback, if relative, then empty string, else - it will be from root */ - if (slash == NULL) { - slash = "/"; - } - if (slash && *slash && g_url->protocol == NULL) - slash++; - - g_url->path = g_strdup (slash); - - return g_url; -} - -gchar * -g_url_to_string (const Gurl *url, gboolean show_passwd) -{ - return g_strdup_printf("%s%s%s%s%s%s%s%s%s%s%s%s", - url->protocol ? url->protocol : "", - url->protocol ? "://" : "", - url->user ? url->user : "", - url->authmech ? ";auth=" : "", - url->authmech ? url->authmech : "", - url->passwd && show_passwd ? ":" : "", - url->passwd && show_passwd ? url->passwd : "", - url->user ? "@" : "", - url->host, - url->port ? ":" : "", - url->port ? url->port : "", - url->path ? url->path : ""); -} - -void -g_url_free (Gurl *url) -{ - g_assert (url); - - g_free (url->protocol); - g_free (url->user); - g_free (url->authmech); - g_free (url->passwd); - g_free (url->host); - g_free (url->port); - g_free (url->path); - - g_free (url); -} diff --git a/camel/url-util.h b/camel/url-util.h deleted file mode 100644 index 86fd1e26ac..0000000000 --- a/camel/url-util.h +++ /dev/null @@ -1,62 +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 - * - * 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 - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -typedef struct { - gchar *protocol; - gchar *user; - gchar *authmech; - 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); -gchar *g_url_to_string (const Gurl *url, gboolean show_password); -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 bca1932d07..0000000000 --- a/composer/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -evolution-msg-composer -Makefile -Makefile.in -*.lo -*.la diff --git a/composer/ChangeLog b/composer/ChangeLog deleted file mode 100644 index 028b4060f3..0000000000 --- a/composer/ChangeLog +++ /dev/null @@ -1,25 +0,0 @@ -2000-01-12 bertrand - - * Makefile.am (evolution_msg_composer_LDADD): - use $(EXTRA_GNOME_LIBS_THREADS) to link with gthread - -1999-11-17 Ettore Perazzoli - - * 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 fa81843aa8..0000000000 --- a/composer/Makefile.am +++ /dev/null @@ -1,49 +0,0 @@ -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - e-msg-composer-address-dialog.glade \ - e-msg-composer-attachment.glade \ - e-msg-composer.glade - -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/camel \ - -I$(top_builddir)/camel \ - $(GNOME_INCLUDEDIR) - -CPPFLAGS = \ - -DE_GLADEDIR=\"$(gladedir)\" - -bin_PROGRAMS = \ - evolution-msg-composer - -evolution_msg_composer_SOURCES = \ - e-msg-composer-address-dialog.c \ - e-msg-composer-address-dialog.h \ - e-msg-composer-address-entry.c \ - e-msg-composer-address-entry.h \ - e-msg-composer-attachment-bar.c \ - e-msg-composer-attachment-bar.h \ - e-msg-composer-attachment.c \ - e-msg-composer-attachment.h \ - e-msg-composer-hdrs.c \ - e-msg-composer-hdrs.h \ - e-msg-composer.c \ - e-msg-composer.h \ - main.c - -evolution_msg_composer_LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) \ - $(INTLLIBS) \ - $(PTHREAD_LIB) \ - $(EXTRA_GNOME_LIBS) - - -EXTRA_DIST = \ - $(glade_DATA) \ - ChangeLog - - diff --git a/composer/e-msg-composer-address-dialog.c b/composer/e-msg-composer-address-dialog.c deleted file mode 100644 index 42a594756d..0000000000 --- a/composer/e-msg-composer-address-dialog.c +++ /dev/null @@ -1,660 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-msg-composer-address-dialog.c - * - * Copyright (C) 1999 Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#include -#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 - ". 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 @@ - - - - - address-composer - address-composer - - src - pixmaps - C - True - True - False - True - True - True - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h - - - - - GnomeDialog - dialog1 - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkTable - main_table - 3 - 2 - False - 0 - 2 - - 0 - True - True - - - - GtkLabel - label3 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - False - False - - - - - GtkLabel - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - True - True - False - False - True - True - - - - - GtkHBox - hbox1 - False - 5 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - GtkLabel - label2 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkEntry - name_entry - True - True - True - 0 - - - 5 - True - True - - - - - GtkButton - search_button - 65 - True - - - 0 - False - False - - - - - - GtkScrolledWindow - scrolledwindow1 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - 1 - 1 - 2 - 0 - 5 - True - True - False - False - True - True - - - - GtkCList - address_clist - 180 - 200 - True - 2 - 128,107 - GTK_SELECTION_BROWSE - True - GTK_SHADOW_IN - - - GtkLabel - CList:title - label5 - 50 - - GTK_JUSTIFY_LEFT - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - CList:title - label6 - 100 - - GTK_JUSTIFY_LEFT - False - 0.5 - 0.5 - 0 - 0 - - - - - - GtkHBox - hbox2 - True - 10 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkButton - button5 - True - - - 0 - True - True - - - - - GtkButton - button6 - True - - - 0 - True - True - - - - - - GtkTable - table2 - 3 - 2 - False - 0 - 0 - - 1 - 2 - 1 - 2 - 0 - 5 - False - False - False - False - True - True - - - - GtkButton - to_add_button - 60 - True - - - 0 - 1 - 0 - 1 - 5 - 0 - True - True - False - False - True - False - - - - - GtkButton - cc_add_button - 60 - True - - - 0 - 1 - 1 - 2 - 5 - 0 - True - True - False - False - True - False - - - - - GtkButton - bcc_add_button - 60 - True - - - 0 - 1 - 2 - 3 - 5 - 0 - True - True - False - False - True - False - - - - - GtkScrolledWindow - scrolledwindow4 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 2 - 2 - 3 - 2 - 0 - True - True - False - False - True - True - - - - GtkCList - bcc_clist - 180 - 100 - True - 1 - 80 - GTK_SELECTION_BROWSE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label9 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GtkScrolledWindow - scrolledwindow2 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 2 - 0 - 1 - 2 - 0 - True - True - False - False - True - True - - - - GtkCList - to_clist - 180 - 100 - True - 1 - 80 - GTK_SELECTION_BROWSE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label7 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - GtkScrolledWindow - scrolledwindow3 - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 1 - 2 - 1 - 2 - 2 - 4 - True - True - False - False - True - True - - - - GtkCList - cc_clist - 180 - 100 - True - 1 - 80 - GTK_SELECTION_BROWSE - False - GTK_SHADOW_IN - - - GtkLabel - CList:title - label8 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - - 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 -#include - -#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 - -#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 - -#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 -#include - -#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 55fe0e6b96..0000000000 --- a/composer/e-msg-composer-attachment-bar.h +++ /dev/null @@ -1,75 +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 -#include -#include - -#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 - -#include - -#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 @@ - - - - - e-msg-composer-attachment - e-msg-composer-attachment - - src - pixmaps - C - True - True - False - True - True - True - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h - - - - - GnomeDialog - dialog - Attachment properties - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - False - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkTable - table1 - 3 - 2 - False - 10 - 5 - - 0 - True - True - - - - GtkLabel - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - False - False - - - - - GtkLabel - label3 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - False - False - - - - - GtkEntry - description_entry - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label2 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GtkHBox - hbox3 - False - 10 - - 1 - 2 - 0 - 1 - 0 - 0 - True - True - True - True - True - True - - - - GtkEntry - file_name_entry - 290 - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - browse_button - 80 - True - - - 0 - False - False - - - - - - GtkEntry - mime_type_entry - False - True - False - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - ok_button - True - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - apply_button - False - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - close_button - True - True - GNOME_STOCK_BUTTON_CLOSE - - - - - - 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 -#include - -#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 -#endif - -#include -#include - -#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 -#include - -#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 -#endif - -#include -#include -#include - -#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 @@ - - - - - Message Composer - e-msg-composer - - src - pixmaps - C - True - True - False - True - True - True - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h - - - - - GnomeApp - app1 - Message Composer - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - True - - - GnomeDock - GnomeApp:dock - dock1 - True - - 0 - True - True - - - - GnomeDockItem - dockitem1 - 2 - GNOME_DOCK_TOP - 0 - 0 - 0 - False - True - False - True - False - GTK_SHADOW_OUT - - - GtkMenuBar - menubar - GTK_SHADOW_NONE - - - GtkMenuItem - file - GNOMEUIINFO_MENU_FILE_TREE - - - GtkMenu - file_menu - - - GtkPixmapMenuItem - open - - activate - on_open_activate - Wed, 27 Oct 1999 22:25:08 GMT - - GNOMEUIINFO_MENU_OPEN_ITEM - - - - GtkPixmapMenuItem - save - - activate - on_save_activate - Wed, 27 Oct 1999 22:25:13 GMT - - GNOMEUIINFO_MENU_SAVE_ITEM - - - - GtkPixmapMenuItem - save_as - - activate - on_save_as_activate - Wed, 27 Oct 1999 22:25:16 GMT - - GNOMEUIINFO_MENU_SAVE_AS_ITEM - - - - GtkPixmapMenuItem - save_in_folder - - activate - on_save_in_folder_activate - Wed, 27 Oct 1999 22:25:20 GMT - - - False - GNOME_STOCK_MENU_SAVE_AS - - - - GtkMenuItem - separator8 - False - - - - GtkPixmapMenuItem - menu_send - - activate - on_send_activate - Wed, 27 Oct 1999 22:25:29 GMT - - - False - GNOME_STOCK_MENU_MAIL_SND - - - - GtkMenuItem - postpone - - activate - on_postpone_activate - Wed, 27 Oct 1999 22:25:37 GMT - - - False - - - - GtkMenuItem - separator1 - False - - - - GtkPixmapMenuItem - exit - - activate - on_exit_activate - Wed, 27 Oct 1999 22:25:59 GMT - - GNOMEUIINFO_MENU_EXIT_ITEM - - - - - - GtkMenuItem - edit - GNOMEUIINFO_MENU_EDIT_TREE - - - GtkMenu - edit_menu - - - GtkPixmapMenuItem - undo - - activate - on_undo_activate - Wed, 27 Oct 1999 22:26:10 GMT - - GNOMEUIINFO_MENU_UNDO_ITEM - - - - GtkPixmapMenuItem - redo - - activate - on_redo_activate - Wed, 27 Oct 1999 22:26:15 GMT - - GNOMEUIINFO_MENU_REDO_ITEM - - - - GtkMenuItem - separator3 - False - - - - GtkPixmapMenuItem - cut - - activate - on_cut_activate - Wed, 27 Oct 1999 22:26:21 GMT - - GNOMEUIINFO_MENU_CUT_ITEM - - - - GtkPixmapMenuItem - copy - - activate - on_copy_activate - Wed, 27 Oct 1999 22:26:26 GMT - - GNOMEUIINFO_MENU_COPY_ITEM - - - - GtkPixmapMenuItem - paste - - activate - on_paste_activate - Wed, 27 Oct 1999 22:26:31 GMT - - GNOMEUIINFO_MENU_PASTE_ITEM - - - - GtkMenuItem - separator2 - False - - - - GtkPixmapMenuItem - select_all - - activate - on_select_all_activate - Wed, 27 Oct 1999 22:26:37 GMT - - GNOMEUIINFO_MENU_SELECT_ALL_ITEM - - - - GtkMenuItem - separator5 - False - - - - GtkPixmapMenuItem - find - - activate - on_find_activate - Wed, 27 Oct 1999 22:26:42 GMT - - GNOMEUIINFO_MENU_FIND_ITEM - - - - GtkPixmapMenuItem - find_again - - activate - on_find_again_activate - Wed, 27 Oct 1999 22:26:47 GMT - - GNOMEUIINFO_MENU_FIND_AGAIN_ITEM - - - - GtkPixmapMenuItem - replace - - activate - on_replace_activate - Wed, 27 Oct 1999 22:26:53 GMT - - GNOMEUIINFO_MENU_REPLACE_ITEM - - - - GtkMenuItem - separator6 - False - - - - GtkPixmapMenuItem - properties - - activate - on_properties_activate - Wed, 27 Oct 1999 22:26:58 GMT - - GNOMEUIINFO_MENU_PROPERTIES_ITEM - - - - - - GtkMenuItem - view1 - GNOMEUIINFO_MENU_VIEW_TREE - - - GtkMenu - view1_menu - - - GtkCheckMenuItem - menu_view_attachments - - activate - on_view_attachments_activate - Fri, 05 Nov 1999 18:31:16 GMT - - - False - False - - - - - - GtkMenuItem - insert - - False - - - GtkMenu - insert_menu - - - GtkMenuItem - menu_add_attachment - - activate - on_attachment_activate - Wed, 27 Oct 1999 22:27:05 GMT - - - False - - - - GtkMenuItem - text_from_file - - activate - on_text_from_file_activate - Wed, 27 Oct 1999 22:27:16 GMT - - - False - - - - GtkMenuItem - separator6 - False - - - - GtkMenuItem - hypertext_link - - activate - on_hypertext_link_activate - Wed, 27 Oct 1999 22:27:21 GMT - - - False - - - - - - GtkMenuItem - settings - GNOMEUIINFO_MENU_SETTINGS_TREE - - - GtkMenu - settings_menu - - - GtkPixmapMenuItem - preferences - - activate - on_preferences_activate - Wed, 27 Oct 1999 22:27:37 GMT - - GNOMEUIINFO_MENU_PREFERENCES_ITEM - - - - - - GtkMenuItem - tools - - False - - - GtkMenu - tools_menu - - - GtkPixmapMenuItem - spell_check1 - - activate - on_spell_check_activate - Wed, 27 Oct 1999 22:27:44 GMT - - - False - GNOME_STOCK_MENU_SPELLCHECK - - - - GtkMenuItem - separator7 - False - - - - GtkMenuItem - check_names - - activate - on_check_names_activate - Wed, 27 Oct 1999 22:27:49 GMT - - - False - - - - GtkPixmapMenuItem - menubar_address_dialog - - activate - on_address_book_activate - Wed, 27 Oct 1999 22:27:53 GMT - - - False - GNOME_STOCK_MENU_BOOK_RED - - - - - - GtkMenuItem - help - GNOMEUIINFO_MENU_HELP_TREE - - - GtkMenu - help_menu - - - GtkPixmapMenuItem - about - - activate - on_about_activate - Wed, 27 Oct 1999 22:28:01 GMT - - GNOMEUIINFO_MENU_ABOUT_ITEM - - - - - - - - GnomeDockItem - dockitem2 - 1 - GNOME_DOCK_TOP - 1 - 0 - 0 - False - True - False - False - False - GTK_SHADOW_OUT - - - GtkToolbar - toolbar - 1 - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_BOTH - 16 - GTK_TOOLBAR_SPACE_LINE - GTK_RELIEF_NONE - True - - - GtkButton - Toolbar:button - toolbar_send - Send this message - - GNOME_STOCK_PIXMAP_MAIL_SND - - - - GtkToggleButton - Toolbar:button - toolbar_view_attachments - Show attachments for this message - - False - - - - GtkButton - Toolbar:button - toolbar_add_attachment - Attach a file - - - - - GtkButton - Toolbar:button - toolbar_address_dialog - Go to addressbook - - GNOME_STOCK_PIXMAP_BOOK_RED - - - - - - Placeholder - GnomeDock:contents - - - - - GnomeAppBar - GnomeApp:appbar - appbar - True - True - - 0 - True - True - - - - - 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 -#include - -#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 - -#include -#include -#include - -#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 11aca764cb..0000000000 --- a/configure.in +++ /dev/null @@ -1,258 +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(capplet) -GNOME_COMPILE_WARNINGS -AC_ISC_POSIX -AC_PROG_CC -AC_PROG_CPP -AM_PROG_LEX -AC_PROG_YACC -AC_STDC_HEADERS -AC_ARG_PROGRAM -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PATH_PROG(SENDMAIL, sendmail, /usr/sbin/sendmail, /usr/sbin:/usr/lib) -AC_DEFINE_UNQUOTED(SENDMAIL_PATH, "$SENDMAIL") - -ALL_LINGUAS="" - -AM_GNOME_GETTEXT - -GNOME_X_CHECKS - - - -dnl ************************************************** -dnl * Posix thread support -dnl ************************************************** - -have_pthread=false - -AC_ARG_WITH(threads, [--with-threads inculde threads support], - [GNOME_PTHREAD_CHECK]) - -if test "x$PTHREAD_LIB" = "x" ; then - have_pthread=false -else - have_pthread=true -fi - -AM_CONDITIONAL(ENABLE_THREADS, $have_pthread) - - -dnl ************************************************** -dnl * Print check -dnl ************************************************** -AC_MSG_CHECKING(for GnomePrint libraries >= 0.10) -if gnome-config --libs print > /dev/null 2>&1; then - vers=`gnome-config --modversion print | sed -e "s/gnome-print-//" | \ - awk 'BEGIN { FS = "."; } { print $1 * 1000 + $2;}'` - if test "$vers" -ge 10; then - AC_MSG_RESULT(found) - else - AC_MSG_ERROR(You need at least GNOME print 0.10 for this version of Gnumeric) - fi -else - AC_MSG_ERROR(Did not find GnomePrint installed) -fi -GNOME_PRINT_LIBS=`gnome-config --libs print` -GNOME_PRINT_CFLAGS=`gnome-config --cflags print` -AC_SUBST(GNOME_PRINT_LIBS) -AC_SUBST(GNOME_PRINT_CFLAGS) - -dnl ************************************************** -dnl * ORBit support -dnl ************************************************** -dnl GNOMEGNORBA_LIBS="$GNOMEGNORBA_LIBS" -dnl AC_SUBST(GNOMEGNORBA_LIBS) - - -dnl ****************************** -dnl Check for Bonobo -dnl ****************************** -AC_MSG_CHECKING(for Bonobo > 0.5) -if gnome-config --libs bonobo > /dev/null 2>&1; then - vers=`gnome-config --modversion bonobo` - case $vers - in - bonobo-0.[[012345]]) bonobo_ok=false ;; - *) bonobo_ok=true ;; - esac -else - bonobo_ok=false -fi - -if $bonobo_ok; then - AC_MSG_RESULT(found) -else - AC_MSG_ERROR(Bonobo 0.5 is required to compile Evolution) -fi - - -dnl ****************************** -dnl LibGlade checking -dnl ****************************** -AC_MSG_CHECKING(For Glade libraries) -if gnome-config --libs libglade > /dev/null 2>&1; then - AC_MSG_RESULT(found) -else - AC_MSG_ERROR(Did not find libGlade installed) -fi - -dnl ****************************** -dnl libunicode checking -dnl ****************************** -AC_MSG_CHECKING(For libunicode) -if unicode-config --libs > /dev/null 2>&1; then - UNICODE_LIBS=`unicode-config --libs` - UNICODE_CFLAGS=`unicode-config --cflags` - AC_SUBST(UNICODE_LIBS) - AC_SUBST(UNICODE_CFLAGS) - AC_MSG_RESULT(found) -else - AC_MSG_ERROR(libunicode not found) -fi - -dnl ****************************** -dnl GdkPixbuf checking -dnl ****************************** -AC_MSG_CHECKING(For Gdkpixbuf libraries) -if gnome-config --libs gdk_pixbuf gnomecanvaspixbuf > /dev/null 2>&1; then - AC_MSG_RESULT(found) -else - AC_MSG_ERROR(Did not find gdkpixbuf installed) -fi - -if $have_pthread; then - THREADS_LIBS="$PTHREAD_LIB `glib-config --libs gthread`" - THREADS_CFLAGS="`glib-config --cflags gthread`" -else - THREADS_LIBS="" - THREADS_CFLAGS="" -fi - -GLIB_CFLAGS="`glib-config --cflags`" -GLIB_LIBS="`glib-config --libs`" - -AC_SUBST(GLIB_CFLAGS) -AC_SUBST(GLIB_LIBS) - - -EXTRA_GNOME_LIBS="`gnome-config --libs libglade gdk_pixbuf gnomecanvaspixbuf gnomeui ` $THREADS_LIBS `unicode-config --libs`" -EXTRA_GNOME_CFLAGS="`gnome-config --cflags libglade gdk_pixbuf gnomecanvaspixbuf gnomeui ` $THREADS_CFLAGS `unicode-config --cflags`" - -AC_SUBST(EXTRA_GNOME_LIBS) -AC_SUBST(EXTRA_GNOME_CFLAGS) - - -BONOBO_GNOME_LIBS="`gnome-config --libs bonobo libglade gdk_pixbuf gnomecanvaspixbuf gnomeui`" -BONOBO_GNOME_CFLAGS="`gnome-config --cflags bonobo libglade gdk_pixbuf gnomecanvaspixbuf gnomeui `" -AC_SUBST(BONOBO_GNOME_LIBS) -AC_SUBST(BONOBO_GNOME_CFLAGS) - -BONOBO_HTML_GNOME_LIBS="`gnome-config --libs bonobo libglade gdk_pixbuf gtkhtml gnomecanvaspixbuf gnomeui ` `glib-config --libs gthread`" -BONOBO_HTML_GNOME_CFLAGS="`gnome-config --cflags bonobo libglade gdk_pixbuf gtkhtml gnomecanvaspixbuf gnomeui ` `glib-config --cflags gthread`" -AC_SUBST(BONOBO_HTML_GNOME_LIBS) -AC_SUBST(BONOBO_HTML_GNOME_CFLAGS) - - -dnl ****************************** -dnl Gnome-VFS checking -dnl ****************************** -AC_MSG_CHECKING(for GNOME-VFS) -if gnome-config --libs vfs > /dev/null 2>&1; then - vfs_ok=true -else - vfs_ok=false -fi - -if $vfs_ok; then - AC_MSG_RESULT(found) -else - AC_MSG_ERROR(GNOME-VFS is required to compile Evolution) -fi - -BONOBO_VFS_GNOME_LIBS="`gnome-config --libs bonobo libglade gdk_pixbuf gnomecanvaspixbuf vfs gnomeui `" -BONOBO_VFS_GNOME_CFLAGS="`gnome-config --cflags bonobo libglade gdk_pixbuf gnomecanvaspixbuf vfs gnomeui `" -AC_SUBST(BONOBO_VFS_GNOME_LIBS) -AC_SUBST(BONOBO_VFS_GNOME_CFLAGS) - -dnl ****************************** -dnl Pilot checking -dnl ****************************** -GNOME_PILOT_CHECK - - -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_CONFIG_SUBDIRS(libical) - -AC_SUBST(CAPPLET_LIBS) - -AC_OUTPUT([ -Makefile -macros/Makefile -intl/Makefile -po/Makefile.in -e-util/Makefile -doc/Makefile -libibex/Makefile -camel/Makefile -camel/providers/Makefile -camel/providers/MH/Makefile -camel/providers/maildir/Makefile -camel/providers/mbox/Makefile -camel/providers/sendmail/Makefile -composer/Makefile -devel-docs/Makefile -devel-docs/camel/Makefile -tests/Makefile -tests/ui-tests/Makefile -widgets/Makefile -widgets/e-text/Makefile -widgets/e-minicard/Makefile -widgets/meeting-time-sel/Makefile -widgets/shortcut-bar/Makefile -widgets/e-table/Makefile -addressbook/Makefile -addressbook/contact-editor/Makefile -addressbook/printing/Makefile -shell/Makefile -mail/Makefile -data/Makefile -libversit/Makefile -libical/Makefile -libical/src/Makefile -libical/src/libical/Makefile -libical/src/libicalss/Makefile -libibex/Makefile -calendar/Makefile -calendar/doc/Makefile -calendar/doc/C/Makefile -]) diff --git a/data/.cvsignore b/data/.cvsignore deleted file mode 100644 index 282522db03..0000000000 --- a/data/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/data/Makefile.am b/data/Makefile.am deleted file mode 100644 index 1ae1b2443e..0000000000 --- a/data/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -EXTRA_DIST = \ - evolution.desktop \ No newline at end of file diff --git a/data/evolution.desktop b/data/evolution.desktop deleted file mode 100644 index 946c4a8ec8..0000000000 --- a/data/evolution.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Name=Evolution -Name[no]=Evolution -Comment=Mail, Contacts and Task. -Comment[no]=E-post, kontakter og oppgaver. -Exec=evolution -Terminal=0 -Type=Application 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 @@ - - - - - - - - -]> - - - - Camel Messaging Library Reference Manual - - - - Camel Objects - &CamelMimeMessage; - &CamelService; - &CamelStore; - &CamelFolder; - &CamelMimePart; - &CamelDataWrapper; - &CamelRecipient; - - - 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 @@ - -gnome.h -camel-data-wrapper.h - - -
-camel-data-wrapper -CamelDataWrapper -CamelDataWrapper -camel_data_wrapper_write_to_stream - -CAMEL_DATA_WRAPPER -camel_data_wrapper_get_type -CAMEL_DATA_WRAPPER_CLASS -
- -
-camel-recipient -CamelRecipientTable -CamelRecipientTable -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 -
- -
-camel-mime-part -CamelMimePart -CamelMimePart -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 - -CAMEL_MIME_PART -camel_mime_part_get_type -CAMEL_MIME_PART_CLASS -
- - - -
-camel-mime-message -CamelMimeMessage -CamelMimeMessage -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 - -CAMEL_MIME_MESSAGE -camel_mime_message_get_type -CAMEL_MIME_MESSAGE_CLASS -
- - -
-camel-folder -CamelFolder -CamelFolder -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 - -CAMEL_FOLDER -camel_folder_get_type -CAMEL_FOLDER_CLASS -
- -
-camel-service -CamelService -CamelService -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 - -CAMEL_SERVICE -camel_service_get_type -CAMEL_SERVICE_CLASS -
- -
-camel-store -CamelStore -CamelStore -camel_store_get_separator -camel_store_get_folder - -CAMEL_STORE -camel_store_get_type -CAMEL_STORE_CLASS -
- - -
-camel-stream -CamelStream -CamelStream -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 - -CAMEL_STREAM -camel_stream_get_type -CAMEL_STREAM_CLASS -
- - 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 -#include -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 @@ - -CamelDataWrapper - - -data container with streaming methods - - - -A CamelDataWrapper is wrapper around data which can save them to a stream -and restore them from a stream. - - - - - - - - - - - - -@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 @@ - -CamelFolder - - -Represents a folder of messages on a store. - - - -CamelFolder represents a folder in a message store. - - - - - - - - - - - - - - - - - - -@folder: -@folder_name: -@Returns: - - - - - - - -@folder: -@Returns: - - - - - - - -@folder: -@recurse: -@Returns: - - - - - - - -@folder: -@Returns: - - - - - - - -@folder: -@Returns: - - - - - - - -@folder: -@Returns: - - - - - - - -@folder: -@Returns: - - - - - - - -@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 @@ - -CamelMimeMessage - - - - - - - - - - - - - - - - - - - - - - - - - -@mime_message: -@recipient_type: -@recipient: - - - - - - - -@mime_message: -@recipient_type: -@Returns: - - - - - - - -@mime_message: -@flag: -@value: - - - - - - - -@mime_message: -@subject: - - - - - - - -@mime_message: -@Returns: - - - - - - - -@mime_message: -@Returns: - - - - - - - -@mime_message: -@reply_to: - - - - - - - -@mime_message: -@Returns: - - - - - - - -@session: -@Returns: - - - - - - - -@mime_message: -@recipient_type: -@recipient: - - - - - - - -@mime_message: -@Returns: - - - - - - - -@mime_message: -@from: - - - - - - - -@mime_message: -@flag: -@Returns: - - - - - - - -@mime_message: -@Returns: - - - - - - - -@mime_message: -@Returns: - - - - - - - -@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 @@ - -CamelMimePart - - - - - - - - - - - - - - - - - - - -@mime_part: -@filename: - - - - - - - -@mime_part: -@Returns: - - - - - - - -@mime_part: -@Returns: - - - - - - - -@mime_part: -@Returns: - - - - - - - -@mime_part: -@header_lines: - - - - - - - -@mime_part: -@Returns: - - - - - - - -@mime_part: -@description: - - - - - - - -@camel_mime_part: -@text: - - - - - - - -@mime_part: -@encoding: - - - - - - - -@mime_part: -@disposition: - - - - - - - -@mime_part: -@Returns: - - - - - - - -@mime_part: -@Returns: - - - - - - - -@mime_part: -@content_languages: - - - - - - - -@mime_part: -@Returns: - - - - - - - -@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 @@ - -CamelRecipientTable - - - - - - - - - - - - - - - - - - - -@recipient_hash_table: -@ref_count: - - - - - - -@Returns: - - - - - - - -@recipient_table: - - - - - - - -@recipient_table: -@recipient_type: -@Returns: - - - - - - - -@recipient_table: -@recipient_type: -@recipient: - - - - - - - -@recipient_table: -@recipient_type: -@recipient: - - - - - - - -@recipient_table: -@recipient_type: -@recipient_list: - - - - - - - -@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 @@ - -CamelService - - - - - - - - - - - - - - - - - - - -@e: - - - - - - -@service: - - - - - - - -@service: -@Returns: - - - - - - - -@service: -@host: -@login: -@passwd: - - - - - - - -@service: -@host: -@login: -@passwd: -@port: - - - - - - - -@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 @@ - -CamelStore - - - -A class representing a message (local or distant) repository - - - -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. - - - - - - - - - - - - - - - - - - -@store: -@Returns: - - - - - - - -@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 @@ - -CamelStream - - - - - - - - - - - - - - - - - - - -@stream: -@offset: -@policy: -@Returns: - - - - - - - -@stream: -@buffer: -@n: -@Returns: - - - - - - - -@stream: - - - - - - - -@stream: -@Returns: - - - - - - - -@stream: -@string: - - - - - - - -@stream: - - - - - - - -@stream: -@Varargs: - - - - - - - -@stream: -@buffer: -@n: -@Returns: - - - - - - - -@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 -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 - - --- - -[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 @@ - - - - -
- - - - Giao - Nguyen - - - - An in-depth look at the virtual folder mechanism - - - 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/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 - -* 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 - 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 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/.cvsignore b/doc/.cvsignore deleted file mode 100644 index 550bd25cdb..0000000000 --- a/doc/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile - 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 7b7cf6f821..0000000000 --- a/doc/Design +++ /dev/null @@ -1,201 +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 and a number of auxiliary - CORBA servers that act as the storage backends. - - Evolution will copy the best user interface bits and the best - ideas and features found on contemporary groupware systems. - -* Evolution internals. - - Evolution can store its information locally (files for mail, - calendar and address book) or on a remote server (imap/pop, - cap, ldap). - - Given the importance of syncing in this modern PDA world, - the Evolution GUI acts as a client to the data repository. - The data repository is a GUI-less CORBA server called Wombat. - - Wombat provides a unified access system to the calendar and - addressbook data (doing mail is a bit hard, so we are leaving - this as a TODO item for now). - - Wombat's CORBA interfaces are notifier-based. This means that - CORBA requests sent to Wombat do not return values - inmediately, but rather than for Wombat requests the user has - to provide a CORBA object that will be notified of what - happened. - - Yes, that sounds hairy. It is actually pretty simple. It - basically means that you submit requests to Wombat, and a - callback is invoked in your code when the request has been - carried away. - - This enables a Palm to sync to the repository without having - the GUI for Evolution running. It also means that volunteers - will be able to write text-based and web-based versions of - Evolution (not me though :-). - -* Evolution as a platform - - Evolution is more than a client for managing the above - information: Evolution is a platform for building groupware - applications that use the above components to get their work done. - - To achieve this Evolution is designed to be scriptable, and it - exports its internals trough CORBA/Bonobo. It is implemented - as a collection of Bonobo containers and Bonobo components. - - There is a clean separation between the views (the user - interface) and the model (the view). The views that we are - writing are GNOME based, and they talk to the Wombat CORBA - server. - - Wombat takes care of notifications to the various clients for - the data. - -* 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). - -** Folders - - Michael Zucchi is working on a system that will let users - easily define rules for splitting their incoming mail into - physical folders. - - A further refinement to Folders are Virtual Folders. This - basically provides a powerful search and viewing facility for - mail. It works like this: when a mail is "incorporated" into - Evolution it is scanned and indexed. - - Then users can enter queries into Evolution that will search - the entire database of messages. - -** 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. - - Ettore has been working on adding editing support to the - GtkHTML and he is working currently on a Bonobo component that - will provide a ready-to-use Bonobo control for embedding into - other applications. - diff --git a/e-util/.cvsignore b/e-util/.cvsignore deleted file mode 100644 index 9a6392159c..0000000000 --- a/e-util/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -.deps -Makefile.in -Makefile diff --git a/e-util/Makefile.am b/e-util/Makefile.am deleted file mode 100644 index c6058791dd..0000000000 --- a/e-util/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -INCLUDES = \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = libeutil.a - -libeutil_a_SOURCES = \ - e-canvas.c \ - e-canvas.h \ - e-canvas-utils.c\ - e-canvas-utils.h\ - e-cursors.c \ - e-cursors.h \ - e-gui-utils.c \ - e-gui-utils.h \ - e-setup.c \ - e-setup.h \ - e-util.c \ - e-util.h \ - e-xml-utils.c \ - e-xml-utils.h diff --git a/e-util/e-canvas-utils.c b/e-util/e-canvas-utils.c deleted file mode 100644 index 2b50248124..0000000000 --- a/e-util/e-canvas-utils.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "e-canvas-utils.h" - -void -e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy) -{ - double translate[6]; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - art_affine_translate (translate, dx, dy); - - gnome_canvas_item_affine_absolute (item, translate); -} diff --git a/e-util/e-canvas-utils.h b/e-util/e-canvas-utils.h deleted file mode 100644 index 9580f64f96..0000000000 --- a/e-util/e-canvas-utils.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-utils.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_CANVAS_UTILS__ -#define __E_CANVAS_UTILS__ - -#include -void e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy); - -#endif /* __E_CANVAS_UTILS__ */ diff --git a/e-util/e-canvas.c b/e-util/e-canvas.c deleted file mode 100644 index 850e438386..0000000000 --- a/e-util/e-canvas.c +++ /dev/null @@ -1,301 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-canvas.h" -static void e_canvas_init (ECanvas *card); -static void e_canvas_class_init (ECanvasClass *klass); -static gint e_canvas_key (GtkWidget *widget, - GdkEventKey *event); - -static gint e_canvas_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint e_canvas_focus_out (GtkWidget *widget, - GdkEventFocus *event); - -static int emit_event (GnomeCanvas *canvas, GdkEvent *event); - -static GnomeCanvasClass *parent_class = NULL; - -GtkType -e_canvas_get_type (void) -{ - static GtkType canvas_type = 0; - - if (!canvas_type) - { - static const GtkTypeInfo canvas_info = - { - "ECanvas", - sizeof (ECanvas), - sizeof (ECanvasClass), - (GtkClassInitFunc) e_canvas_class_init, - (GtkObjectInitFunc) e_canvas_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - canvas_type = gtk_type_unique (gnome_canvas_get_type (), &canvas_info); - } - - return canvas_type; -} - -static void -e_canvas_class_init (ECanvasClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasClass *canvas_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass*) klass; - canvas_class = (GnomeCanvasClass *) klass; - widget_class = (GtkWidgetClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_get_type ()); - - widget_class->key_press_event = e_canvas_key; - widget_class->key_release_event = e_canvas_key; - widget_class->focus_in_event = e_canvas_focus_in; - widget_class->focus_out_event = e_canvas_focus_out; -} - -static void -e_canvas_init (ECanvas *canvas) -{ -} - -GtkWidget * -e_canvas_new() -{ - return GTK_WIDGET (gtk_type_new (e_canvas_get_type ())); -} - - -/* Returns whether the item is an inferior of or is equal to the parent. */ -static int -is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) -{ - for (; item; item = item->parent) - if (item == parent) - return TRUE; - - return FALSE; -} - -/* Emits an event for an item in the canvas, be it the current item, grabbed - * item, or focused item, as appropriate. - */ -static int -emit_event (GnomeCanvas *canvas, GdkEvent *event) -{ - GdkEvent ev; - gint finished; - GnomeCanvasItem *item; - GnomeCanvasItem *parent; - guint mask; - - /* Perform checks for grabbed items */ - - if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item)) - return FALSE; - - if (canvas->grabbed_item) { - switch (event->type) { - case GDK_ENTER_NOTIFY: - mask = GDK_ENTER_NOTIFY_MASK; - break; - - case GDK_LEAVE_NOTIFY: - mask = GDK_LEAVE_NOTIFY_MASK; - break; - - case GDK_MOTION_NOTIFY: - mask = GDK_POINTER_MOTION_MASK; - break; - - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - mask = GDK_BUTTON_PRESS_MASK; - break; - - case GDK_BUTTON_RELEASE: - mask = GDK_BUTTON_RELEASE_MASK; - break; - - case GDK_KEY_PRESS: - mask = GDK_KEY_PRESS_MASK; - break; - - case GDK_KEY_RELEASE: - mask = GDK_KEY_RELEASE_MASK; - break; - - default: - mask = 0; - break; - } - - if (!(mask & canvas->grabbed_event_mask)) - return FALSE; - } - - /* Convert to world coordinates -- we have two cases because of diferent - * offsets of the fields in the event structures. - */ - - ev = *event; - - switch (ev.type) { - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - gnome_canvas_window_to_world (canvas, - ev.crossing.x, ev.crossing.y, - &ev.crossing.x, &ev.crossing.y); - break; - - case GDK_MOTION_NOTIFY: - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - gnome_canvas_window_to_world (canvas, - ev.motion.x, ev.motion.y, - &ev.motion.x, &ev.motion.y); - break; - - default: - break; - } - - /* Choose where we send the event */ - - item = canvas->current_item; - - if (canvas->focused_item - && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) - item = canvas->focused_item; - - /* The event is propagated up the hierarchy (for if someone connected to - * a group instead of a leaf event), and emission is stopped if a - * handler returns TRUE, just like for GtkWidget events. - */ - - finished = FALSE; - - while (item && !finished) { - gtk_object_ref (GTK_OBJECT (item)); - - gtk_signal_emit_by_name (GTK_OBJECT (item), "event", - &ev, - &finished); - - if (GTK_OBJECT_DESTROYED (item)) - finished = TRUE; - - parent = item->parent; - gtk_object_unref (GTK_OBJECT (item)); - - item = parent; - } - - return finished; -} - -/* Key event handler for the canvas */ -static gint -e_canvas_key (GtkWidget *widget, GdkEventKey *event) -{ - GnomeCanvas *canvas; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - canvas = GNOME_CANVAS (widget); - - return emit_event (canvas, (GdkEvent *) event); -} - - -/** - * e_canvas_item_grab_focus: - * @item: A canvas item. - * - * Makes the specified item take the keyboard focus, so all keyboard events will - * be sent to it. If the canvas widget itself did not have the focus, it grabs - * it as well. - **/ -void -e_canvas_item_grab_focus (GnomeCanvasItem *item) -{ - GnomeCanvasItem *focused_item; - GdkEvent ev; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - g_return_if_fail (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (item->canvas))); - - focused_item = item->canvas->focused_item; - - if (focused_item) { - ev.focus_change.type = GDK_FOCUS_CHANGE; - ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = FALSE; - - emit_event (item->canvas, &ev); - } - - item->canvas->focused_item = item; - gtk_widget_grab_focus (GTK_WIDGET (item->canvas)); -} - -/* Focus in handler for the canvas */ -static gint -e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - - canvas = GNOME_CANVAS (widget); - - if (canvas->focused_item) - return emit_event (canvas, (GdkEvent *) event); - else - return FALSE; -} - -/* Focus out handler for the canvas */ -static gint -e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - - canvas = GNOME_CANVAS (widget); - - if (canvas->focused_item) - return emit_event (canvas, (GdkEvent *) event); - else - return FALSE; -} diff --git a/e-util/e-canvas.h b/e-util/e-canvas.h deleted file mode 100644 index 0ece5ae3b4..0000000000 --- a/e-util/e-canvas.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-canvas.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CANVAS_H__ -#define __E_CANVAS_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ECanvas - A class derived from canvas for the purpose of adding - * evolution specific canvas hacks. - */ - -#define E_CANVAS_TYPE (e_canvas_get_type ()) -#define E_CANVAS(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_TYPE, ECanvas)) -#define E_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass)) -#define E_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_TYPE)) -#define E_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE)) - - -typedef struct _ECanvas ECanvas; -typedef struct _ECanvasClass ECanvasClass; - -struct _ECanvas -{ - GnomeCanvas parent; - - /* item specific fields */ -}; - -struct _ECanvasClass -{ - GnomeCanvasClass parent_class; -}; - - -GtkType e_canvas_get_type (void); -GtkWidget *e_canvas_new (void); - -/* Used to send all of the keystroke events to a specific item as well as - * GDK_FOCUS_CHANGE events. - */ -void e_canvas_item_grab_focus (GnomeCanvasItem *item); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CANVAS_H__ */ 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 -#include -#include "e-cursors.h" - -static GdkColor black, white; - -#define GDK_INTERNAL_CURSOR -1 - -typedef struct { - GdkCursor *cursor; - int hot_x, hot_y; - char **xpm; -} CursorDef; - -static CursorDef cursors [] = { - { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_LEFT_PTR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL }, - { NULL, 0, 0, NULL } -}; - - -static void -create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm) -{ - int height, width, colors; - char pixmap_buffer [(32 * 32)/8]; - char mask_buffer [(32 * 32)/8]; - int x, y, pix, yofs; - int transparent_color, black_color; - - sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix); - - g_assert (height == 32); - g_assert (width == 32); - g_assert (colors <= 3); - - transparent_color = ' '; - black_color = '.'; - - yofs = colors + 1; - for (y = 0; y < 32; y++){ - for (x = 0; x < 32;){ - char value = 0, maskv = 0; - - for (pix = 0; pix < 8; pix++, x++){ - if (xpm [y + yofs][x] != transparent_color){ - maskv |= 1 << pix; - - /* - * Invert the colours here because it seems - * to workaround a bug the Matrox G100 Xserver? - * We reverse the foreground & background in the next - * routine to compensate. - */ - if (xpm [y + yofs][x] == black_color){ - value |= 1 << pix; - } - } - } - pixmap_buffer [(y * 4 + x/8)-1] = value; - mask_buffer [(y * 4 + x/8)-1] = maskv; - } - } - *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32); - *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32); -} - -void -e_cursors_init (void) -{ - GdkColormap *colormap; - int i; - - colormap = gtk_widget_get_default_colormap (); - gdk_color_white (colormap, &white); - gdk_color_black (colormap, &black); - - for (i = 0; cursors [i].hot_x; i++){ - GdkBitmap *bitmap, *mask; - - if (cursors [i].hot_x < 0) - cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y); - else { - create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm); - - /* The foreground and background colours are reversed. - * See comment above for explanation. - */ - cursors [i].cursor = - gdk_cursor_new_from_pixmap ( - bitmap, mask, - &black, &white, - cursors [i].hot_x, - cursors [i].hot_y); - } - } - - g_assert (i == E_NUM_CURSORS); -} - -void -e_cursors_shutdown (void) -{ - int i; - - for (i = 0; cursors [i].hot_x; i++) - gdk_cursor_destroy (cursors [i].cursor); -} - - -/* Returns a cursor given its type */ -GdkCursor * -e_cursor_get (ECursorType type) -{ - g_return_val_if_fail (type >= 0 && type < E_NUM_CURSORS, NULL); - - return cursors [type].cursor; -} diff --git a/e-util/e-cursors.h b/e-util/e-cursors.h deleted file mode 100644 index 771e5f6d4d..0000000000 --- a/e-util/e-cursors.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef E_CURSORS_H -#define E_CURSORS_H - -/* Copied from Gnumeric */ - -typedef enum { - E_CURSOR_THIN_CROSS, - E_CURSOR_ARROW, - E_CURSOR_MOVE, - E_CURSOR_SIZE_X, - E_CURSOR_SIZE_Y, - E_NUM_CURSORS -} ECursorType; - -void e_cursors_init (void); -void e_cursors_shutdown (void); - -#define e_cursor_set(win, c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, e_cursor_get (c)); \ -} G_STMT_END - -#define e_cursor_set_widget(w, c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \ -} G_STMT_END - -GdkCursor *e_cursor_get (ECursorType type); - -#endif /* E_CURSORS_H */ - diff --git a/e-util/e-gui-utils.c b/e-util/e-gui-utils.c deleted file mode 100644 index 9387d5015d..0000000000 --- a/e-util/e-gui-utils.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * GUI utility functions - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 1999 Miguel de Icaza - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include -#include "e-gui-utils.h" - -void -e_notice (GtkWindow *window, const char *type, const char *format, ...) -{ - GtkWidget *dialog; - va_list args; - char *str; - - va_start (args, format); - str = g_strdup_vprintf (format, args); - dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL); - va_end (args); - g_free (str); - - if (window) - gnome_dialog_set_parent (GNOME_DIALOG (dialog), window); - - gnome_dialog_run (GNOME_DIALOG (dialog)); -} - -static void -kill_popup_menu (GtkWidget *widget, GtkMenu *menu) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - gtk_object_unref (GTK_OBJECT (menu)); -} - -void -e_auto_kill_popup_menu_on_hide (GtkMenu *menu) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - gtk_signal_connect (GTK_OBJECT (menu), "hide", - GTK_SIGNAL_FUNC (kill_popup_menu), menu); -} - -void -e_popup_menu (GtkMenu *menu, GdkEventButton *event) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - e_auto_kill_popup_menu_on_hide (menu); - gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time); -} - - diff --git a/e-util/e-gui-utils.h b/e-util/e-gui-utils.h deleted file mode 100644 index b5518f032b..0000000000 --- a/e-util/e-gui-utils.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef E_GUI_UTILS_H -#define E_GUI_UTILS_H - -#include -#include - -void e_popup_menu (GtkMenu *menu, GdkEventButton *event); -void e_auto_kill_popup_menu_on_hide (GtkMenu *menu); -void e_notice (GtkWindow *window, const char *type, const char *format, ...); - - -#endif /* E_GUI_UTILS_H */ diff --git a/e-util/e-setup.c b/e-util/e-setup.c deleted file mode 100644 index 28a43e3a22..0000000000 --- a/e-util/e-setup.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Sets up the ~/evolution directory - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. http://www.helixcode.com - */ -#include -#include -#include -#include -#include "e-setup.h" - -char *evolution_dir = NULL; -char *evolution_folders_dir = NULL; -char *evolution_private = NULL; -char *evolution_public = NULL; - -gboolean -e_setup_base_dir (void) -{ - struct stat s; - - evolution_dir = g_concat_dir_and_file (g_get_home_dir (), "evolution"); - - if (stat (evolution_dir, &s) == -1){ - if (mkdir (evolution_dir, S_IRWXU) == -1){ - return FALSE; - } - } else { - if (!S_ISDIR (s.st_mode)){ - char *msg; - - g_error ("Finish implementing this"); - - msg = g_strdup_printf ( - _("Evolution detected that the file `%s' is a not a directory.\n" - "\n" - "Evolution can rename the file, delete the file or shutdown and\n" - "let you fix the problem.")); - return FALSE; - } - } - - evolution_folders_dir = g_concat_dir_and_file (evolution_dir, "folders"); - mkdir (evolution_folders_dir, S_IRWXU); - - return TRUE; -} - diff --git a/e-util/e-setup.h b/e-util/e-setup.h deleted file mode 100644 index 1c787473d9..0000000000 --- a/e-util/e-setup.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EVOLUTION_UTIL_SETUP_H -#define EVOLUTION_UTIL_SETUP_H - -#include - -gboolean e_setup_base_dir (void); - -extern char *evolution_folders_dir; -extern char *evolution_dir; - -#endif /* EVOLUTION_UTIL_SETUP_H */ diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c deleted file mode 100644 index 41bcd0c31d..0000000000 --- a/e-util/e-text-event-processor-emacs-like.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-text-event-processor-emacs-like.h" -static void e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *card); -static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass); -static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -static ETextEventProcessorClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0 -}; - -static const ETextEventProcessorCommand control_keys[26] = -{ - { E_TEP_START_OF_LINE, E_TEP_MOVE, 0, "" }, /* a */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_COPY, 0, "" }, /* c */ - { E_TEP_FORWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_END_OF_LINE, E_TEP_MOVE, 0, "" }, /* e */ - { E_TEP_FORWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_END_OF_LINE, E_TEP_DELETE, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_FORWARD_LINE, E_TEP_MOVE, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_BACKWARD_LINE, E_TEP_MOVE, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_START_OF_LINE, E_TEP_DELETE, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* v */ - { E_TEP_BACKWARD_WORD, E_TEP_DELETE, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ -}; - -static const ETextEventProcessorCommand alt_keys[26] = -{ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* a */ - { E_TEP_BACKWARD_WORD, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* c */ - { E_TEP_FORWARD_WORD, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* e */ - { E_TEP_FORWARD_WORD, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* v */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ - -}; - -GtkType -e_text_event_processor_emacs_like_get_type (void) -{ - static GtkType text_event_processor_emacs_like_type = 0; - - if (!text_event_processor_emacs_like_type) - { - static const GtkTypeInfo text_event_processor_emacs_like_info = - { - "ETextEventProcessorEmacsLike", - sizeof (ETextEventProcessorEmacsLike), - sizeof (ETextEventProcessorEmacsLikeClass), - (GtkClassInitFunc) e_text_event_processor_emacs_like_class_init, - (GtkObjectInitFunc) e_text_event_processor_emacs_like_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_emacs_like_type = gtk_type_unique (e_text_event_processor_get_type (), &text_event_processor_emacs_like_info); - } - - return text_event_processor_emacs_like_type; -} - -static void -e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass) -{ - GtkObjectClass *object_class; - ETextEventProcessorClass *processor_class; - - object_class = (GtkObjectClass*) klass; - processor_class = (ETextEventProcessorClass*) klass; - - parent_class = gtk_type_class (e_text_event_processor_get_type ()); - - processor_class->event = e_text_event_processor_emacs_like_event; -} - -static void -e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *tep) -{ -} - -static gint -e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - ETextEventProcessorCommand command; - ETextEventProcessorEmacsLike *tep_el = E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(tep); - command.action = E_TEP_NOP; - switch (event->type) { - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - command.action = E_TEP_GRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - if (event->button.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - tep_el->mouse_down = TRUE; - } - break; - case GDK_BUTTON_RELEASE: - if (event->button.button == 1) { - command.action = E_TEP_UNGRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - command.time = event->button.time; - tep_el->mouse_down = FALSE; - } else if (event->button.button == 2) { - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_GET_SELECTION; - command.position = E_TEP_SELECTION; - command.value = 0; - command.time = event->button.time; - } - break; - case GDK_MOTION_NOTIFY: - if (tep_el->mouse_down) { - command.action = E_TEP_SELECT; - command.position = E_TEP_VALUE; - command.time = event->motion.time; - command.value = event->motion.position; - } - break; - case GDK_KEY_PRESS: - { - ETextEventProcessorEventKey key = event->key; - command.time = event->key.time; - if (key.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - switch(key.keyval) { - case GDK_Home: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_START_OF_BUFFER; - else - command.position = E_TEP_START_OF_LINE; - break; - case GDK_End: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_END_OF_BUFFER; - else - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break; - case GDK_Page_Down: command.position = E_TEP_FORWARD_PAGE; break; - /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */ - case GDK_Up: command.position = E_TEP_BACKWARD_LINE; break; - case GDK_Down: command.position = E_TEP_FORWARD_LINE; break; - case GDK_Left: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Right: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_FORWARD_WORD; - else - command.position = E_TEP_FORWARD_CHARACTER; - break; - - case GDK_BackSpace: - command.action = E_TEP_DELETE; - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Clear: - command.action = E_TEP_DELETE; - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Insert: - if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_PASTE; - command.position = E_TEP_SELECTION; - } else if (key.state & GDK_CONTROL_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - } else { - /* gtk_toggle_insert(text) -- IMPLEMENT */ - } - break; - case GDK_Delete: - if (key.state & GDK_CONTROL_MASK){ - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_WORD; - } else if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } else { - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_CHARACTER; - } - break; - case GDK_Tab: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - case GDK_Return: - if (key.state & GDK_CONTROL_MASK) { - command.action = E_TEP_ACTIVATE; - command.position = E_TEP_SELECTION; - } else { - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "\n"; - } - break; - case GDK_Escape: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - - default: - if (key.state & GDK_CONTROL_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = control_keys[(int) (key.keyval - 'a')].position; - if (control_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = control_keys[(int) (key.keyval - 'a')].action; - command.value = control_keys[(int) (key.keyval - 'a')].value; - command.string = control_keys[(int) (key.keyval - 'a')].string; - } - - if (key.keyval == 'x') { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } - - break; - } else if (key.state & GDK_MOD1_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = alt_keys[(int) (key.keyval - 'a')].position; - if (alt_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = alt_keys[(int) (key.keyval - 'a')].action; - command.value = alt_keys[(int) (key.keyval - 'a')].value; - command.string = alt_keys[(int) (key.keyval - 'a')].string; - } - } else if (key.length > 0) { - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = strlen(key.string); - command.string = key.string; - - } else { - command.action = E_TEP_NOP; - } - } - break; - case GDK_KEY_RELEASE: - command.time = event->key.time; - command.action = E_TEP_NOP; - break; - default: - command.action = E_TEP_NOP; - break; - } - } - if (command.action != E_TEP_NOP) { - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - return 1; - } - else - return 0; -} - -ETextEventProcessor * -e_text_event_processor_emacs_like_new (void) -{ - ETextEventProcessorEmacsLike *retval = gtk_type_new (e_text_event_processor_emacs_like_get_type ()); - return E_TEXT_EVENT_PROCESSOR (retval); -} - diff --git a/e-util/e-text-event-processor-emacs-like.h b/e-util/e-text-event-processor-emacs-like.h deleted file mode 100644 index 651bb552b3..0000000000 --- a/e-util/e-text-event-processor-emacs-like.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor-emacs-like.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ -#define __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ - -#include -#include "e-text-event-processor.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessorEmacsLike - Turns events on a text widget into commands. Uses an emacs-ish interface. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE (e_text_event_processor_emacs_like_get_type ()) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike)) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) - - -typedef struct _ETextEventProcessorEmacsLike ETextEventProcessorEmacsLike; -typedef struct _ETextEventProcessorEmacsLikeClass ETextEventProcessorEmacsLikeClass; - -struct _ETextEventProcessorEmacsLike -{ - ETextEventProcessor parent; - - /* object specific fields */ - gboolean mouse_down; -}; - -struct _ETextEventProcessorEmacsLikeClass -{ - ETextEventProcessorClass parent_class; -}; - - -GtkType e_text_event_processor_emacs_like_get_type (void); -ETextEventProcessor *e_text_event_processor_emacs_like_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ */ diff --git a/e-util/e-text-event-processor-types.h b/e-util/e-text-event-processor-types.h deleted file mode 100644 index 32a39bf0c0..0000000000 --- a/e-util/e-text-event-processor-types.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 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/. - */ - -#ifndef __E_TEXT_EVENT_PROCESSOR_TYPES_H__ -#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__ - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include - -typedef enum _ETextEventProcessorCommandPosition ETextEventProcessorCommandPosition; -typedef enum _ETextEventProcessorCommandAction ETextEventProcessorCommandAction; -typedef struct _ETextEventProcessorCommand ETextEventProcessorCommand; - -typedef union _ETextEventProcessorEvent ETextEventProcessorEvent; -typedef struct _ETextEventProcessorEventButton ETextEventProcessorEventButton; -typedef struct _ETextEventProcessorEventKey ETextEventProcessorEventKey; -typedef struct _ETextEventProcessorEventMotion ETextEventProcessorEventMotion; - -enum _ETextEventProcessorCommandPosition { - E_TEP_VALUE, - E_TEP_SELECTION, - - E_TEP_START_OF_BUFFER, - E_TEP_END_OF_BUFFER, - - E_TEP_START_OF_LINE, - E_TEP_END_OF_LINE, - - E_TEP_FORWARD_CHARACTER, - E_TEP_BACKWARD_CHARACTER, - - E_TEP_FORWARD_WORD, - E_TEP_BACKWARD_WORD, - - E_TEP_FORWARD_LINE, - E_TEP_BACKWARD_LINE, - - E_TEP_FORWARD_PARAGRAPH, - E_TEP_BACKWARD_PARAGRAPH, - - E_TEP_FORWARD_PAGE, - E_TEP_BACKWARD_PAGE -}; - -enum _ETextEventProcessorCommandAction { - E_TEP_MOVE, - E_TEP_SELECT, - E_TEP_DELETE, - E_TEP_INSERT, - - E_TEP_COPY, - E_TEP_PASTE, - E_TEP_GET_SELECTION, - E_TEP_SET_SELECT_BY_WORD, - E_TEP_ACTIVATE, - - E_TEP_GRAB, - E_TEP_UNGRAB, - - E_TEP_NOP -}; - -struct _ETextEventProcessorCommand { - ETextEventProcessorCommandPosition position; - ETextEventProcessorCommandAction action; - int value; - char *string; - guint32 time; -}; - -struct _ETextEventProcessorEventButton { - GdkEventType type; - guint32 time; - guint state; - guint button; - gint position; -}; - -struct _ETextEventProcessorEventKey { - GdkEventType type; - guint32 time; - guint state; - guint keyval; - gint length; - gchar *string; -}; - -struct _ETextEventProcessorEventMotion { - GdkEventType type; - guint32 time; - guint state; - gint position; -}; - -union _ETextEventProcessorEvent { - GdkEventType type; - ETextEventProcessorEventButton button; - ETextEventProcessorEventKey key; - ETextEventProcessorEventMotion motion; -}; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_TYPES_H__ */ diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c deleted file mode 100644 index 47f028ca62..0000000000 --- a/e-util/e-text-event-processor.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-text-event-processor.h" -static void e_text_event_processor_init (ETextEventProcessor *card); -static void e_text_event_processor_class_init (ETextEventProcessorClass *klass); - -static GtkObjectClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0 -}; - -enum { - E_TEP_EVENT, - E_TEP_LAST_SIGNAL -}; - -static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 }; - -GtkType -e_text_event_processor_get_type (void) -{ - static GtkType text_event_processor_type = 0; - - if (!text_event_processor_type) - { - static const GtkTypeInfo text_event_processor_info = - { - "ETextEventProcessor", - sizeof (ETextEventProcessor), - sizeof (ETextEventProcessorClass), - (GtkClassInitFunc) e_text_event_processor_class_init, - (GtkObjectInitFunc) e_text_event_processor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_type = gtk_type_unique (gtk_object_get_type (), &text_event_processor_info); - } - - return text_event_processor_type; -} - -static void -e_text_event_processor_class_init (ETextEventProcessorClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - e_tep_signals[E_TEP_EVENT] = - gtk_signal_new ("command", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, e_tep_signals, E_TEP_LAST_SIGNAL); - - klass->event = NULL; - klass->command = NULL; -} - -static void -e_text_event_processor_init (ETextEventProcessor *tep) -{ -} - -gint -e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - if (E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event) { - return E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event(tep, event); - } else { - return 0; - } -} diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h deleted file mode 100644 index 1fc79f3f70..0000000000 --- a/e-util/e-text-event-processor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_H__ -#define __E_TEXT_EVENT_PROCESSOR_H__ - -#include -#include "e-text-event-processor-types.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessor - Turns events on a text widget into commands. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_TYPE (e_text_event_processor_get_type ()) -#define E_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor)) -#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass)) -#define E_IS_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) - - -typedef struct _ETextEventProcessor ETextEventProcessor; -typedef struct _ETextEventProcessorClass ETextEventProcessorClass; - -struct _ETextEventProcessor -{ - GtkObject parent; - - /* object specific fields */ - -}; - -struct _ETextEventProcessorClass -{ - GtkObjectClass parent_class; - - /* signals */ - void (* command) (ETextEventProcessor *tep, ETextEventProcessorCommand *command); - - /* virtual functions */ - gint (* event) (ETextEventProcessor *tep, ETextEventProcessorEvent *event); -}; - - -GtkType e_text_event_processor_get_type (void); -gint e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_H__ */ diff --git a/e-util/e-util.c b/e-util/e-util.c deleted file mode 100644 index d637b33729..0000000000 --- a/e-util/e-util.c +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "e-util.h" -#include - -int -g_str_compare(const void *x, const void *y) -{ - return strcmp(x, y); -} - -int -g_int_compare(const void *x, const void *y) -{ - if ( GPOINTER_TO_INT(x) < GPOINTER_TO_INT(y) ) - return -1; - else if ( GPOINTER_TO_INT(x) == GPOINTER_TO_INT(y) ) - return 0; - else - return -1; -} diff --git a/e-util/e-util.c-8611 b/e-util/e-util.c-8611 deleted file mode 100644 index d637b33729..0000000000 --- a/e-util/e-util.c-8611 +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "e-util.h" -#include - -int -g_str_compare(const void *x, const void *y) -{ - return strcmp(x, y); -} - -int -g_int_compare(const void *x, const void *y) -{ - if ( GPOINTER_TO_INT(x) < GPOINTER_TO_INT(y) ) - return -1; - else if ( GPOINTER_TO_INT(x) == GPOINTER_TO_INT(y) ) - return 0; - else - return -1; -} diff --git a/e-util/e-util.h b/e-util/e-util.h deleted file mode 100644 index e5635cdf16..0000000000 --- a/e-util/e-util.h +++ /dev/null @@ -1,35 +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;\ -}\ - - -typedef enum { - E_FOCUS_NONE, - E_FOCUS_CURRENT, - E_FOCUS_START, - E_FOCUS_END -} EFocus; - -int g_str_compare(const void *x, const void *y); -int g_int_compare(const void *x, const void *y); - -#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 e5635cdf16..0000000000 --- a/e-util/e-util.h-29002 +++ /dev/null @@ -1,35 +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;\ -}\ - - -typedef enum { - E_FOCUS_NONE, - E_FOCUS_CURRENT, - E_FOCUS_START, - E_FOCUS_END -} EFocus; - -int g_str_compare(const void *x, const void *y); -int g_int_compare(const void *x, const void *y); - -#endif /* _E_UTIL_H_ */ diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c deleted file mode 100644 index e6f361392b..0000000000 --- a/e-util/e-xml-utils.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "e-xml-utils.h" -#include - -xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name) -{ - xmlNode *child; - - for (child = parent->childs; child; child = child->next) { - if ( !xmlStrcmp( child->name, child_name ) ) { - return child; - } - } - return NULL; -} - -int -e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name) -{ - xmlChar *prop = xmlGetProp(parent, prop_name); - if (prop) - return atoi(prop); - else - return 0; -} diff --git a/e-util/e-xml-utils.c-56826 b/e-util/e-xml-utils.c-56826 deleted file mode 100644 index e6f361392b..0000000000 --- a/e-util/e-xml-utils.c-56826 +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "e-xml-utils.h" -#include - -xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name) -{ - xmlNode *child; - - for (child = parent->childs; child; child = child->next) { - if ( !xmlStrcmp( child->name, child_name ) ) { - return child; - } - } - return NULL; -} - -int -e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name) -{ - xmlChar *prop = xmlGetProp(parent, prop_name); - if (prop) - return atoi(prop); - else - return 0; -} diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h deleted file mode 100644 index c9b0ff2b39..0000000000 --- a/e-util/e-xml-utils.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_XML_UTILS__ -#define __E_XML_UTILS__ - -#include -#include -xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name); -int e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name); - -#endif /* __E_XML_UTILS__ */ diff --git a/e-util/e-xml-utils.h-82548 b/e-util/e-xml-utils.h-82548 deleted file mode 100644 index c9b0ff2b39..0000000000 --- a/e-util/e-xml-utils.h-82548 +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-xml-utils.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_XML_UTILS__ -#define __E_XML_UTILS__ - -#include -#include -xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name); -int e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name); - -#endif /* __E_XML_UTILS__ */ 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 - -/** - * 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 - -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/filter/.cvsignore b/filter/.cvsignore deleted file mode 100644 index 2b7973a0bf..0000000000 --- a/filter/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -filter-editor -*.la -*.lo -.libs -filter-driver diff --git a/filter/ChangeLog b/filter/ChangeLog deleted file mode 100644 index e7b9b025a6..0000000000 --- a/filter/ChangeLog +++ /dev/null @@ -1,51 +0,0 @@ -2000-02-24 NotZed - - * filter-xml.c (filter_description_free): - (filter_load_ruleset_free): - (filter_load_optionset_free): Functions for memory management. - - * filter-arg.c (filter_arg_copy): Copy the values of one arg into - another. - - * filter-editor.c: New widget, a dialogue which uses filter-druid - to present the various editing views. - (druid_dialogue_clicked): On finish, save the user's new filter - definition where it came from. - - * filter-druid.c: Changed to just being a notebook with no tabs, - rather than a full druid (no next/prev/etc buttons). - (option_name_changed): Update the option's description as the user - enters it in. - -2000-02-22 NotZed - - * filter-xml.c (filter_clone_optionrule): - (filter_clone_optionrule_free): - (filter_optionrule_new_from_rule): New utility functions for - working with the internal rule format. - - * filter-arg.[ch]: Added new callbacks for editing a single value, - and a new editor which shows all items in a list, and allows you - to edit them via the single-edit method. This needs some cleanup - for some unused/unusable virtual methods (edit_values, - write_html?). - - * Makefile: Add the druid for build. - - * filter-druid.c: A 'druid' widget for editing a single filter - rule. - -2000-02-21 Matt Loper - - * .cvsignore: New file. - -2000-02-18 NotZed - - * blank/check.xpm: Added forgotten files. - - * Uh, more changes, lots, its still work in progress. - -2000-02-14 NotZed - - * Initial import. - diff --git a/filter/Makefile b/filter/Makefile deleted file mode 100644 index a462af4413..0000000000 --- a/filter/Makefile +++ /dev/null @@ -1,29 +0,0 @@ - -OBJS = filter-arg-types.lo filter-arg.lo filter-xml.lo filter-format.lo filter-druid.lo -SRCS = filter-arg-types.c filter-arg.c filter-xml.c filter-format.c filter-druid.c - -LIBFILTEROBJS = filter-sexp.lo -LIBFILTERSRCS = filter-sexp.c - -LIBTOOL=sh ../libtool -#CC=insure gcc - -CFLAGS = `gnome-config --cflags xml gnome gtk gtkhtml gnomeui` -g -I../camel -I .. -I../libibex -LDFLAGS = `gnome-config --libs xml gnome gtk gtkhtml gnomeui` ../camel/libcamel.la -lpthread - -all: libfilter.la filter-editor - -filter-editor: $(OBJS) filter-editor.lo libfilter.la - $(LIBTOOL) --mode link $(CC) $^ -o $@ $(LDFLAGS) - -filter-driver: $(OBJS) filter-driver.lo libfilter.la - $(LIBTOOL) --mode link $(CC) $^ -o $@ $(LDFLAGS) - -libfilter.la: $(LIBFILTEROBJS) - $(LIBTOOL) --mode link $(CC) -static $^ -o $@ - -%.lo: %.c - $(LIBTOOL) --mode compile $(CC) $(CFLAGS) -c -o $@ $< - -clean: - -rm -rf *.o *.lo core .libs diff --git a/filter/blank.xpm b/filter/blank.xpm deleted file mode 100755 index 499f7a04fc..0000000000 --- a/filter/blank.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * blank_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" .............. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .............. ", -" "}; diff --git a/filter/check.xpm b/filter/check.xpm deleted file mode 100755 index 74f9b56122..0000000000 --- a/filter/check.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * check_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" .............. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .+++++++++.++. ", -" .++++++++..++. ", -" .+++++++...++. ", -" .++.+++...+++. ", -" .++..+...++++. ", -" .++.....+++++. ", -" .+++...++++++. ", -" .++++.+++++++. ", -" .++++++++++++. ", -" .++++++++++++. ", -" .............. ", -" "}; diff --git a/filter/filter-arg-types.c b/filter/filter-arg-types.c deleted file mode 100644 index ea58bf36ae..0000000000 --- a/filter/filter-arg-types.c +++ /dev/null @@ -1,743 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * Implementations of the filter-arg types. - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include - -#include "filter-arg-types.h" - - -/* ********************************************************************** */ -/* String */ -/* ********************************************************************** */ - -/* Use for a superclass of any items which are simple strings */ - -static void filter_arg_string_class_init (FilterArgStringClass *class); -static void filter_arg_string_init (FilterArgString *gspaper); - -static FilterArg *string_parent_class; - -guint -filter_arg_string_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "FilterArgString", - sizeof (FilterArgString), - sizeof (FilterArgStringClass), - (GtkClassInitFunc) filter_arg_string_class_init, - (GtkObjectInitFunc) filter_arg_string_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (filter_arg_get_type (), &type_info); - } - - return type; -} - -static void -arg_string_write_html(FilterArg *argin, GtkHTML *html, GtkHTMLStreamHandle *stream) -{ - FilterArgString *arg = (FilterArgString *)argin; - /* empty */ -} - -static void -arg_string_write_text(FilterArg *argin, GString *string) -{ - FilterArgString *arg = (FilterArgString *)argin; - GList *l; - char *a; - - l = argin->values; - if (l == NULL) { - g_string_append(string, "folder"); - } - while (l) { - a = l->data; - g_string_append(string, a); - if (l->next) { - g_string_append(string, ", "); - } - l = g_list_next(l); - } -} - -static void -arg_string_edit_values(FilterArg *arg) -{ - printf("edit string values!\n"); -} - -/* pop up a dialogue, asking for a new string value */ -static int -arg_string_edit_value(FilterArg *arg, int index) -{ - GnomeDialog *dialogue; - GtkHBox *hbox; - GtkLabel *label; - GtkEntry *entry; - char *text = NULL; - char *newtext; - - dialogue = (GnomeDialog *)gnome_dialog_new("Edit value", "Ok", "Cancel", 0); - - hbox = (GtkHBox *)gtk_hbox_new(FALSE, 0); - label = (GtkLabel *)gtk_label_new("Folder name"); - gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)label, FALSE, FALSE, 0); - entry = (GtkEntry *)gtk_entry_new(); - gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)entry, TRUE, TRUE, 0); - if (index>=0) { - text = filter_arg_get_value(arg, index); - } - if (text) { - gtk_entry_set_text(entry, text); - } - gtk_box_pack_start((GtkBox *)dialogue->vbox, (GtkWidget *)hbox, TRUE, TRUE, 0); - gtk_widget_show_all((GtkWidget *)hbox); - gtk_object_ref((GtkObject *)entry); /* so we can get the text back afterwards */ - if (gnome_dialog_run_and_close(dialogue) == 0) { - GList *node; - - newtext = g_strdup(gtk_entry_get_text(entry)); - gtk_object_unref((GtkObject *)entry); - if (index>=0 - && (node = g_list_find(arg->values, text))) { - node->data = newtext; - } else { - arg->values = g_list_append(arg->values, newtext); - } - g_free(text); - return g_list_index(arg->values, newtext); - } - return -1; -} - -static xmlNodePtr -arg_string_values_get_xml(FilterArg *argin) -{ - xmlNodePtr value; - FilterArgString *arg = (FilterArgString *)argin; - GList *l; - char *a; - - value = xmlNewNode(NULL, "optionvalue"); - xmlSetProp(value, "name", argin->name); - - l = argin->values; - while (l) { - xmlNodePtr cur; - - a = l->data; - - cur = xmlNewChild(value, NULL, "folder", NULL); - if (a) - xmlSetProp(cur, "folder", a); - l = g_list_next(l); - } - - return value; -} - -static void -arg_string_values_add_xml(FilterArg *arg, xmlNodePtr node) -{ - xmlNodePtr n; - - n = node->childs; - while (n) { - if (!strcmp(n->name, "folder")) { - filter_arg_string_add(arg, xmlGetProp(n, "folder")); - } else { - g_warning("Loading folders from xml, wrong node encountered: %s\n", n->name); - } - n = n->next; - } -} - -static char * -arg_string_get_value_as_string(FilterArg *argin, void *data) -{ - FilterArgString *arg = (FilterArgString *)argin; - char *a = (char *)data; - - return a; -} - -static void -arg_string_free_value(FilterArg *arg, void *a) -{ - g_free(a); -} - -static void -filter_arg_string_class_init (FilterArgStringClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - if (string_parent_class == NULL) - string_parent_class = gtk_type_class (gtk_object_get_type ()); - - class->parent_class.write_html = arg_string_write_html; - class->parent_class.write_text = arg_string_write_text; - class->parent_class.edit_values = arg_string_edit_values; - class->parent_class.edit_value = arg_string_edit_value; - class->parent_class.free_value = arg_string_free_value; - class->parent_class.get_value_as_string = arg_string_get_value_as_string; - - class->parent_class.values_get_xml = arg_string_values_get_xml; - class->parent_class.values_add_xml = arg_string_values_add_xml; -} - -static void -filter_arg_string_init (FilterArgString *arg) -{ - arg->arg.values = NULL; -} - -/** - * filter_arg_string_new: - * - * Create a new FilterArgString widget. - * - * Return value: A new FilterArgString widget. - **/ -FilterArg * -filter_arg_string_new (char *name) -{ - FilterArg *a = FILTER_ARG ( gtk_type_new (filter_arg_string_get_type ())); - a->name = g_strdup(name); - return a; -} - - -void -filter_arg_string_add(FilterArg *arg, char *name) -{ - filter_arg_add(arg, g_strdup(name)); -} - -void -filter_arg_string_remove(FilterArg *arg, char *name) -{ - /* do it */ -} - - -/* ********************************************************************** */ -/* Address */ -/* ********************************************************************** */ - -static void filter_arg_address_class_init (FilterArgAddressClass *class); -static void filter_arg_address_init (FilterArgAddress *gspaper); - -static FilterArg *parent_class; - -guint -filter_arg_address_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "FilterArgAddress", - sizeof (FilterArgAddress), - sizeof (FilterArgAddressClass), - (GtkClassInitFunc) filter_arg_address_class_init, - (GtkObjectInitFunc) filter_arg_address_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (filter_arg_get_type (), &type_info); - } - - return type; -} - -static void -arg_address_write_html(FilterArg *argin, GtkHTML *html, GtkHTMLStreamHandle *stream) -{ - FilterArgAddress *arg = (FilterArgAddress *)argin; - /* empty */ -} - -static void -arg_address_write_text(FilterArg *argin, GString *string) -{ - FilterArgAddress *arg = (FilterArgAddress *)argin; - GList *l; - struct filter_arg_address *a; - - l = argin->values; - if (l == NULL) { - g_string_append(string, "email address"); - } - while (l) { - a = l->data; - g_string_append(string, a->name); - if (l->next) { - g_string_append(string, ", "); - } - l = g_list_next(l); - } -} - -static void -arg_address_edit_values(FilterArg *arg) -{ - printf("edit it!\n"); -} - -static int -arg_address_edit_value(FilterArg *arg, int index) -{ - GnomeDialog *dialogue; - GtkHBox *hbox; - GtkLabel *label; - GtkEntry *entry; - char *text = NULL; - char *newtext; - struct filter_arg_address *ad; - - dialogue = (GnomeDialog *)gnome_dialog_new("Edit value", "Ok", "Cancel", 0); - - hbox = (GtkHBox *)gtk_hbox_new(FALSE, 0); - label = (GtkLabel *)gtk_label_new("Folder name"); - gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)label, FALSE, FALSE, 0); - entry = (GtkEntry *)gtk_entry_new(); - gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)entry, TRUE, TRUE, 0); - if (index>=0 - && (ad = filter_arg_get_value(arg, index))) { - text = ad->email; - } - if (text) { - gtk_entry_set_text(entry, text); - } - gtk_box_pack_start((GtkBox *)dialogue->vbox, (GtkWidget *)hbox, TRUE, TRUE, 0); - gtk_widget_show_all((GtkWidget *)hbox); - gtk_object_ref((GtkObject *)entry); /* so we can get the text back afterwards */ - if (gnome_dialog_run_and_close(dialogue) == 0) { - GList *node; - - newtext = g_strdup(gtk_entry_get_text(entry)); - gtk_object_unref((GtkObject *)entry); - if (index>=0 - && (node = g_list_find(arg->values, text))) { - ad = node->data; - ad->email = newtext; - } else { - ad = g_malloc0(sizeof(*ad)); - ad->email = newtext; - arg->values = g_list_append(arg->values, ad); - } - g_free(text); - return g_list_index(arg->values, ad); - } - return -1; -} - -static xmlNodePtr -arg_address_values_get_xml(FilterArg *argin) -{ - xmlNodePtr value; - FilterArgAddress *arg = (FilterArgAddress *)argin; - GList *l; - struct filter_arg_address *a; - - /* hmm, perhaps this overhead should be in FilterArg, and this function just returns the base node?? */ - value = xmlNewNode(NULL, "optionvalue"); - xmlSetProp(value, "name", argin->name); - - l = argin->values; - while (l) { - xmlNodePtr cur; - - a = l->data; - - cur = xmlNewChild(value, NULL, "address", NULL); - if (a->name) - xmlSetProp(cur, "name", a->name); - if (a->email) - xmlSetProp(cur, "email", a->email); - l = g_list_next(l); - } - - return value; -} - -static void -arg_address_values_add_xml(FilterArg *arg, xmlNodePtr node) -{ - xmlNodePtr n; - - n = node->childs; - while (n) { - if (!strcmp(n->name, "address")) { - filter_arg_address_add(arg, xmlGetProp(n, "name"), xmlGetProp(n, "email")); - } else { - g_warning("Loading address from xml, wrong node encountered: %s\n", n->name); - } - n = n->next; - } -} - -/* the search string is just the raw email address */ -static char * -arg_address_get_value_as_string(FilterArg *argin, void *data) -{ - FilterArgAddress *arg = (FilterArgAddress *)argin; - struct filter_arg_address *a = (struct filter_arg_address *)data; - - printf("geting address as string : %s %s\n", a->email, a->name); - - if (a->email == NULL - || a->email[0] == '\0') { - if (a->name == NULL - || a->name[0] == '\0') - return ""; - return a->name; - } else - return a->email; -} - -static void -arg_address_free_value(FilterArg *arg, struct filter_arg_address *a) -{ - g_free(a->name); - g_free(a->email); - g_free(a); -} - -static void -filter_arg_address_class_init (FilterArgAddressClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - if (parent_class == NULL) - parent_class = gtk_type_class (gtk_object_get_type ()); - - class->parent_class.write_html = arg_address_write_html; - class->parent_class.write_text = arg_address_write_text; - class->parent_class.edit_values= arg_address_edit_values; - class->parent_class.edit_value= arg_address_edit_value; - class->parent_class.free_value = arg_address_free_value; - - class->parent_class.values_get_xml = arg_address_values_get_xml; - class->parent_class.values_add_xml = arg_address_values_add_xml; - - class->parent_class.get_value_as_string = arg_address_get_value_as_string; -} - -static void -filter_arg_address_init (FilterArgAddress *arg) -{ -} - -/** - * filter_arg_address_new: - * - * Create a new FilterArgAddress widget. - * - * Return value: A new FilterArgAddress widget. - **/ -FilterArg * -filter_arg_address_new (char *name) -{ - FilterArg *a = FILTER_ARG ( gtk_type_new (filter_arg_address_get_type ())); - a->name = g_strdup(name); - return a; -} - -void -filter_arg_address_add(FilterArg *arg, char *name, char *email) -{ - struct filter_arg_address *a; - - a = g_malloc0(sizeof(*a)); - - a->name = g_strdup(name); - a->email = g_strdup(email); - - filter_arg_add(arg, a); -} - -void -filter_arg_address_remove(FilterArg *arg, char *name, char *email) -{ - -} - -/* ********************************************************************** */ -/* Folder */ -/* ********************************************************************** */ - - -static void filter_arg_folder_class_init (FilterArgFolderClass *class); -static void filter_arg_folder_init (FilterArgFolder *gspaper); - -static FilterArg *folder_parent_class; - -guint -filter_arg_folder_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "FilterArgFolder", - sizeof (FilterArgFolder), - sizeof (FilterArgFolderClass), - (GtkClassInitFunc) filter_arg_folder_class_init, - (GtkObjectInitFunc) filter_arg_folder_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (filter_arg_string_get_type (), &type_info); - } - - return type; -} - -static void -arg_folder_write_html(FilterArg *argin, GtkHTML *html, GtkHTMLStreamHandle *stream) -{ - FilterArgFolder *arg = (FilterArgFolder *)argin; - /* empty */ -} - -static void -arg_folder_write_text(FilterArg *argin, GString *string) -{ - FilterArgFolder *arg = (FilterArgFolder *)argin; - GList *l; - char *a; - - l = argin->values; - if (l == NULL) { - g_string_append(string, "folder"); - } - while (l) { - a = l->data; - g_string_append(string, a); - if (l->next) { - g_string_append(string, ", "); - } - l = g_list_next(l); - } -} - -static void -arg_folder_edit_values(FilterArg *argin) -{ - FilterArgFolder *arg = (FilterArgFolder *)argin; - GList *l; - char *a, *start, *ptr, *ptrend, *ptrgap; - char outbuf[128], *outptr; /* FIXME: dont use a bounded buffer! */ - GString *string = g_string_new(""); - GtkWidget *dialogue; - GtkWidget *text; - - dialogue = gnome_dialog_new("Edit addresses", - "Ok", "Cancel", NULL); - text = gtk_text_new(NULL, NULL); - gtk_object_ref((GtkObject *)text); - - l = argin->values; - while (l) { - a = l->data; - gtk_text_insert(text, NULL, NULL, NULL, a, strlen(a)); - gtk_text_insert(text, NULL, NULL, NULL, "\n", 1); - l = g_list_next(l); - } - - gtk_box_pack_start(GNOME_DIALOG(dialogue)->vbox, text, TRUE, TRUE, 2); - gtk_widget_show(text); - gtk_text_set_editable(text, 1); - - gnome_dialog_run_and_close(dialogue); - - /* FIXME: free current values */ - argin->values = NULL; - ptr = GTK_TEXT(text)->text.ch; - ptrend = ptr+GTK_TEXT(text)->text_end; - ptrgap = ptr+GTK_TEXT(text)->gap_position; - - start = ptr; - outptr = outbuf; - while (ptr0) { - new = g_malloc(len+1); - new[len]=0; - memcpy(new, outbuf, len); - printf("(appending '%s')", new); - argin->values = g_list_append(argin->values, new); - } - outptr = outbuf; - } else { - *outptr++ = *ptr; - } - ptr++; - if (ptr==ptrgap) { - ptr += GTK_TEXT(text)->gap_size; - } - } - if (outptr>outbuf) { - int len = outptr-outbuf; - char *new; - - printf("(lastlen = %d)", len); - - new = g_malloc(len+1); - new[len]=0; - memcpy(new, start, len); - argin->values = g_list_append(argin->values, new); - } - printf("\n"); -} - -static xmlNodePtr -arg_folder_values_get_xml(FilterArg *argin) -{ - xmlNodePtr value; - FilterArgFolder *arg = (FilterArgFolder *)argin; - GList *l; - char *a; - - value = xmlNewNode(NULL, "optionvalue"); - xmlSetProp(value, "name", argin->name); - - l = argin->values; - while (l) { - xmlNodePtr cur; - - a = l->data; - - cur = xmlNewChild(value, NULL, "folder", NULL); - if (a) - xmlSetProp(cur, "folder", a); - l = g_list_next(l); - } - - return value; -} - -static void -arg_folder_values_add_xml(FilterArg *arg, xmlNodePtr node) -{ - xmlNodePtr n; - - printf("adding folder values ...\n"); - - n = node->childs; - while (n) { - if (!strcmp(n->name, "folder")) { - filter_arg_folder_add(arg, xmlGetProp(n, "name")); - } else { - g_warning("Loading folders from xml, wrong node encountered: %s\n", n->name); - } - n = n->next; - } -} - -static char * -arg_folder_get_value_as_string(FilterArg *argin, void *data) -{ - FilterArgFolder *arg = (FilterArgFolder *)argin; - char *a = (char *)data; - - return a; -} - -static void -arg_folder_free_value(FilterArg *arg, void *a) -{ - g_free(a); -} - -static void -filter_arg_folder_class_init (FilterArgFolderClass *class) -{ - GtkObjectClass *object_class; - FilterArgClass *filter_class; - - object_class = (GtkObjectClass *) class; - filter_class = (FilterArgClass *) class; - if (folder_parent_class == NULL) - folder_parent_class = gtk_type_class (filter_arg_string_get_type ()); - - /* FIXME: only need to over-ride the edit values right? */ - filter_class->write_html = arg_folder_write_html; - filter_class->write_text = arg_folder_write_text; - filter_class->edit_values = arg_folder_edit_values; - filter_class->free_value = arg_folder_free_value; - - filter_class->values_get_xml = arg_folder_values_get_xml; - filter_class->values_add_xml = arg_folder_values_add_xml; -} - -static void -filter_arg_folder_init (FilterArgFolder *arg) -{ -} - -/** - * filter_arg_folder_new: - * - * Create a new FilterArgFolder widget. - * - * Return value: A new FilterArgFolder widget. - **/ -FilterArg * -filter_arg_folder_new (char *name) -{ - FilterArg *a = FILTER_ARG ( gtk_type_new (filter_arg_folder_get_type ())); - a->name = g_strdup(name); - return a; -} - - -void -filter_arg_folder_add(FilterArg *arg, char *name) -{ - filter_arg_add(arg, g_strdup(name)); -} - -void -filter_arg_folder_remove(FilterArg *arg, char *name) -{ - /* do it */ -} diff --git a/filter/filter-arg-types.h b/filter/filter-arg-types.h deleted file mode 100644 index 6a1d80bfae..0000000000 --- a/filter/filter-arg-types.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * Implementations of the filter-args. - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef _FILTER_ARG_TYPES_H -#define _FILTER_ARG_TYPES_H - -#include "filter-arg.h" - -/* An Address */ -#define FILTER_ARG_ADDRESS(obj) GTK_CHECK_CAST (obj, filter_arg_address_get_type (), FilterArgAddress) -#define FILTER_ARG_ADDRESS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_arg_address_get_type (), FilterArgAddressClass) -#define IS_FILTER_ARG_ADDRESS(obj) GTK_CHECK_TYPE (obj, filter_arg_address_get_type ()) - -typedef struct _FilterArgAddress FilterArgAddress; -typedef struct _FilterArgAddressClass FilterArgAddressClass; - -struct _FilterArgAddress { - FilterArg arg; -}; - -struct _FilterArgAddressClass { - FilterArgClass parent_class; -}; - -struct filter_arg_address { - char *name; - char *email; -}; - -guint filter_arg_address_get_type (void); -FilterArg *filter_arg_address_new (char *name); -void filter_arg_address_add(FilterArg *, char *name, char *email); -void filter_arg_address_remove(FilterArg *, char *name, char *email); - -/* A simple String */ -#define FILTER_ARG_STRING(obj) GTK_CHECK_CAST (obj, filter_arg_string_get_type (), FilterArgString) -#define FILTER_ARG_STRING_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_arg_string_get_type (), FilterArgStringClass) -#define IS_FILTER_ARG_STRING(obj) GTK_CHECK_TYPE (obj, filter_arg_string_get_type ()) - -typedef struct _FilterArgString FilterArgString; -typedef struct _FilterArgStringClass FilterArgStringClass; - -struct _FilterArgString { - FilterArg arg; - - /* Name/property to save/load to xml */ - /* char *xmlname; */ - /* char *xmlprop; */ -}; - -struct _FilterArgStringClass { - FilterArgClass parent_class; -}; - -guint filter_arg_string_get_type (void); -FilterArg *filter_arg_string_new (char *name); -void filter_arg_string_add(FilterArg *, char *name); -void filter_arg_string_remove(FilterArg *, char *name); - -/* A Folder, subclass of a string */ -#define FILTER_ARG_FOLDER(obj) GTK_CHECK_CAST (obj, filter_arg_folder_get_type (), FilterArgFolder) -#define FILTER_ARG_FOLDER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_arg_folder_get_type (), FilterArgFolderClass) -#define IS_FILTER_ARG_FOLDER(obj) GTK_CHECK_TYPE (obj, filter_arg_folder_get_type ()) - -typedef struct _FilterArgFolder FilterArgFolder; -typedef struct _FilterArgFolderClass FilterArgFolderClass; - -struct _FilterArgFolder { - FilterArgString arg; -}; - -struct _FilterArgFolderClass { - FilterArgStringClass parent_class; -}; - -guint filter_arg_folder_get_type (void); -FilterArg *filter_arg_folder_new (char *name); -void filter_arg_folder_add(FilterArg *, char *name); -void filter_arg_folder_remove(FilterArg *, char *name); - -#endif /* ! _FILTER_ARG_TYPES_H */ - diff --git a/filter/filter-arg.c b/filter/filter-arg.c deleted file mode 100644 index 8adfb5576e..0000000000 --- a/filter/filter-arg.c +++ /dev/null @@ -1,494 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * Abstract filter argument class. - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include - -#include "filter-arg.h" - - -static void filter_arg_class_init (FilterArgClass *class); -static void filter_arg_init (FilterArg *gspaper); - -static GtkObjectClass *parent_class; - -enum { - CHANGED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -guint -filter_arg_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "FilterArg", - sizeof (FilterArg), - sizeof (FilterArgClass), - (GtkClassInitFunc) filter_arg_class_init, - (GtkObjectInitFunc) filter_arg_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &type_info); - } - - return type; -} - -static FilterArg * -clone_default(FilterArg *a) -{ - xmlNodePtr values; - FilterArg *new = FILTER_ARG ( gtk_type_new (((GtkObject *)a)->klass->type) ); - - /* clone values */ - new->name = g_strdup(a->name); - values = filter_arg_values_get_xml(a); - filter_arg_values_add_xml(new, values); - xmlFreeNodeList(values); - - return new; -} - -static void -write_html_nothing(FilterArg *arg, GtkHTML *html, GtkHTMLStreamHandle *stream) -{ - /* empty */ -} - -static void -write_text_nothing(FilterArg *arg, GString *string) -{ - /* empty */ -} - -static void -edit_values_nothing(FilterArg *arg) -{ - /* empty */ -} - -static void * -edit_value_nothing(FilterArg *arg, void *v) -{ - return v; -} - -static void -free_value_nothing(FilterArg *arg, void *v) -{ - /* empty */ -} - -static gint -compare_pointers(gpointer a, gpointer b) -{ - return a==b; -} - -static void -filter_arg_class_init (FilterArgClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gtk_object_get_type ()); - - class->write_html = write_html_nothing; - class->write_text = write_text_nothing; - class->edit_values = edit_values_nothing; - class->edit_value = edit_value_nothing; - class->free_value = free_value_nothing; - class->clone = clone_default; - - signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (FilterArgClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -filter_arg_init (FilterArg *arg) -{ - arg->values = NULL; -} - -/** - * filter_arg_new: - * - * Create a new FilterArg widget. - * - * Return value: A new FilterArg widget. - **/ -FilterArg * -filter_arg_new (char *name) -{ - FilterArg *a = FILTER_ARG ( gtk_type_new (filter_arg_get_type ())); - if (name) - a->name = g_strdup(name); - return a; -} - -FilterArg * -filter_arg_clone (FilterArg *arg) -{ - return ((FilterArgClass *)(arg->object.klass))->clone(arg); -} - -void -filter_arg_copy(FilterArg *dst, FilterArg *src) -{ - xmlNodePtr values; - - g_return_if_fail( ((GtkObject *)src)->klass->type == ((GtkObject *)dst)->klass->type ); - - /* remove old values */ - while (dst->values) { - filter_arg_remove(dst, dst->values->data); - } - - /* clone values */ - values = filter_arg_values_get_xml(src); - filter_arg_values_add_xml(dst, values); - xmlFreeNodeList(values); -} - -void -filter_arg_add(FilterArg *arg, void *v) -{ - g_return_if_fail(v != NULL); - - arg->values = g_list_append(arg->values, v); - gtk_signal_emit(GTK_OBJECT(arg), signals[CHANGED]); -} - -void -filter_arg_remove(FilterArg *arg, void *v) -{ - arg->values = g_list_remove(arg->values, v); - ((FilterArgClass *)(arg->object.klass))->free_value(arg, v); - gtk_signal_emit(GTK_OBJECT(arg), signals[CHANGED]); -} - - -void -filter_arg_write_html(FilterArg *arg, GtkHTML *html, GtkHTMLStreamHandle *stream) -{ - ((FilterArgClass *)(arg->object.klass))->write_html(arg, html, stream); -} -void -filter_arg_write_text(FilterArg *arg, GString *string) -{ - int count, i; - - count = filter_arg_get_count(arg); - for (i=0;i1) { - g_string_append(string, "or "); - } - } - -#if 0 - ((FilterArgClass *)(arg->object.klass))->write_text(arg, string); -#endif -} -void -filter_arg_edit_values(FilterArg *arg) -{ - void filter_arg_edit_values_1(FilterArg *arg); - - g_return_if_fail(arg != NULL); - - -#if 1 - filter_arg_edit_values_1(arg); -#else - - if (((FilterArgClass *)(arg->object.klass))->edit_values) - ((FilterArgClass *)(arg->object.klass))->edit_values(arg); - else - g_warning("No implementation of virtual method edit_values"); -#endif -} - -int -filter_arg_edit_value(FilterArg *arg, int index) -{ - ((FilterArgClass *)(arg->object.klass))->edit_value(arg, index); -} - -xmlNodePtr -filter_arg_values_get_xml(FilterArg *arg) -{ - return ((FilterArgClass *)(arg->object.klass))->values_get_xml(arg); -} -void -filter_arg_values_add_xml(FilterArg *arg, xmlNodePtr node) -{ - ((FilterArgClass *)(arg->object.klass))->values_add_xml(arg, node); -} - -/* returns the number of args in the arg list */ -int -filter_arg_get_count(FilterArg *arg) -{ - int count=0; - GList *l; - - for (l = arg->values;l;l=g_list_next(l)) - count++; - return count; -} - -void * -filter_arg_get_value(FilterArg *arg, int index) -{ - int count=0; - GList *l; - - for (l = arg->values;l && countdata; - return NULL; -} - -char * -filter_arg_get_value_as_string(FilterArg *arg, int index) -{ - int count=0; - GList *l; - void *data; - - data = filter_arg_get_value(arg, index); - if (data) { - return ((FilterArgClass *)(arg->object.klass))->get_value_as_string(arg, data); - } else { - return ""; - } -} - - -struct filter_arg_edit { - FilterArg *arg; - GtkList *list; - GList *items; - GnomeDialog *dialogue; - GtkWidget *add, *remove, *edit; - GtkWidget *item_current; -}; - -static void -filter_arg_edit_add(GtkWidget *w, struct filter_arg_edit *edata) -{ - GtkListItem *listitem; - GList *items = NULL; - int i; - - printf("adding new item\n"); - - i = filter_arg_edit_value(edata->arg, -1); - if (i>=0) { - gtk_list_remove_items_no_unref(edata->list, edata->items); - listitem = (GtkListItem *)gtk_list_item_new_with_label(filter_arg_get_value_as_string(edata->arg, i)); - gtk_object_set_data((GtkObject *)listitem, "arg_i", filter_arg_get_value(edata->arg, i)); - edata->items = g_list_append(edata->items, listitem); - gtk_widget_show((GtkWidget *)listitem); - - /* this api is nonsense */ - gtk_list_append_items(edata->list, g_list_copy(edata->items)); - } -} - -void dump_list(GList *list) -{ - printf("dumping list:\n"); - for (;list;list = g_list_next(list)) { - printf(" %p %p\n", list, list->data); - } -} - -static void -fill_list(struct filter_arg_edit *edata) -{ - GList *items = NULL; - int i, count; - GtkListItem *listitem; - - gtk_list_remove_items(edata->list, edata->items); - g_list_free(edata->items); - - count = filter_arg_get_count(edata->arg); - for (i=0;iarg, i); - listitem = (GtkListItem *)gtk_list_item_new_with_label(labeltext); - gtk_object_set_data((GtkObject *)listitem, "arg_i", filter_arg_get_value(edata->arg, i)); - items = g_list_append(items, listitem); - gtk_widget_show(GTK_WIDGET(listitem)); - printf("adding item %d\n", i); - } - - printf("items re-added\n"); - - edata->item_current = NULL; - edata->items = items; - - gtk_list_append_items(edata->list, g_list_copy(edata->items)); -} - -static void -filter_arg_edit_edit(GtkWidget *w, struct filter_arg_edit *edata) -{ - char *name; - int i; - - /* yurck */ - if (edata->item_current - && (name = gtk_object_get_data((GtkObject *)edata->item_current, "arg_i")) - && (i = g_list_index(edata->arg->values, name)) >= 0 - && (i = filter_arg_edit_value(edata->arg, i)) >= 0) { - - fill_list(edata); - } -} - -static void -filter_arg_edit_delete(GtkWidget *w, struct filter_arg_edit *edata) -{ - GtkListItem *listitem; - char *name; - - /* yurck */ - if (edata->item_current - && (name = gtk_object_get_data((GtkObject *)edata->item_current, "arg_i"))) { - filter_arg_remove(edata->arg, name); - fill_list(edata); - } -} - -static void -edit_sensitise(struct filter_arg_edit *edata) -{ - int state = edata->item_current != NULL; - gtk_widget_set_sensitive(edata->remove, state); - gtk_widget_set_sensitive(edata->edit, state); -} - -static void -filter_arg_edit_select(GtkWidget *w, GtkListItem *list, struct filter_arg_edit *edata) -{ - edata->item_current = list; - edit_sensitise(edata); - - printf ("node = %p\n", g_list_find(edata->items, edata->item_current)); -} - -static void -filter_arg_edit_unselect(GtkWidget *w, GtkListItem *list, struct filter_arg_edit *edata) -{ - edata->item_current = NULL; - edit_sensitise(edata); -} - -void -filter_arg_edit_values_1(FilterArg *arg) -{ - GList *vales; - GtkList *list; - GtkListItem *listitem; - int count, i; - GnomeDialog *dialogue; - GtkHBox *hbox; - GtkVBox *vbox; - GtkWidget *button; - GtkWidget *scrolled_window, *frame; - struct filter_arg_edit edata; - - edata.item_current = NULL; - edata.arg = arg; - - dialogue = (GnomeDialog *)gnome_dialog_new("Edit values", "Ok", "Cancel", 0); - edata.dialogue = dialogue; - - hbox = (GtkHBox *)gtk_hbox_new(FALSE, 0); - - list = (GtkList *)gtk_list_new(); - edata.list = list; - edata.items = NULL; - fill_list(&edata); - - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - frame = gtk_frame_new("Option values"); - - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), (GtkWidget *)list); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_set_focus_vadjustment(GTK_CONTAINER (list), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window))); - gtk_container_add(GTK_CONTAINER(frame), scrolled_window); - gtk_widget_set_usize(frame, 200, 300); - gtk_box_pack_start((GtkBox *)hbox, frame, TRUE, TRUE, 0); - - /* buttons */ - vbox = (GtkVBox *)gtk_vbox_new(FALSE, 0); - - button = gtk_button_new_with_label ("Add"); - gtk_box_pack_start((GtkBox *)vbox, button, FALSE, TRUE, 0); - edata.add = button; - button = gtk_button_new_with_label ("Remove"); - gtk_box_pack_start((GtkBox *)vbox, button, FALSE, TRUE, 0); - edata.remove = button; - button = gtk_button_new_with_label ("Edit"); - gtk_box_pack_start((GtkBox *)vbox, button, FALSE, TRUE, 0); - edata.edit = button; - - gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)vbox, FALSE, FALSE, 0); - - gtk_signal_connect((GtkObject *)edata.add, "clicked", filter_arg_edit_add, &edata); - gtk_signal_connect((GtkObject *)edata.edit, "clicked", filter_arg_edit_edit, &edata); - gtk_signal_connect((GtkObject *)edata.remove, "clicked", filter_arg_edit_delete, &edata); - gtk_signal_connect((GtkObject *)edata.list, "select_child", filter_arg_edit_select, &edata); - gtk_signal_connect((GtkObject *)edata.list, "unselect_child", filter_arg_edit_unselect, &edata); - - gtk_widget_show(GTK_WIDGET(list)); - gtk_widget_show_all(GTK_WIDGET(hbox)); - gtk_box_pack_start((GtkBox *)dialogue->vbox, (GtkWidget *)hbox, TRUE, TRUE, 0); - - edit_sensitise(&edata); - - gnome_dialog_run_and_close(dialogue); -} - - diff --git a/filter/filter-arg.h b/filter/filter-arg.h deleted file mode 100644 index 78ce067bbc..0000000000 --- a/filter/filter-arg.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * Abstract class to hold filter arguments. - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef _FILTER_ARG_H -#define _FILTER_ARG_H - -#include -#include -#include - -#define FILTER_ARG(obj) GTK_CHECK_CAST (obj, filter_arg_get_type (), FilterArg) -#define FILTER_ARG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_arg_get_type (), FilterArgClass) -#define IS_FILTER_ARG(obj) GTK_CHECK_TYPE (obj, filter_arg_get_type ()) - -typedef struct _FilterArg FilterArg; -typedef struct _FilterArgClass FilterArgClass; - -struct _FilterArg { - GtkObject object; - - char *name; - GList *values; -}; - -struct _FilterArgClass { - GtkObjectClass parent_class; - - /* make a copy of yourself */ - struct _FilterArg * (*clone)(FilterArg *arg); - - /* virtual methods */ - void (*write_html)(FilterArg *arg, GtkHTML *html, GtkHTMLStreamHandle *stream); - void (*write_text)(FilterArg *arg, GString *string); - void (*free_value)(FilterArg *arg, void *v); - - void (*edit_values)(FilterArg *arg); - int (*edit_value)(FilterArg *arg, int index); - - void (*values_add_xml)(FilterArg *arg, xmlNodePtr node); - xmlNodePtr (*values_get_xml)(FilterArg *arg); - - char * (*get_value_as_string)(FilterArg *arg, void *data); - - /* signals */ - void (*changed)(FilterArg *arg); -}; - -guint filter_arg_get_type (void); -FilterArg *filter_arg_new (char *name); -FilterArg *filter_arg_clone(FilterArg *arg); -void filter_arg_copy (FilterArg *dst, FilterArg *src); -void filter_arg_value_add(FilterArg *a, void *v); - -void filter_arg_edit_values(FilterArg *arg); -int filter_arg_edit_value(FilterArg *arg, int index); - -void filter_arg_remove(FilterArg *arg, void *v); -void filter_arg_add(FilterArg *arg, void *v); - -xmlNodePtr filter_arg_values_get_xml(FilterArg *arg); -void filter_arg_values_add_xml(FilterArg *arg, xmlNodePtr node); -int filter_arg_get_count(FilterArg *arg); -void *filter_arg_get_value(FilterArg *arg, int index); -char *filter_arg_get_value_as_string(FilterArg *arg, int index); - -#endif /* ! _FILTER_ARG_H */ - diff --git a/filter/filter-driver.c b/filter/filter-driver.c deleted file mode 100644 index c2759fe9d8..0000000000 --- a/filter/filter-driver.c +++ /dev/null @@ -1,472 +0,0 @@ - -#include -#include -#include -#include - -#include -#include - -#include "filter-arg-types.h" -#include "filter-xml.h" -#include "filter-sexp.h" -#include "filter-format.h" - -extern int filter_find_arg(FilterArg *a, char *name); - -#include "check.xpm" -#include "blank.xpm" - -/* - splices ${cc} lines into a single string -*/ -int -expand_variables(GString *out, char *source, GList *args, GHashTable *globals) -{ - GList *argl; - FilterArg *arg; - char *name= alloca(32); - char *start, *end, *newstart, *tmp, *val; - int namelen=32; - int len=0; - int ok = 0; - - start = source; - while ( (newstart = strstr(start, "${")) - && (end = strstr(newstart+2, "}")) ) { - len = end-newstart-2; - if (len+1>namelen) { - namelen = (len+1)*2; - name = alloca(namelen); - } - memcpy(name, newstart+2, len); - name[len] = 0; - argl = g_list_find_custom(args, name, (GCompareFunc) filter_find_arg); - if (argl) { - int i, count; - - tmp = g_strdup_printf("%.*s", newstart-start, start); - printf("appending: %s\n", tmp); - g_string_append(out, tmp); - g_free(tmp); - - arg = argl->data; - count = filter_arg_get_count(arg); - for (i=0;ioptions; - while (optionl) { - struct filter_optionrule *or = optionl->data; - if (or->rule->type == FILTER_XML_MATCH - || or->rule->type == FILTER_XML_EXCEPT) { - expand_variables(s, or->rule->code, or->args, globals); - } - optionl = g_list_next(optionl); - } - - g_string_append(s, ")"); -#if 0 - optionl = op->options; - while (optionl) { - struct filter_optionrule *or = optionl->data; - if (or->rule->type == FILTER_XML_ACTION) { - g_string_append(s, or->rule->code); - g_string_append(s, " "); - } - optionl = g_list_next(optionl); - } - g_string_append(s, ")))"); -#endif - printf("combined rule '%s'\n", s->str); -} - -struct filter_optionrule * -find_optionrule(struct filter_option *option, char *name) -{ - GList *optionrulel; - struct filter_optionrule *or; - - optionrulel = option->options; - while (optionrulel) { - or = optionrulel->data; - if (!strcmp(or->rule->name, name)) { - return or; - } - optionrulel = g_list_next(optionrulel); - } - return NULL; -} - -static char nooption[] = "

Select option

Select an option type from the list above.

"; - -void -html_write_options(GtkHTML *html, struct filter_option *option) -{ - GtkHTMLStreamHandle *stream; - GList *optionrulel; - - stream = gtk_html_begin(html, ""); - gtk_html_write(html, stream, "", strlen("")); - if (option) { - optionrulel = option->options; - while (optionrulel) { - struct filter_optionrule *or = optionrulel->data; - - filter_description_html_write(or->rule->description, or->args, html, stream); - gtk_html_write(html, stream, "
", strlen("
")); - optionrulel = g_list_next(optionrulel); - } - } else { - gtk_html_write(html, stream, nooption, strlen(nooption)); - } - gtk_html_end(html, stream, GTK_HTML_STREAM_OK); -} - -void -fill_rules(GtkWidget *list, GList *rules, struct filter_option *option, int type) -{ - GList *optionl, *rulel; - GtkWidget *listitem, *hbox, *checkbox, *label; - GList *items = NULL; - - rulel = rules; - while (rulel) { - struct filter_rule *fr = rulel->data; - char *labeltext; - - if (fr->type == type) { - int state; - - state = find_optionrule(option, fr->name) != NULL; - - labeltext = filter_description_text(fr->description, NULL); - - hbox = gtk_hbox_new(FALSE, 3); - checkbox = gnome_pixmap_new_from_xpm_d(state?check_xpm:blank_xpm); - gtk_box_pack_start(GTK_BOX(hbox), checkbox, FALSE, FALSE, 0); - label = gtk_label_new(labeltext); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); - listitem = gtk_list_item_new(); - gtk_container_add(GTK_CONTAINER(listitem), hbox); - gtk_widget_show_all(listitem); - - gtk_object_set_data(GTK_OBJECT(listitem), "checkbox", checkbox); - gtk_object_set_data(GTK_OBJECT(listitem), "checkstate", (void *)state); - gtk_object_set_data(GTK_OBJECT(listitem), "rule", fr); - - items = g_list_append(items, listitem); - } - rulel = g_list_next(rulel); - } - gtk_list_append_items(GTK_LIST(list), items); -} - -void -fill_options(GtkWidget *list, GList *options) -{ - GList *optionl, *rulel, *optionrulel; - GtkWidget *listitem, *hbox, *checkbox, *label; - GList *items = NULL; - - optionl = options; - while (optionl) { - struct filter_option *op = optionl->data; - char *labeltext; - - labeltext = filter_description_text(op->description, NULL); - listitem = gtk_list_item_new_with_label(labeltext); - g_free(labeltext); - gtk_widget_show_all(listitem); - - gtk_object_set_data(GTK_OBJECT(listitem), "option", op); - - items = g_list_append(items, listitem); - optionl = g_list_next(optionl); - } - gtk_list_append_items(GTK_LIST(list), items); -} - -GtkWidget *list_global, *html_global; -struct filter_option *option_current; - -static void -select_rule_child(GtkList *list, GtkWidget *child, void *data) -{ - GtkWidget *w; - struct filter_rule *fr = gtk_object_get_data(GTK_OBJECT(child), "rule"); - int state; - struct filter_optionrule *rule; - - w = gtk_object_get_data(GTK_OBJECT(child), "checkbox"); - state = !(int) gtk_object_get_data(GTK_OBJECT(child), "checkstate"); - - gnome_pixmap_load_xpm_d(GNOME_PIXMAP(w), state?check_xpm:blank_xpm); - gtk_object_set_data(GTK_OBJECT(child), "checkstate", (void *)state); - - if (state) { - printf("adding rule %p\n", fr); - rule = g_malloc0(sizeof(*rule)); - rule->rule = fr; - option_current->options = g_list_prepend(option_current->options, rule); - } else { - /* FIXME: free optionrule */ - rule = find_optionrule(option_current, fr->name); - if (rule) - option_current->options = g_list_remove(option_current->options, rule); - } - - { - GString *s = g_string_new(""); - expand_filter_option(s, option_current); - printf("Rules: %s\n", s->str); - g_string_free(s, TRUE); - } - - html_write_options(html_global, option_current); -} - -static void -select_option_child(GtkList *list, GtkWidget *child, void *data) -{ - struct filter_option *op = gtk_object_get_data(GTK_OBJECT(child), "option"); - struct filter_option *new; - GList *optionsl; - - if (option_current) { - /* free option_current copy */ - optionsl = option_current->options; - while (optionsl) { - GList *op = optionsl; - optionsl = g_list_next(optionsl); - g_free(op->data); - } - g_list_free(option_current->options); - g_free(option_current); - option_current = NULL; - } - - /* clone the option */ - new = g_malloc(sizeof(*new)); - new->type = op->type; - new->description = op->description; - new->options = NULL; - optionsl = op->options; - while (optionsl) { - struct filter_optionrule *ornew = g_malloc(sizeof(*ornew)), - *or = optionsl->data; - ornew->rule = or->rule; - /* FIXME: must copy args too *sigh* */ - ornew->args = or->args; - new->options = g_list_append(new->options, ornew); - optionsl = g_list_next(optionsl); - } - option_current = new; - - html_write_options(GTK_HTML(html_global), option_current); -} - -static void -arg_link_clicked(GtkHTML *html, const char *url, void *data) -{ - printf("url clicked: %s\n", url); - if (!strncmp(url, "arg:", 4)) { - FilterArg *arg; - void *dummy; - - if (sscanf(url+4, "%p %p", &dummy, &arg)==2 - && arg) { - printf("arg = %p\n", arg); - filter_arg_edit_values(arg); - /* should have a changed signal which propagates the rewrite */ - html_write_options(GTK_HTML(html_global), option_current); - } - } -} - -static void -dialogue_clicked(GtkWidget *w, int button, void *data) -{ - GString *s = g_string_new(""); - - printf("button %d clicked ...\n"); - - if (option_current) - expand_filter_option(s, option_current); - - g_string_free(s, TRUE); -} - -void create_dialogue(void) -{ - GtkWidget *dialogue, - *scrolled_window, - *list, - *html, - *frame; - - dialogue = gnome_dialog_new("Filter Rules", - GNOME_STOCK_BUTTON_PREV , GNOME_STOCK_BUTTON_NEXT, - "Finish", GNOME_STOCK_BUTTON_CANCEL, 0); - - list = gtk_list_new(); - frame = gtk_frame_new("Filter Type"); - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), list); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_set_focus_vadjustment - (GTK_CONTAINER (list), - gtk_scrolled_window_get_vadjustment - (GTK_SCROLLED_WINDOW (scrolled_window))); - gtk_container_add(GTK_CONTAINER(frame), scrolled_window); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialogue)->vbox), frame, TRUE, TRUE, GNOME_PAD); - -#if 0 - gtk_signal_connect(GTK_OBJECT(list), "select_child", select_rule_child, NULL); - gtk_signal_connect(GTK_OBJECT(list), "unselect_child", select_rule_child, NULL); -#else - gtk_signal_connect(GTK_OBJECT(list), "select_child", select_option_child, NULL); - gtk_signal_connect(GTK_OBJECT(list), "unselect_child", select_option_child, NULL); -#endif - - frame = gtk_frame_new("Filter Description"); - html = gtk_html_new(); - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(scrolled_window), html); - gtk_container_add(GTK_CONTAINER(frame), scrolled_window); - gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialogue)->vbox), frame, TRUE, TRUE, GNOME_PAD); - - gtk_signal_connect(GTK_OBJECT(html), "link_clicked", arg_link_clicked, NULL); - gtk_signal_connect(GTK_OBJECT(dialogue), "clicked", dialogue_clicked, NULL); - - list_global = list; - html_global = html; - - gtk_widget_show_all(dialogue); -} - -int main(int argc, char **argv) -{ - FilterSEXP *f; - FilterSEXPResult *r; - GList *rules, *options, *options2; - xmlDocPtr doc, out, optionset, filteroptions; - GString *s; - - gnome_init("Test", "0.0", argc, argv); - gdk_rgb_init (); - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - create_dialogue(); - - doc = xmlParseFile("filterdescription.xml"); - rules = filter_load_ruleset(doc); - options = filter_load_optionset(doc, rules); - options2 = options; - out = xmlParseFile("saveoptions.xml"); - options = filter_load_optionset(out, rules); - -#if 0 - option_current = options->data; - fill_rules(list_global, rules, options->data, FILTER_XML_MATCH); -#else - option_current = NULL; - fill_options(list_global, options2); -#endif - gtk_main(); - - while (options) { - struct filter_option *fo = options->data; - GList *optionrulel; - - optionrulel = fo->options; - while (optionrulel) { - struct filter_optionrule *or = optionrulel->data; - - printf("formatting rule: %s\n", or->rule->name); - - /*filter_description_text(or->rule->description, or->args);*/ - filter_description_html_write(or->rule->description, or->args, NULL, NULL); - - optionrulel = g_list_next(optionrulel); - } - options = g_list_next(options); - } - - return 0; - - s = g_string_new(""); - expand_filter_option(s, options->data); - g_string_append(s, ""); - - printf("total rule = '%s'\n", s->str); - - f = filter_sexp_new(); - filter_sexp_add_variable(f, 0, "sender", NULL); - filter_sexp_add_variable(f, 0, "receipient", NULL); - filter_sexp_add_variable(f, 0, "folder", NULL); - - /* simple functions */ - filter_sexp_add_function(f, 0, "header-get", NULL, NULL); - filter_sexp_add_function(f, 0, "header-contains", NULL, NULL); - filter_sexp_add_function(f, 0, "copy-to", NULL, NULL); - - filter_sexp_add_ifunction(f, 0, "set", NULL, NULL); - - /* control functions */ - filter_sexp_add_ifunction(f, 0, "match-all", NULL, NULL); - filter_sexp_add_ifunction(f, 0, "match", NULL, NULL); - filter_sexp_add_ifunction(f, 0, "action", NULL, NULL); - filter_sexp_add_ifunction(f, 0, "except", NULL, NULL); - - filter_sexp_input_text(f, s->str, strlen(s->str)); - filter_sexp_parse(f); - -} diff --git a/filter/filter-druid.c b/filter/filter-druid.c deleted file mode 100644 index c502302270..0000000000 --- a/filter/filter-druid.c +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include -#include -#include -#include - -#include -#include - -#include "filter-arg-types.h" -#include "filter-xml.h" -#include "filter-sexp.h" -#include "filter-format.h" - - -#include "filter-druid.h" - -static void filter_druid_class_init (FilterDruidClass *klass); -static void filter_druid_init (FilterDruid *obj); - -#define _PRIVATE(x) (((FilterDruid *)(x))->priv) - -struct _FilterDruidPrivate { - GtkWidget *notebook; - int page; - - char *default_html; - - /* page 0 */ - GtkWidget *list0; - GtkWidget *html0; - GtkWidget *add0, *remove0, *up0, *down0; - GList *items0; - GtkFrame *listframe0; - - /* page 1 */ - GtkWidget *name1; - GtkWidget *activate1; - GtkHTML *html1; -}; - -/* forward ref's */ -static void build_druid(FilterDruid *d); -static void update_display(FilterDruid *f, int initial); - -/* globals */ -static GtkNotebookClass *filter_druid_parent; - -enum SIGNALS { - OPTION_SELECTED, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -guint -filter_druid_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "FilterDruid", - sizeof (FilterDruid), - sizeof (FilterDruidClass), - (GtkClassInitFunc) filter_druid_class_init, - (GtkObjectInitFunc) filter_druid_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gtk_notebook_get_type (), &type_info); - } - - return type; -} - -static void -object_finalize(FilterDruid *obj) -{ - struct _FilterDruidPrivate *p = _PRIVATE(obj); - - g_free(p->default_html); - - printf("\n druid finalize!\n\n"); - - /* FIXME: free lists? */ - - GTK_OBJECT_CLASS(filter_druid_parent)->finalize(obj); -} - -static void -filter_druid_class_init (FilterDruidClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - filter_druid_parent = gtk_type_class (gtk_notebook_get_type ()); - - object_class->finalize = object_finalize; - - signals[OPTION_SELECTED] = - gtk_signal_new ("option_selected", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (FilterDruidClass, option_selected), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -filter_druid_init (FilterDruid *obj) -{ - struct _FilterDruidPrivate *priv; - - obj->priv = g_malloc0(sizeof(*obj->priv)); - priv = _PRIVATE(obj); -} - -/** - * filter_druid_new: - * - * Create a new FilterDruid object. - * - * Return value: A new FilterDruid widget. - **/ -FilterDruid * -filter_druid_new (void) -{ - FilterDruid *new = FILTER_DRUID ( gtk_type_new (filter_druid_get_type ())); - - build_druid(new); - - return new; -} - - -extern int filter_find_arg(FilterArg *a, char *name); - -#include "check.xpm" -#include "blank.xpm" - - -struct filter_optionrule * -find_optionrule(struct filter_option *option, char *name) -{ - GList *optionrulel; - struct filter_optionrule *or; - - optionrulel = option->options; - while (optionrulel) { - or = optionrulel->data; - if (!strcmp(or->rule->name, name)) { - return or; - } - optionrulel = g_list_next(optionrulel); - } - return NULL; -} - -static int display_order[] = { - FILTER_XML_MATCH, - FILTER_XML_EXCEPT, - FILTER_XML_ACTION, -}; -static char *display_pretext[] = { - "For messages matching:
    ", - "Unless:
      ", - "Perform these actions:
        ", -}; -static char *display_posttext[] = { - "
      ", - "
    ", - "
", -}; - -void -html_write_options(GtkHTML *html, struct filter_option *option, char *def) -{ - GtkHTMLStreamHandle *stream; - GList *optionrulel; - int i; - - stream = gtk_html_begin(html, ""); - gtk_html_write(html, stream, "", strlen("")); - if (option) { - char *t; - - if (option->type == FILTER_XML_SEND) { - t = "

When a message is sent.

"; - } else { - t = "

When a message is received.

"; - } - gtk_html_write(html, stream, t, strlen(t)); - - for (i=0;ioptions; - while (optionrulel) { - struct filter_optionrule *or = optionrulel->data; - - if (or->rule->type == display_order[i]) { - if (!doneheader) { - gtk_html_write(html, stream, display_pretext[i], strlen(display_pretext[i])); - doneheader = TRUE; - } - - filter_description_html_write(or->rule->description, or->args, html, stream); - gtk_html_write(html, stream, "
", strlen("
")); - } - optionrulel = g_list_next(optionrulel); - } - if (doneheader) { - gtk_html_write(html, stream, display_posttext[i], strlen(display_posttext[i])); - } - } - } else { - if (def == NULL) - def = "Select options."; - gtk_html_write(html, stream, def, strlen(def)); - } - gtk_html_end(html, stream, GTK_HTML_STREAM_OK); -} - -GList * -fill_rules(GList *rules, struct filter_option *option, int type) -{ - GList *optionl, *rulel; - GtkWidget *listitem, *hbox, *checkbox, *label; - GList *items = NULL; - - rulel = rules; - while (rulel) { - struct filter_rule *fr = rulel->data; - char *labeltext; - - if (fr->type == type) { - int state; - - state = find_optionrule(option, fr->name) != NULL; - - labeltext = filter_description_text(fr->description, NULL); - - printf("adding rule %s\n", labeltext); - - hbox = gtk_hbox_new(FALSE, 3); - checkbox = gnome_pixmap_new_from_xpm_d(state?check_xpm:blank_xpm); - gtk_box_pack_start(GTK_BOX(hbox), checkbox, FALSE, FALSE, 0); - label = gtk_label_new(labeltext); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); - listitem = gtk_list_item_new(); - gtk_container_add(GTK_CONTAINER(listitem), hbox); - gtk_widget_show_all(listitem); - - gtk_object_set_data(GTK_OBJECT(listitem), "checkbox", checkbox); - gtk_object_set_data(GTK_OBJECT(listitem), "checkstate", (void *)state); - gtk_object_set_data(GTK_OBJECT(listitem), "rule", fr); - - items = g_list_append(items, listitem); - } - rulel = g_list_next(rulel); - } - return items; -} - -GList * -fill_options(GList *options) -{ - GList *optionl, *rulel, *optionrulel; - GtkWidget *listitem, *hbox, *checkbox, *label; - GList *items = NULL; - - optionl = options; - while (optionl) { - struct filter_option *op = optionl->data; - char *labeltext; - - labeltext = filter_description_text(op->description, NULL); - listitem = gtk_list_item_new_with_label(labeltext); - g_free(labeltext); - gtk_widget_show_all(listitem); - - gtk_object_set_data(GTK_OBJECT(listitem), "option", op); - - items = g_list_append(items, listitem); - optionl = g_list_next(optionl); - } - return items; -} - -static void -select_rule_child(GtkList *list, GtkWidget *child, FilterDruid *f) -{ - GtkWidget *w; - struct filter_rule *fr = gtk_object_get_data(GTK_OBJECT(child), "rule"); - int state; - struct filter_optionrule *rule; - struct _FilterDruidPrivate *p = _PRIVATE(f); - - w = gtk_object_get_data(GTK_OBJECT(child), "checkbox"); - state = !(int) gtk_object_get_data(GTK_OBJECT(child), "checkstate"); - - gnome_pixmap_load_xpm_d(GNOME_PIXMAP(w), state?check_xpm:blank_xpm); - gtk_object_set_data(GTK_OBJECT(child), "checkstate", (void *)state); - - if (state) { - printf("adding rule %p\n", fr); - rule = filter_optionrule_new_from_rule(fr); - f->option_current->options = g_list_append(f->option_current->options, rule); - } else { - rule = find_optionrule(f->option_current, fr->name); - if (rule) { - f->option_current->options = g_list_remove(f->option_current->options, rule); - filter_clone_optionrule_free(rule); - } - } - - update_display(f, 0); -} - - - -static void -select_option_child(GtkList *list, GtkWidget *child, FilterDruid *f) -{ - struct filter_option *op; - struct filter_option *new; - GList *optionsl; - struct _FilterDruidPrivate *p = _PRIVATE(f); - - switch (p->page) { - case 1: - case 2: - case 3: - select_rule_child(list, child, f); - default: - return; - case 0: - break; - } - - if (f->option_current) { - printf("freeing current option\n"); - /* free option_current copy */ - optionsl = f->option_current->options; - while (optionsl) { - GList *op = optionsl; - optionsl = g_list_next(optionsl); - g_free(op->data); - } - g_list_free(f->option_current->options); - g_free(f->option_current); - f->option_current = NULL; - } - - if (child) { - op = gtk_object_get_data(GTK_OBJECT(child), "option"); - - printf("option = %p\n", op); - - /* clone the option */ - new = g_malloc(sizeof(*new)); - new->type = op->type; - new->description = op->description; - new->options = NULL; - optionsl = op->options; - while (optionsl) { - struct filter_optionrule *ornew, - *or = optionsl->data; - ornew = filter_clone_optionrule(or); - new->options = g_list_append(new->options, ornew); - optionsl = g_list_next(optionsl); - } - f->option_current = new; - - gtk_signal_emit(GTK_OBJECT(f), signals[OPTION_SELECTED], op); - } - - update_display(f, 0); -} - -static void -unselect_option_child(GtkList *list, GtkWidget *child, FilterDruid *f) -{ - select_option_child(list, NULL, f); -} - -static void -arg_link_clicked(GtkHTML *html, const char *url, FilterDruid *f) -{ - printf("url clicked: %s\n", url); - if (!strncmp(url, "arg:", 4)) { - FilterArg *arg; - void *dummy; - - if (sscanf(url+4, "%p %p", &dummy, &arg)==2 - && arg) { - FilterArg *orig; - - printf("arg = %p\n", arg); - filter_arg_edit_values(arg); - - /* insert the new value into the existing one */ - orig = gtk_object_get_data(arg, "origin"); - if (orig) { - filter_arg_copy(orig, arg); - } else { - g_warning("unknown object loaded"); - } - /* should have a changed signal which propagates the rewrite */ - update_display(f, 0); - } - } -} - -static void -option_name_changed(GtkEntry *entry, FilterDruid *f) -{ - struct filter_desc *desc; - - printf("name chaned: %s\n", gtk_entry_get_text(entry)); - - if (f->option_current) { - /* FIXME: lots of memory leaks */ - desc = g_malloc0(sizeof(*desc)); - desc->data = g_strdup(gtk_entry_get_text(entry)); - desc->type = FILTER_XML_TEXT; - desc->vartype = -1; - desc->varname = NULL; - f->option_current->description = g_list_append(NULL, desc); - } -} - -static void -dialogue_clicked(FilterDruid *d, int button, void *data) -{ - GString *s = g_string_new(""); - struct _FilterDruidPrivate *p = _PRIVATE(d); - int initial=0; - - printf("button %d clicked ...\n", button); - - g_string_free(s, TRUE); - - switch(button) { - case 1: - if (p->page<4) { - p->page++; - initial =1; - } - break; - case 0: - if (p->page>0) { - p->page--; - initial = 1; - } - break; - } - update_display(d, initial); -} - -static int filter_types[] = { FILTER_XML_MATCH, FILTER_XML_EXCEPT, FILTER_XML_ACTION }; -static char *filter_titles[] = { - "Select rule(s), where messages match", - "Select rule(s), where messages do not match", - "Select action(s) to apply to messages" - -}; -static void -update_display(FilterDruid *f, int initial) -{ - struct _FilterDruidPrivate *p = _PRIVATE(f); - - printf("rending page %d options\n", p->page); - - switch (p->page) { - case 0: - printf("option_current = %p <###################\n", f->option_current); - - if (initial) { - printf("adding options\n"); - gtk_signal_handler_block_by_data((GtkObject *)p->list0, f); - gtk_list_remove_items((GtkList *)p->list0, p->items0); - p->items0 = fill_options(f->options); - gtk_list_append_items((GtkList *)p->list0, p->items0); - gtk_signal_handler_unblock_by_data((GtkObject *)p->list0, f); - gtk_frame_set_label(p->listframe0, "Select rule type"); - } - - html_write_options((GtkHTML *)p->html0, f->option_current, p->default_html); - break; - case 1: - case 2: - case 3: - if (initial) { - printf("adding rules\n"); - gtk_signal_handler_block_by_data((GtkObject *)p->list0, f); - gtk_list_remove_items((GtkList *)p->list0, p->items0); - p->items0 = fill_rules(f->rules, f->option_current, filter_types[p->page-1]); - gtk_list_append_items((GtkList *)p->list0, p->items0); - gtk_signal_handler_unblock_by_data((GtkObject *)p->list0, f); - gtk_frame_set_label(p->listframe0, filter_titles[p->page-1]); - gtk_notebook_set_page(GTK_NOTEBOOK(p->notebook), 0); - } - - html_write_options((GtkHTML *)p->html0, f->option_current, p->default_html); - break; - case 4: - if (initial) { - char *text; - text = filter_description_text(f->option_current->description, NULL); - if (text == NULL) { - /* maybe this could fudge something out of the first - bits of the rule */ - if (f->option_current->type == FILTER_XML_SEND) { - text = "Filter messages sent"; - } else { - text = "Filter messages received"; - } - gtk_entry_set_text(GTK_ENTRY(p->name1), text); - } else { - gtk_entry_set_text(GTK_ENTRY(p->name1), text); - g_free(text); - } - gtk_notebook_set_page(GTK_NOTEBOOK(p->notebook), 1); - } - - html_write_options((GtkHTML *)p->html1, f->option_current, p->default_html); - break; - - } -} - -void -filter_druid_set_rules(FilterDruid *f, GList *options, GList *rules, struct filter_option *current) -{ - struct filter_option *new; - GList *optionsl; - - f->options = options; - f->rules = rules; - f->user = NULL; - - if (current) { - /* FIXME: free this list if it isn't empty ... */ - /* clone the 'current' option */ - new = g_malloc(sizeof(*new)); - new->type = current->type; - new->description = current->description; - new->options = NULL; - optionsl = current->options; - while (optionsl) { - struct filter_optionrule *ornew, - *or = optionsl->data; - ornew = filter_clone_optionrule(or); - new->options = g_list_append(new->options, ornew); - optionsl = g_list_next(optionsl); - } - f->option_current = new; - } else { - f->option_current = NULL; - } - - update_display(f, 1); -} - -static void -build_druid(FilterDruid *d) -{ - GtkWidget *vbox, *frame, *scrolled_window, *list, *html, *hbox, *label, *vbox1; - struct _FilterDruidPrivate *p = _PRIVATE(d); - -#if 0 - gnome_dialog_append_buttons((GnomeDialog *)d, "Prev", "Next", "Finish", "Cancel", 0); - gnome_dialog_set_close((GnomeDialog *)d, FALSE); - gnome_dialog_set_sensitive((GnomeDialog *)d, 0, FALSE); - gnome_dialog_set_sensitive((GnomeDialog *)d, 1, FALSE); - gnome_dialog_set_sensitive((GnomeDialog *)d, 2, FALSE); - gnome_dialog_set_default((GnomeDialog *)d, 1); -#endif - - p->notebook = d; - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(p->notebook), FALSE); - - /* page0, initial setup page */ - vbox = gtk_vbox_new(FALSE, 3); - frame = gtk_frame_new("Filters"); - p->listframe0 = (GtkFrame *)frame; - - list = gtk_list_new(); - scrolled_window = gtk_scrolled_window_new(NULL, NULL); - gtk_widget_set_usize(scrolled_window, 400, 150); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window), list); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_set_focus_vadjustment - (GTK_CONTAINER (list), - gtk_scrolled_window_get_vadjustment - (GTK_SCROLLED_WINDOW (scrolled_window))); - gtk_container_add(GTK_CONTAINER(frame), scrolled_window); - gtk_box_pack_start((GtkBox *)vbox, frame, TRUE, TRUE, 0); - - frame = gtk_frame_new("Filter Description (click on values to edit)"); - html = gtk_html_new(); - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_set_usize(scrolled_window, 400, 150); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(scrolled_window), html); - gtk_container_add(GTK_CONTAINER(frame), scrolled_window); - gtk_box_pack_start((GtkBox *)vbox, frame, TRUE, TRUE, 0); - - p->html0 = html; - p->list0 = list; - - gtk_signal_connect(GTK_OBJECT(list), "select_child", select_option_child, d); - gtk_signal_connect(GTK_OBJECT(list), "unselect_child", select_option_child, d); -/* gtk_signal_connect(GTK_OBJECT(list), "unselect_child", unselect_option_child, d); */ -/* gtk_signal_connect(GTK_OBJECT(d), "clicked", dialogue_clicked, d);*/ - - gtk_signal_connect(GTK_OBJECT(html), "link_clicked", arg_link_clicked, d); - - gtk_notebook_append_page(GTK_NOTEBOOK(p->notebook), vbox, NULL); - - - /* page1, used for the final page display */ - vbox = gtk_vbox_new(FALSE, 3); - - frame = gtk_frame_new("Rule options"); - vbox1 = gtk_vbox_new(FALSE, 3); - - hbox = gtk_hbox_new(FALSE, 3); - label = gtk_label_new("Name of rule"); - p->name1 = gtk_entry_new(); - gtk_box_pack_start((GtkBox *)hbox, label, FALSE, FALSE, 0); - gtk_box_pack_start((GtkBox *)hbox, p->name1, TRUE, TRUE, 0); - gtk_box_pack_start((GtkBox *)vbox1, hbox, TRUE, FALSE, 0); - - gtk_container_add(GTK_CONTAINER(frame), vbox1); - - p->activate1 = gtk_check_button_new_with_label("Activate rule?"); - gtk_box_pack_start((GtkBox *)vbox1, p->activate1, TRUE, FALSE, 0); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p->activate1), TRUE); - - gtk_signal_connect(GTK_OBJECT(p->name1), "changed", option_name_changed, d); - - gtk_box_pack_start((GtkBox *)vbox, frame, TRUE, TRUE, 0); - - /* another copy of the filter thingy */ - frame = gtk_frame_new("Filter Description (click on values to edit)"); - html = gtk_html_new(); - p->html1 = (GtkHTML *)html; - scrolled_window = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_set_usize(scrolled_window, 400, 150); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(scrolled_window), html); - gtk_container_add(GTK_CONTAINER(frame), scrolled_window); - gtk_box_pack_start((GtkBox *)vbox, frame, TRUE, TRUE, 0); - - /* finish off */ - gtk_notebook_append_page(GTK_NOTEBOOK(p->notebook), vbox, NULL); - - gtk_signal_connect(GTK_OBJECT(html), "link_clicked", arg_link_clicked, d); - - gtk_widget_show_all(p->notebook); -} - -void -filter_druid_set_page(FilterDruid *f, enum FilterDruidPage page) -{ - struct _FilterDruidPrivate *p = _PRIVATE(f); - int initial = p->page != page; - - p->page = page; - update_display(f, initial); -} - - -void -filter_druid_set_default_html(FilterDruid *f, const char *html) -{ - struct _FilterDruidPrivate *p = _PRIVATE(f); - - g_free(p->default_html); - p->default_html = g_strdup(html); -} - -enum FilterDruidPage -filter_druid_get_page(FilterDruid *f) -{ - struct _FilterDruidPrivate *p = _PRIVATE(f); - - return p->page; -} - diff --git a/filter/filter-druid.h b/filter/filter-druid.h deleted file mode 100644 index 7927dc70dd..0000000000 --- a/filter/filter-druid.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef _FILTER_DRUID_H -#define _FILTER_DRUID_H - -#include - -#include "filter-xml.h" - -#define FILTER_DRUID(obj) GTK_CHECK_CAST (obj, filter_druid_get_type (), FilterDruid) -#define FILTER_DRUID_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_druid_get_type (), FilterDruidClass) -#define IS_FILTER_DRUID(obj) GTK_CHECK_TYPE (obj, filter_druid_get_type ()) - -typedef struct _FilterDruid FilterDruid; -typedef struct _FilterDruidClass FilterDruidClass; - -enum FilterDruidPage { - FILTER_DRUID_SELECT_RULE, - FILTER_DRUID_SELECT_MATCH, - FILTER_DRUID_SELECT_NOMATCH, - FILTER_DRUID_SELECT_ACTION, - FILTER_DRUID_SELECT_FINISH -}; - -struct _FilterDruid { - GtkNotebook parent; - - GList *options; /* all options */ - GList *rules; /* all rules */ - GList *user; /* current user options */ - - struct filter_option *option_current; - - struct _FilterDruidPrivate *priv; -}; - -struct _FilterDruidClass { - GtkNotebookClass parent_class; - - /* signals */ - void (*option_selected)(FilterDruid *f, struct filter_option *option); -}; - -guint filter_druid_get_type (void); -FilterDruid *filter_druid_new (void); - -/* Hmm, glists suck, no typesafety */ -void filter_druid_set_rules(FilterDruid *f, GList *options, GList *rules, struct filter_option *userrule); -void filter_druid_set_default_html(FilterDruid *f, const char *text); - -/* set the page of display */ -void filter_druid_set_page(FilterDruid *f, enum FilterDruidPage page); -enum FilterDruidPage filter_druid_get_page(FilterDruid *f); - -/* check if the druid is allowed to finish at this point */ -gboolean filter_druid_can_finish(FilterDruid *f); - -#endif /* ! _FILTER_DRUID_H */ diff --git a/filter/filter-editor.c b/filter/filter-editor.c deleted file mode 100644 index 1d68276b73..0000000000 --- a/filter/filter-editor.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "filter-druid.h" -#include "filter-editor.h" - - -static void filter_editor_class_init (FilterEditorClass *klass); -static void filter_editor_init (FilterEditor *obj); - -static GnomeDialogClass *filter_editor_parent; - -#define _PRIVATE(x) (((FilterEditor *)(x))->priv) - -struct _FilterEditorPrivate { - FilterDruid *druid; - - GtkWidget *edit, *add, *remove, *up, *down; - - /* for sub-druid */ - struct filter_option *druid_option; - GtkWidget *druid_dialogue; - FilterDruid *druid_druid; -}; - -enum SIGNALS { - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -guint -filter_editor_get_type (void) -{ - static guint type = 0; - - if (!type) { - GtkTypeInfo type_info = { - "FilterEditor", - sizeof (FilterEditor), - sizeof (FilterEditorClass), - (GtkClassInitFunc) filter_editor_class_init, - (GtkObjectInitFunc) filter_editor_init, - (GtkArgSetFunc) NULL, - (GtkArgGetFunc) NULL - }; - - type = gtk_type_unique (gnome_dialog_get_type (), &type_info); - } - - return type; -} - -static void -filter_editor_class_init (FilterEditorClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - filter_editor_parent = gtk_type_class (gnome_dialog_get_type ()); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); -} - -static void -filter_editor_init (FilterEditor *obj) -{ - obj->priv = g_malloc0(sizeof(*obj->priv)); -} - - -static void -sensitise(FilterEditor *e) -{ - struct _FilterEditorPrivate *p = _PRIVATE(e); - - gtk_widget_set_sensitive(p->add, TRUE); - gtk_widget_set_sensitive(p->edit, e->option_current != NULL); - gtk_widget_set_sensitive(p->remove, e->option_current != NULL); - gtk_widget_set_sensitive(p->up, g_list_index(e->useroptions, e->option_current)>0); - gtk_widget_set_sensitive(p->down, g_list_index(e->useroptions, e->option_current)!=g_list_length(e->useroptions)-1); -} - -static void -druid_option_selected(FilterDruid *f, struct filter_option *option, FilterEditor *e) -{ - printf("option selected: %p\n", option); - e->option_current = option; - sensitise(e); -} - -static void -druid_dialogue_clicked(GnomeDialog *d, int button, FilterEditor *e) -{ - struct _FilterEditorPrivate *p = _PRIVATE(e); - int page = filter_druid_get_page(p->druid_druid); - - switch(button) { - case 1: - if (page<4) { - page++; - } - break; - case 0: - if (page>0) { - page--; - } - break; - case 2: - printf("Finish!\n"); - if (p->druid_druid->option_current) { - /* FIXME: this should be copied? */ - if (p->druid_option) { - GList *node; - - node = g_list_find(e->useroptions, p->druid_option); - if (node) { - /* FIXME: memleak, should copy */ - node->data = p->druid_druid->option_current; - } else { - g_warning("Cannot find node I edited, appending instead"); - e->useroptions = g_list_append(e->useroptions, p->druid_druid->option_current); - } - } else { - e->useroptions = g_list_append(e->useroptions, p->druid_druid->option_current); - } - filter_druid_set_rules(p->druid, e->useroptions, e->rules, NULL); - } - case 3: - printf("cancel!\n"); - gnome_dialog_close(d); - return; - } - filter_druid_set_page(p->druid_druid, page); - - gnome_dialog_set_sensitive(p->druid_dialogue, 0, page>0); - gnome_dialog_set_sensitive(p->druid_dialogue, 1, page<4); - gnome_dialog_set_sensitive(p->druid_dialogue, 2, page==4); /* FIXME: make this depenedant on when the rules are actually done */ -} - -static void -druid_dialogue_option_selected(FilterDruid *f, struct filter_option *option, FilterEditor *e) -{ - struct _FilterEditorPrivate *p = _PRIVATE(e); - - gnome_dialog_set_sensitive(p->druid_dialogue, 1, TRUE); -} - -static void -add_or_edit(FilterEditor *e, struct filter_option *option) -{ - GnomeDialog *dialogue; - FilterDruid *druid; - struct _FilterEditorPrivate *p = _PRIVATE(e); - - dialogue = gnome_dialog_new(option?"Edit Filter":"Create filter", "Prev", "Next", "Finish", "Cancel", 0); - - p->druid_dialogue = dialogue; - - gnome_dialog_set_close(dialogue, FALSE); - gnome_dialog_set_sensitive(dialogue, 0, FALSE); - gnome_dialog_set_sensitive(dialogue, 1, FALSE); - gnome_dialog_set_sensitive(dialogue, 2, FALSE); - gnome_dialog_set_default(dialogue, 1); - - gtk_signal_connect(GTK_OBJECT(dialogue), "clicked", druid_dialogue_clicked, e); - - druid = filter_druid_new(); - - p->druid_druid = druid; - - filter_druid_set_default_html(p->druid_druid, "

Create Filtering Rule

" - "

Select one of the base rules above, then continue " - "forwards to customise it.

"); - - filter_druid_set_rules(druid, e->systemoptions, e->rules, option); - gtk_box_pack_start(dialogue->vbox, druid, TRUE, TRUE, 0); - - if (option) { - druid_dialogue_clicked(dialogue, 1, e); - } - - p->druid_option = option; - - gtk_signal_connect(druid, "option_selected", druid_dialogue_option_selected, e); - - gtk_widget_show(druid); - gtk_widget_show(dialogue); -} - -static void -add_clicked(GtkWidget *w, FilterEditor *e) -{ - printf("add new ...\n"); - - add_or_edit(e, NULL); -} - -static void -edit_clicked(GtkWidget *w, FilterEditor *e) -{ - printf("add new ...\n"); - - add_or_edit(e, e->option_current); -} - -static void -remove_clicked(GtkWidget *w, FilterEditor *e) -{ - printf("remove current ...\n"); -} - -static void -up_clicked(GtkWidget *w, FilterEditor *e) -{ - printf("up ...\n"); -} - -static void -down_clicked(GtkWidget *w, FilterEditor *e) -{ - printf("down ...\n"); -} - -/* build the contents of the editor */ -static void -build_editor(FilterEditor *e) -{ - struct _FilterEditorPrivate *p = _PRIVATE(e); - GtkWidget *hbox; - GtkWidget *vbox; - - hbox = gtk_hbox_new(FALSE, 3); - - p->druid = (GtkWidget *)filter_druid_new(); - gtk_box_pack_start((GtkBox *)hbox, p->druid, TRUE, TRUE, 0); - - vbox = gtk_vbox_new(FALSE, 0); - - p->edit = gtk_button_new_with_label ("Edit"); - p->add = gtk_button_new_with_label ("Add"); - p->remove = gtk_button_new_with_label ("Remove"); - p->up = gtk_button_new_with_label ("Up"); - p->down = gtk_button_new_with_label ("Down"); - - gtk_box_pack_start((GtkBox *)vbox, p->edit, FALSE, TRUE, 0); - gtk_box_pack_start((GtkBox *)vbox, p->add, FALSE, TRUE, 3); - gtk_box_pack_start((GtkBox *)vbox, p->remove, FALSE, TRUE, 0); - gtk_box_pack_start((GtkBox *)vbox, p->up, FALSE, TRUE, 3); - gtk_box_pack_start((GtkBox *)vbox, p->down, FALSE, TRUE, 0); - - gtk_box_pack_start((GtkBox *)hbox, vbox, FALSE, FALSE, 0); - - gtk_box_pack_start((GtkBox *)e->parent.vbox, hbox, TRUE, TRUE, 0); - - gtk_signal_connect(p->druid, "option_selected", druid_option_selected, e); - - gtk_signal_connect(p->edit, "clicked", edit_clicked, e); - gtk_signal_connect(p->add, "clicked", add_clicked, e); - gtk_signal_connect(p->remove, "clicked", remove_clicked, e); - gtk_signal_connect(p->up, "clicked", up_clicked, e); - gtk_signal_connect(p->down, "clicked", down_clicked, e); - - filter_druid_set_default_html(p->druid, "

Filtering Rules

" - "

Select one of the rules above to view, and " - "edit. Or Add a new rule.

"); - - gtk_widget_show_all(hbox); - sensitise(e); -} - - -/** - * filter_editor_new: - * - * Create a new FilterEditor object. - * - * Return value: A new FilterEditor widget. - **/ -FilterEditor * -filter_editor_new (void) -{ - FilterEditor *new = FILTER_EDITOR ( gtk_type_new (filter_editor_get_type ())); - - build_editor(new); - - return new; -} - -void -filter_editor_set_rules(FilterEditor *e, GList *rules, GList *systemoptions, GList *useroptions) -{ - struct _FilterEditorPrivate *p = _PRIVATE(e); - - e->rules= rules; - e->systemoptions = systemoptions; - e->useroptions = useroptions; - - filter_druid_set_rules(p->druid, useroptions, rules, NULL); -} - -int main(int argc, char **argv) -{ - GList *rules, *options, *options2; - xmlDocPtr doc, out, optionset, filteroptions; - GString *s; - - gnome_init("Test", "0.0", argc, argv); - gdk_rgb_init (); - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - { - - GtkWidget *w = filter_editor_new(); - - doc = xmlParseFile("filterdescription.xml"); - rules = filter_load_ruleset(doc); - options = filter_load_optionset(doc, rules); - options2 = options; - out = xmlParseFile("saveoptions.xml"); - options = filter_load_optionset(out, rules); - - filter_editor_set_rules(w, rules, options2, options); - - gtk_widget_show(w); - gtk_main(); - } -} diff --git a/filter/filter-editor.h b/filter/filter-editor.h deleted file mode 100644 index 612e9ec166..0000000000 --- a/filter/filter-editor.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2000 Helix Code Inc. - * - * Authors: Michael Zucchi - * - * This program 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 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef _FILTER_EDITOR_H -#define _FILTER_EDITOR_H - -#include -#include - -#define FILTER_EDITOR(obj) GTK_CHECK_CAST (obj, filter_editor_get_type (), FilterEditor) -#define FILTER_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_editor_get_type (), FilterEditorClass) -#define IS_FILTER_EDITOR(obj) GTK_CHECK_TYPE (obj, filter_editor_get_type ()) - -typedef struct _FilterEditor FilterEditor; -typedef struct _FilterEditorClass FilterEditorClass; - -struct _FilterEditor { - GnomeDialog parent; - - struct _FilterEditorPrivate *priv; - - GList *rules; - GList *systemoptions; - GList *useroptions; - - struct filter_option *option_current; -}; - -struct _FilterEditorClass { - GnomeDialogClass parent_class; -}; - -guint filter_editor_get_type (void); -FilterEditor *filter_editor_new (void); - -#endif /* ! _FILTER_EDITOR_H */ diff --git a/filter/filter-format.c b/filter/filter-format.c deleted file mode 100644 index 8f0f67b16e..0000000000 --- a/filter/filter-format.c +++ /dev/null @@ -1,237 +0,0 @@ -/* -*- Mode: C; c-file-style: "linux"; indent-tabs-mode: t; c-basic-offset: 8; -*- */ - -#include -#include -#include -#include - -#include -#include - -#include "filter-arg-types.h" -#include "filter-xml.h" - -#define d(x) - -/* FIXME: remove static, this is defined in filter-xml */ -static int -filter_find_rule(struct filter_rule *a, char *name) -{ - d(printf("finding, is %s = %s?\n", a->name, name)); - return strcmp(a->name, name); -} - -static int -filter_find_arg(FilterArg *a, char *name) -{ - d(printf("finding, is %s = %s?\n", a->name, name)); - return strcmp(a->name, name); -} - -static int display_order[] = { FILTER_XML_MATCH, FILTER_XML_ACTION, FILTER_XML_EXCEPT }; - -static struct filter_option * -option_clone(struct filter_option *source) -{ - struct filter_option *dest = g_malloc0(sizeof(*dest)); - GList *loptions; - struct filter_optionrule *old, *new; - - dest->type = source->type; - dest->description = source->description; - loptions = dest->options; - while (loptions) { - old = loptions->data; - new = g_malloc0(sizeof(*new)); - new->rule = old->rule; - /* FIXME: need to copy any args as well!!! */ - dest->options = g_list_append(dest->options, new); - loptions = g_list_next(loptions); - } - return dest; -} - - - -struct description_decode_lambda { - GString *str; - GList *args; - GtkHTML *html; - GtkHTMLStreamHandle *stream; -}; - -static char * -arg_text(FilterArg *arg) -{ - char *out = NULL; - GList *value, *next; - GString *str; - - value = arg->values; - - d(printf("getting text from arg %s\n", arg->name)); - - if (value == NULL) - return NULL; - - str = g_string_new(""); - filter_arg_write_text(arg, str); - out = str->str; - g_string_free(str, FALSE); - return out; -} - -static void -description_decode_text(struct filter_desc *d, struct description_decode_lambda *l) -{ - GList *list; - char *txt; - - switch (d->type) { - case FILTER_XML_TEXT: - case FILTER_XML_DESC: - dotext: - d(printf("appending '%s'\n", d->data)); - /* printf("vartype = %s\n", detokenise(d->vartype)); */ - d(printf("varname = %s\n", d->varname)); - if (d->vartype !=-1 && d->varname - && (list = g_list_find_custom(l->args, d->varname, (GCompareFunc) filter_find_arg)) - && (txt = arg_text(list->data))) { - } else { - txt = d->data; - } - g_string_append(l->str, txt); - break; - default: - printf("WARN: unknown desc text type '%d' = %s\n", d->type, d->data); - goto dotext; - } -} - -char * -filter_description_text(GList *description, GList *args) -{ - char *txt; - struct description_decode_lambda l; - - d(printf("\ndecoding ...\n")); - - l.str = g_string_new(""); - l.args = args; - g_list_foreach(description, (GFunc) description_decode_text, &l); - - d(printf("string is '%s'\n", l.str->str)); - - txt = l.str->str; - g_string_free(l.str, FALSE); - - return txt; -} - -static void -html_write(GtkHTML *html, GtkHTMLStreamHandle *stream, char *s) -{ - d(printf("appending html '%s'\n", s)); - gtk_html_write(html, stream, s, strlen(s)); -} - - -static void -description_decode_html(struct filter_desc *d, struct description_decode_lambda *l) -{ - GList *list; - char *txt, *end; - int free; - - switch (d->type) { - case FILTER_XML_TEXT: - case FILTER_XML_DESC: - dotext: - d(printf("appending '%s'\n", d->data)); - /*printf("vartype = %s\n", detokenise(d->vartype));*/ - d(printf("varname = %s\n", d->varname)); - free = FALSE; - if (d->vartype !=-1 && d->varname) { - char *link; - list = g_list_find_custom(l->args, d->varname, (GCompareFunc) filter_find_arg); - end = ""; - if (list) { - txt = arg_text(list->data); - if (txt == NULL) - txt = d->data; - else - free = TRUE; - link = g_strdup_printf("", d, list->data); - } else { - printf("cannot find arg '%s'\n", d->varname); - link = g_strdup_printf("", d, NULL); - txt = d->data; - } - html_write(l->html, l->stream, link); - g_free(link); - } else { - txt = d->data; - end = NULL; - } - html_write(l->html, l->stream, txt); - if (end) { - html_write(l->html, l->stream, end); - } - if (free) - g_free(txt); - break; - default: - /*printf("WARN: unknown desc text type '%s' = %s\n", detokenise(d->type), d->data);*/ - goto dotext; - } -} - -void -filter_description_html_write(GList *description, GList *args, GtkHTML *html, GtkHTMLStreamHandle *stream) -{ - char *txt; - struct description_decode_lambda l; - - d(printf("\ndecoding ...\n")); - - l.str = NULL; - l.args = args; - l.html = html; - l.stream = stream; - g_list_foreach(description, (GFunc) description_decode_html, &l); -} - -#ifdef TESTER -int main(int argc, char **argv) -{ - GList *rules, *options; - xmlDocPtr doc, out, optionset, filteroptions; - - gnome_init("Test", "0.0", argc, argv); - - doc = xmlParseFile("filterdescription.xml"); - - rules = load_ruleset(doc); - options = load_optionset(doc, rules); - - out = xmlParseFile("saveoptions.xml"); - options = load_optionset(doc, rules); - - while (options) { - printf("applying a rule ...\n"); - filterme(options->data); - options = g_list_next(options); - } - -#if 0 - out = xmlNewDoc("1.0"); - optionset = save_optionset(out, options); - filteroptions = xmlNewDocNode(out, NULL, "filteroptions", NULL); - xmlAddChild(filteroptions, optionset); - xmlDocSetRootElement(out, filteroptions); - xmlSaveFile("saveoptions.xml", out); -#endif - return 0; -} -#endif - diff --git a/filter/filter-format.h b/filter/filter-format.h deleted file mode 100644 index 12a4040a46..0000000000 --- a/filter/filter-format.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef _FILTER_FORMAT_H -#define _FILTER_FORMAT_H - -#include - -char *filter_description_text(GList *description, GList *args); -void description_html_write(GList *description, GList *args, GtkHTML *html, GtkHTMLStreamHandle *stream); - -#endif /* _FILTER_FORMAT_H */ diff --git a/filter/filter-sexp.c b/filter/filter-sexp.c deleted file mode 100644 index 04f8a82e6c..0000000000 --- a/filter/filter-sexp.c +++ /dev/null @@ -1,1090 +0,0 @@ -/* - * Copyright 2000 HelixCode (http://www.helixcode.com). - * - * A simple, extensible s-exp evaluation engine. - * - * Author : - * Michael Zucchi - - * 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 - */ - -/* - The following built-in s-exp's are supported: - - list = (and list*) - perform an intersection of a number of lists, and return that. - - bool = (and bool*) - perform a boolean AND of boolean values. - - list = (or list*) - perform a union of a number of lists, returning the new list. - - bool = (or bool*) - perform a boolean OR of boolean values. - - int = (+ int*) - Add integers. - - string = (+ string*) - Concat strings. - - int = (- int int*) - Subtract integers from the first. - - Comparison operators: - - bool = (< int int) - bool = (> int int) - bool = (= int int) - - bool = (< string string) - bool = (> string string) - bool = (= string string) - Perform a comparision of 2 integers, or 2 string values. - - Function flow: - - type = (if bool function) - type = (if bool function function) - Choose a flow path based on a boolean value - - type = (begin func func func) - Execute a sequence. The last function return is the return type. -*/ - -#include -#include -#include -#include - -#include "filter-sexp.h" - -#define p(x) /* parse debug */ -#define r(x) /* run debug */ -#define d(x) /* general debug */ - - -static struct _FilterSEXPTerm * parse_list(FilterSEXP *f, int gotbrace); -static struct _FilterSEXPTerm * parse_value(FilterSEXP *f); - -static void parse_dump_term(struct _FilterSEXPTerm *t, int depth); - -static GtkObjectClass *parent_class; - - - -static GScannerConfig scanner_config = -{ - ( " \t\r\n") /* cset_skip_characters */, - ( G_CSET_a_2_z - "_+<=>" - G_CSET_A_2_Z) /* cset_identifier_first */, - ( G_CSET_a_2_z - "_0123456789-<>" - G_CSET_A_2_Z - G_CSET_LATINS - G_CSET_LATINC ) /* cset_identifier_nth */, - ( ";\n" ) /* cpair_comment_single */, - - FALSE /* case_sensitive */, - - TRUE /* skip_comment_multi */, - TRUE /* skip_comment_single */, - TRUE /* scan_comment_multi */, - TRUE /* scan_identifier */, - TRUE /* scan_identifier_1char */, - FALSE /* scan_identifier_NULL */, - TRUE /* scan_symbols */, - FALSE /* scan_binary */, - TRUE /* scan_octal */, - TRUE /* scan_float */, - TRUE /* scan_hex */, - FALSE /* scan_hex_dollar */, - TRUE /* scan_string_sq */, - TRUE /* scan_string_dq */, - TRUE /* numbers_2_int */, - FALSE /* int_2_float */, - FALSE /* identifier_2_string */, - TRUE /* char_2_token */, - FALSE /* symbol_2_token */, - FALSE /* scope_0_fallback */, -}; - -struct _FilterSEXPResult * -filter_sexp_result_new(int type) -{ - struct _FilterSEXPResult *r = g_malloc0(sizeof(*r)); - r->type = type; - return r; -} - -void -filter_sexp_result_free(struct _FilterSEXPResult *t) -{ - if (t == NULL) - return; - - switch(t->type) { - case FSEXP_RES_ARRAY_PTR: - g_ptr_array_free(t->value.ptrarray, TRUE); - break; - case FSEXP_RES_BOOL: - case FSEXP_RES_INT: - break; - case FSEXP_RES_STRING: - g_free(t->value.string); - break; - case FSEXP_RES_UNDEFINED: - break; - } - g_free(t); -} - -/* implementations for the builtin functions */ - -/* can you tell, i dont like glib? */ -/* we can only itereate a hashtable from a called function */ -struct _glib_sux_donkeys { - int count; - GPtrArray *uids; -}; - -/* ok, store any values that are in all sets */ -static void -g_lib_sux_htand(char *key, int value, struct _glib_sux_donkeys *fuckup) -{ - if (value == fuckup->count) { - g_ptr_array_add(fuckup->uids, key); - } -} - -/* or, store all unique values */ -static void -g_lib_sux_htor(char *key, int value, struct _glib_sux_donkeys *fuckup) -{ - g_ptr_array_add(fuckup->uids, key); -} - -static FilterSEXPResult * -term_eval_and(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - struct _FilterSEXPResult *r, *r1, *r2; - GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal); - struct _glib_sux_donkeys lambdafoo; - int type=-1; - int bool = TRUE; - int i; - - r(printf("( and\n")); - - r = filter_sexp_result_new(FSEXP_RES_UNDEFINED); - - for (i=0;bool && itype; - if (type != r1->type) { - printf("invalid types in and operation, all types must be the same\n"); - } else if ( r1->type == FSEXP_RES_ARRAY_PTR ) { - char **a1; - int l1, j; - - a1 = (char **)r1->value.ptrarray->pdata; - l1 = r1->value.ptrarray->len; - for (j=0;jtype == FSEXP_RES_BOOL ) { - bool &= r1->value.bool; - } - filter_sexp_result_free(r1); - } - - if (type == FSEXP_RES_ARRAY_PTR) { - lambdafoo.count = argc; - lambdafoo.uids = g_ptr_array_new(); - g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htand, &lambdafoo); - r->type = FSEXP_RES_ARRAY_PTR; - r->value.ptrarray = lambdafoo.uids; - } else if (type == FSEXP_RES_BOOL) { - r->type = FSEXP_RES_BOOL; - r->value.bool = bool; - } - - g_hash_table_destroy(ht); - - return r; -} - -static FilterSEXPResult * -term_eval_or(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - struct _FilterSEXPResult *r, *r1, *r2; - GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal); - struct _glib_sux_donkeys lambdafoo; - int type = -1; - int bool = FALSE; - int i; - - r(printf("(or \n")); - - r = filter_sexp_result_new(FSEXP_RES_UNDEFINED); - - for (i=0;!bool && itype; - if (r1->type != type) { - printf("wrong types in or operation\n"); - } else if (r1->type == FSEXP_RES_ARRAY_PTR) { - char **a1; - int l1, j; - - a1 = (char **)r1->value.ptrarray->pdata; - l1 = r1->value.ptrarray->len; - for (j=0;jtype == FSEXP_RES_BOOL) { - bool |= r1->value.bool; - } - filter_sexp_result_free(r1); - } - - if (type == FSEXP_RES_ARRAY_PTR) { - lambdafoo.count = argc; - lambdafoo.uids = g_ptr_array_new(); - g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htor, &lambdafoo); - r->type = FSEXP_RES_ARRAY_PTR; - r->value.ptrarray = lambdafoo.uids; - } else if (type == FSEXP_RES_BOOL) { - r->type = FSEXP_RES_BOOL; - r->value.bool = bool; - } - g_hash_table_destroy(ht); - - return r; -} - -static FilterSEXPResult * -term_eval_not(struct _FilterSEXP *f, int argc, struct _FilterSEXPResult **argv, void *data) -{ - int res = TRUE; - FilterSEXPResult *r; - - if (argc>0) { - if (argv[0]->type == FSEXP_RES_BOOL - && argv[0]->value.bool) - res = FALSE; - } - r = filter_sexp_result_new(FSEXP_RES_BOOL); - r->value.bool = res; - return r; -} - -/* this should support all arguments ...? */ -static FilterSEXPResult * -term_eval_lt(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - struct _FilterSEXPResult *r, *r1, *r2; - - r = filter_sexp_result_new(FSEXP_RES_UNDEFINED); - - if (argc == 2) { - r1 = filter_sexp_term_eval(f, argv[0]); - r2 = filter_sexp_term_eval(f, argv[1]); - if (r1->type != r2->type) { - printf("error, invalid types in compare\n"); - } else if (r1->type == FSEXP_RES_INT) { - r->type = FSEXP_RES_BOOL; - r->value.bool = r1->value.number < r2->value.number; - } else if (r1->type == FSEXP_RES_STRING) { - r->type = FSEXP_RES_BOOL; - r->value.bool = strcmp(r1->value.string, r2->value.string) < 0; - } - } - return r; -} - -/* this should support all arguments ...? */ -static FilterSEXPResult * -term_eval_gt(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - struct _FilterSEXPResult *r, *r1, *r2; - - r = filter_sexp_result_new(FSEXP_RES_UNDEFINED); - - if (argc == 2) { - r1 = filter_sexp_term_eval(f, argv[0]); - r2 = filter_sexp_term_eval(f, argv[1]); - if (r1->type != r2->type) { - printf("error, invalid types in compare\n"); - } else if (r1->type == FSEXP_RES_INT) { - r->type = FSEXP_RES_BOOL; - r->value.bool = r1->value.number > r2->value.number; - } else if (r1->type == FSEXP_RES_STRING) { - r->type = FSEXP_RES_BOOL; - r->value.bool = strcmp(r1->value.string, r2->value.string) > 0; - } - } - return r; -} - -/* this should support all arguments ...? */ -static FilterSEXPResult * -term_eval_eq(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - struct _FilterSEXPResult *r, *r1, *r2; - - r = filter_sexp_result_new(FSEXP_RES_BOOL); - - if (argc == 2) { - r1 = filter_sexp_term_eval(f, argv[0]); - r2 = filter_sexp_term_eval(f, argv[1]); - if (r1->type != r2->type) { - r->value.bool = FALSE; - } else if (r1->type == FSEXP_RES_INT) { - r->value.bool = r1->value.number == r2->value.number; - } else if (r1->type == FSEXP_RES_BOOL) { - r->value.bool = r1->value.bool == r2->value.bool; - } else if (r1->type == FSEXP_RES_STRING) { - r->value.bool = strcmp(r1->value.string, r2->value.string) == 0; - } - } - return r; -} - -static FilterSEXPResult * -term_eval_plus(struct _FilterSEXP *f, int argc, struct _FilterSEXPResult **argv, void *data) -{ - struct _FilterSEXPResult *r=NULL, *r1, *r2; - int type; - int i; - - if (argc>0) { - type = argv[0]->type; - switch(type) { - case FSEXP_RES_INT: { - int total = argv[0]->value.number; - for (i=1;itype == FSEXP_RES_INT;i++) { - total += argv[i]->value.number; - } - if (ivalue.number = total; - break; } - case FSEXP_RES_STRING: { - GString *s = g_string_new(argv[0]->value.string); - for (i=1;itype == FSEXP_RES_STRING;i++) { - g_string_append(s, argv[i]->value.string); - } - if (ivalue.string = s->str; - g_string_free(s, FALSE); - break; } - - } - } - - if (!r) { - r = filter_sexp_result_new(FSEXP_RES_INT); - r->value.number = 0; - } - return r; -} - -static FilterSEXPResult * -term_eval_sub(struct _FilterSEXP *f, int argc, struct _FilterSEXPResult **argv, void *data) -{ - struct _FilterSEXPResult *r=NULL, *r1, *r2; - int type; - int i; - - if (argc>0) { - type = argv[0]->type; - switch(type) { - case FSEXP_RES_INT: { - int total = argv[0]->value.number; - for (i=1;itype == FSEXP_RES_INT;i++) { - total -= argv[i]->value.number; - } - if (ivalue.number = total; - break; } - } - } - - if (!r) { - r = filter_sexp_result_new(FSEXP_RES_INT); - r->value.number = 0; - } - return r; -} - -/* implements 'if' function */ -static FilterSEXPResult * -term_eval_if(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - struct _FilterSEXPResult *r, *r1, *r2; - int doit; - - if (argc >=2 && argc<=3) { - r = filter_sexp_term_eval(f, argv[0]); - doit = (r->type == FSEXP_RES_BOOL && r->value.bool); - filter_sexp_result_free(r); - if (doit) { - return filter_sexp_term_eval(f, argv[1]); - } else if (argc>2) { - return filter_sexp_term_eval(f, argv[2]); - } - } - return filter_sexp_result_new(FSEXP_RES_UNDEFINED); -} - -/* implements 'begin' statement */ -static FilterSEXPResult * -term_eval_begin(struct _FilterSEXP *f, int argc, struct _FilterSEXPTerm **argv, void *data) -{ - struct _FilterSEXPResult *r=NULL, *r1, *r2; - int i; - - for (i=0;itype = FSEXP_RES_UNDEFINED; - - switch (t->type) { - case FSEXP_TERM_STRING: - r(printf(" (string \"%s\")\n", t->value.string)); - r->type = FSEXP_RES_STRING; - /* erk, this shoul;dn't need to strdup this ... */ - r->value.string = g_strdup(t->value.string); - break; - case FSEXP_TERM_INT: - r(printf(" (int %d)\n", t->value.number)); - r->type = FSEXP_RES_INT; - r->value.number = t->value.number; - break; - case FSEXP_TERM_BOOL: - r(printf(" (int %d)\n", t->value.number)); - r->type = FSEXP_RES_BOOL; - r->value.bool = t->value.bool; - break; - case FSEXP_TERM_IFUNC: { - if (t->value.func.sym->f.ifunc) { - r1 = t->value.func.sym->f.ifunc(f, t->value.func.termcount, t->value.func.terms, t->value.func.sym->data); - if (r1) { - filter_sexp_result_free(r); - r = r1; - } - } - break; } - case FSEXP_TERM_FUNC: { - struct _FilterSEXPResult **argv; - - /* first evaluate all arguments to result types */ - argv = alloca(sizeof(argv[0]) * t->value.func.termcount); - for (i=0;ivalue.func.termcount;i++) { - argv[i] = filter_sexp_term_eval(f, t->value.func.terms[i]); - } - /* call the function */ - if (t->value.func.sym->f.func) { - r1 = t->value.func.sym->f.func(f, t->value.func.termcount, argv, t->value.func.sym->data); - if (r1) { - filter_sexp_result_free(r); - r = r1; - } - } - for (i=0;ivalue.func.termcount;i++) { - filter_sexp_result_free(argv[i]); - } - break; } - default: - printf("Warning: Unknown type encountered in parse tree: %d\n", t->type); - r->type = FSEXP_RES_UNDEFINED; - } - - return r; -} - - -static void -eval_dump_result(FilterSEXPResult *r, int depth) -{ - int dumpvals = FALSE; - int i; - - if (r==NULL) { - printf("null result???\n"); - return; - } - - for (i=0;itype) { - case FSEXP_RES_ARRAY_PTR: - printf("array pointers\n"); - break; - case FSEXP_RES_INT: - printf("int: %d\n", r->value.number); - break; - case FSEXP_RES_STRING: - printf("string: '%s'\n", r->value.string); - break; - case FSEXP_RES_BOOL: - printf("bool: %c\n", r->value.bool?'t':'f'); - break; - case FSEXP_RES_UNDEFINED: - printf(" \n"); - break; - } - printf("\n"); -} - -static void -parse_dump_term(struct _FilterSEXPTerm *t, int depth) -{ - int dumpvals = FALSE; - int i; - - if (t==NULL) { - printf("null term??\n"); - return; - } - - for (i=0;itype) { - case FSEXP_TERM_STRING: - printf(" \"%s\"", t->value.string); - break; - case FSEXP_TERM_INT: - printf(" %d", t->value.number); - break; - case FSEXP_TERM_BOOL: - printf(" #%c", t->value.bool?'t':'f'); - break; - case FSEXP_TERM_IFUNC: - case FSEXP_TERM_FUNC: - printf(" (function %s\n", t->value.func.sym->name); - /*printf(" [%d] ", t->value.func.termcount);*/ - for (i=0;ivalue.func.termcount;i++) { - parse_dump_term(t->value.func.terms[i], depth+1); - } - for (i=0;ivalue.var->name); - break; - default: - printf("unknown type: %d\n", t->type); - } - - printf("\n"); -} - -/* - PARSER -*/ - -static struct _FilterSEXPTerm * -parse_new_term(int type) -{ - struct _FilterSEXPTerm *s = g_malloc0(sizeof(*s)); - s->type = type; - return s; -} - -static void -parse_term_free(struct _FilterSEXPTerm *t) -{ - int i; - - if (t==NULL) { - return; - } - - switch (t->type) { - case FSEXP_TERM_FUNC: - case FSEXP_TERM_IFUNC: - for (i=0;ivalue.func.termcount;i++) { - parse_term_free(t->value.func.terms[i]); - } - g_free(t->value.func.terms); - break; - case FSEXP_TERM_VAR: - break; - case FSEXP_TERM_STRING: - g_free(t->value.string); - break; - case FSEXP_TERM_INT: - break; - default: - printf("parse_term_free: unknown type: %d\n", t->type); - } - g_free(t); -} - -static struct _FilterSEXPTerm ** -parse_values(FilterSEXP *f, int *len) -{ - int token; - struct _FilterSEXPTerm **terms; - int i=0; - GScanner *gs = f->scanner; - - p(printf("parsing values\n")); - - /* FIXME: This hardcoded nonsense!!! :) */ - terms = g_malloc0(20*sizeof(*terms)); - - while ( (token = g_scanner_peek_next_token(gs)) != G_TOKEN_EOF - && token != ')') { - terms[i]=parse_value(f); - i++; - } - - p(printf("found %d subterms\n", i)); - *len = i; - - p(printf("dont parsing values\n")); - return terms; -} - -static struct _FilterSEXPTerm * -parse_value(FilterSEXP *f) -{ - int token; - struct _FilterSEXPTerm *t = NULL; - GScanner *gs = f->scanner; - struct _FilterSEXPSymbol *s; - - p(printf("parsing value\n")); - - token = g_scanner_get_next_token(gs); - switch(token) { - case G_TOKEN_LEFT_PAREN: - p(printf("got brace, its a list!\n")); - return parse_list(f, TRUE); - case G_TOKEN_STRING: - p(printf("got string\n")); - t = parse_new_term(FSEXP_TERM_STRING); - t->value.string = g_strdup(g_scanner_cur_value(gs).v_string); - break; - case G_TOKEN_INT: - t = parse_new_term(FSEXP_TERM_INT); - t->value.number = g_scanner_cur_value(gs).v_int; - p(printf("got int\n")); - break; - case '#': - printf("got bool?\n"); - token = g_scanner_get_next_token(gs); - t = parse_new_term(FSEXP_TERM_BOOL); - t->value.bool = token=='t'; - break; - case G_TOKEN_SYMBOL: - s = g_scanner_cur_value(gs).v_symbol; - switch (s->type) { - case FSEXP_TERM_FUNC: - case FSEXP_TERM_IFUNC: - /* this is basically invalid, since we can't use function - pointers, but let the runtime catch it ... */ - t = parse_new_term(s->type); - t->value.func.sym = s; - t->value.func.terms = parse_values(f, &t->value.func.termcount); - break; - case FSEXP_TERM_VAR: - t = parse_new_term(s->type); - t->value.var = s; - break; - default: - printf("Invalid symbol type: %d\n", s->type); - } - break; - case G_TOKEN_IDENTIFIER: - printf("Unknown identifier encountered: %s\n", g_scanner_cur_value(gs).v_identifier); - break; - default: - printf("Innvalid token trying to parse a list of values\n"); - } - p(printf("done parsing value\n")); - return t; -} - -/* FIXME: this needs some robustification */ -static struct _FilterSEXPTerm * -parse_list(FilterSEXP *f, int gotbrace) -{ - int token; - struct _FilterSEXPTerm *t = NULL; - GScanner *gs = f->scanner; - - p(printf("parsing list\n")); - if (gotbrace) - token = '('; - else - token = g_scanner_get_next_token(gs); - if (token =='(') { - token = g_scanner_get_next_token(gs); - switch(token) { - case G_TOKEN_SYMBOL: { - struct _FilterSEXPSymbol *s; - - s = g_scanner_cur_value(gs).v_symbol; - p(printf("got funciton: %s\n", s->name)); - t = parse_new_term(s->type); - p(printf("created new list %p\n", t)); - /* if we have a variable, find out its base type */ - while (s->type == FSEXP_TERM_VAR) { - s = ((FilterSEXPTerm *)(s->data))->value.var; - } - if (s->type == FSEXP_TERM_FUNC - || s->type == FSEXP_TERM_IFUNC) { - t->value.func.sym = s; - t->value.func.terms = parse_values(f, &t->value.func.termcount); - } else { - printf("Error, trying to call variable as function\n"); - } - break; } - case G_TOKEN_IDENTIFIER: - printf("Unknown identifier: %s\n", g_scanner_cur_value(gs).v_identifier); - break; - default: - printf("unknown sequence encountered, type = %d\n", token); - } - token = g_scanner_get_next_token(gs); - if (token != ')') { - printf("Error, expected ')' not found\n"); - } - } else { - printf("Error, list term without opening (\n"); - } - - p(printf("returning list %p\n", t)); - return t; -} - -#if 0 -GList * -camel_mbox_folder_search_by_expression(CamelFolder *folder, char *expression, CamelException *ex) -{ - GScanner *gs; - int i; - struct _FilterSEXPTerm *t; - struct _searchcontext *ctx; - struct _FilterSEXPResult *r; - GList *matches = NULL; - - gs = g_scanner_new(&scanner_config); - for(i=0;ifolder = folder; - ctx->summary = camel_folder_get_summary(folder, ex); - ctx->message_info = camel_folder_summary_get_message_info_list(ctx->summary); -#ifdef HAVE_IBEX - ctx->index = ibex_open(CAMEL_MBOX_FOLDER(folder)->index_file_path, FALSE); - if (!ctx->index) { - perror("Cannot open index file, body searches will be ignored\n"); - } -#endif - r = term_eval(ctx, t); - - /* now create a folder summary to return?? */ - if (r - && r->type == FSEXP_RES_ARRAY_PTR) { - d(printf("got result ...\n")); - for (i=0;ivalue.ptrarray->len;i++) { - d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i))); - matches = g_list_prepend(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i))); - } - filter_sexp_result_free(r); - } - - if (ctx->index) - ibex_close(ctx->index); - - gtk_object_unref((GtkObject *)ctx->summary); - g_free(ctx); - parse_term_free(t); - } else { - printf("Warning, Could not parse expression!\n %s\n", expression); - } - - g_scanner_destroy(gs); - - return matches; -} -#endif - - -static void -filter_sexp_class_init (FilterSEXPClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - parent_class = gtk_type_class (gtk_object_get_type ()); -} - -/* 'builtin' functions */ -static struct { - char *name; - FilterSEXPFunc *func; - int type; /* set to 1 if a function can perform shortcut evaluation, or - doesn't execute everything, 0 otherwise */ -} symbols[] = { - { "and", (FilterSEXPFunc *)term_eval_and, 1 }, - { "or", (FilterSEXPFunc *)term_eval_or, 1 }, - { "not", (FilterSEXPFunc *)term_eval_not, 0 }, - { "<", (FilterSEXPFunc *)term_eval_lt, 1 }, - { ">", (FilterSEXPFunc *)term_eval_gt, 1 }, - { "=", (FilterSEXPFunc *)term_eval_eq, 1 }, - { "+", (FilterSEXPFunc *)term_eval_plus, 0 }, - { "-", (FilterSEXPFunc *)term_eval_sub, 0 }, - { "if", (FilterSEXPFunc *)term_eval_if, 1 }, - { "begin", (FilterSEXPFunc *)term_eval_begin, 1 }, -}; - -static void -filter_sexp_init (FilterSEXP *s) -{ - int i; - - s->scanner = g_scanner_new(&scanner_config); - - /* load in builtin symbols? */ - for(i=0;iname = g_strdup(name); - s->f.func = func; - s->type = FSEXP_TERM_FUNC; - s->data = data; - g_scanner_scope_add_symbol(f->scanner, scope, s->name, s); -} - -void -filter_sexp_add_ifunction(FilterSEXP *f, int scope, char *name, FilterSEXPIFunc *ifunc, void *data) -{ - struct _FilterSEXPSymbol *s; - - g_return_if_fail(FILTER_IS_SEXP(f)); - g_return_if_fail(name != NULL); - - s = g_malloc0(sizeof(*s)); - s->name = g_strdup(name); - s->f.ifunc = ifunc; - s->type = FSEXP_TERM_IFUNC; - s->data = data; - g_scanner_scope_add_symbol(f->scanner, scope, s->name, s); -} - -void -filter_sexp_add_variable(FilterSEXP *f, int scope, char *name, FilterSEXPTerm *value) -{ - struct _FilterSEXPSymbol *s; - - g_return_if_fail(FILTER_IS_SEXP(f)); - g_return_if_fail(name != NULL); - - s = g_malloc0(sizeof(*s)); - s->name = g_strdup(name); - s->type = FSEXP_TERM_VAR; - s->data = value; - g_scanner_scope_add_symbol(f->scanner, scope, s->name, s); -} - -void -filter_sexp_remove_symbol(FilterSEXP *f, int scope, char *name) -{ - int oldscope; - struct _FilterSEXPSymbol *s; - - g_return_if_fail(FILTER_IS_SEXP(f)); - g_return_if_fail(name != NULL); - - oldscope = g_scanner_set_scope(f->scanner, scope); - s = g_scanner_lookup_symbol(f->scanner, name); - g_scanner_scope_remove_symbol(f->scanner, scope, name); - g_scanner_set_scope(f->scanner, oldscope); - if (s) { - g_free(s->name); - g_free(s); - } -} - -int -filter_sexp_set_scope(FilterSEXP *f, int scope) -{ - g_return_val_if_fail(FILTER_IS_SEXP(f), 0); - - return g_scanner_set_scope(f->scanner, scope); -} - -void -filter_sexp_input_text(FilterSEXP *f, char *text, int len) -{ - g_return_if_fail(FILTER_IS_SEXP(f)); - g_return_if_fail(text != NULL); - - g_scanner_input_text(f->scanner, text, len); -} - -void -filter_sexp_input_file (FilterSEXP *f, int fd) -{ - g_return_if_fail(FILTER_IS_SEXP(f)); - - g_scanner_input_file(f->scanner, fd); -} - -/* needs some error return? */ -void -filter_sexp_parse(FilterSEXP *f) -{ - g_return_if_fail(FILTER_IS_SEXP(f)); - - f->tree = parse_list(f, FALSE); - - if (f->tree) - parse_dump_term(f->tree, 0); -} - -struct _FilterSEXPResult * -filter_sexp_eval(FilterSEXP *f) -{ - g_return_val_if_fail(FILTER_IS_SEXP(f), NULL); - g_return_val_if_fail(f->tree != NULL, NULL); - - return filter_sexp_term_eval(f, f->tree); -} - -#ifdef TESTER -int main(int argc, char **argv) -{ - FilterSEXP *f; - char *t = "(+ \"foo\" \"\\\"\" \"bar\" \"\\\\ blah \\x \")"; - FilterSEXPResult *r; - - gtk_init(&argc, &argv); - - f = filter_sexp_new(); - - filter_sexp_add_variable(f, 0, "test", NULL); - - filter_sexp_input_text(f, t, strlen(t)); - filter_sexp_parse(f); - - if (f->tree) { - parse_dump_term(f->tree, 0); - } - - r = filter_sexp_eval(f); - if (r) { - eval_dump_result(r, 0); - } else { - printf("no result?|\n"); - } - - return 0; -} -#endif diff --git a/filter/filter-sexp.h b/filter/filter-sexp.h deleted file mode 100644 index 362b7261f9..0000000000 --- a/filter/filter-sexp.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - generic s-exp evaluator class -*/ -#ifndef _FILTER_SEXP_H -#define _FILTER_SEXP_H - -#include -#include -#include -#include - -#define FILTER_SEXP(obj) GTK_CHECK_CAST (obj, filter_sexp_get_type (), FilterSEXP) -#define FILTER_SEXP_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_sexp_get_type (), FilterSEXPClass) -#define FILTER_IS_SEXP(obj) GTK_CHECK_TYPE (obj, filter_sexp_get_type ()) - -typedef struct _FilterSEXP FilterSEXP; -typedef struct _FilterSEXPClass FilterSEXPClass; - -typedef struct _FilterSEXPSymbol FilterSEXPSymbol; -typedef struct _FilterSEXPResult FilterSEXPResult; -typedef struct _FilterSEXPTerm FilterSEXPTerm; - -typedef struct _FilterSEXPResult *(FilterSEXPFunc)(struct _FilterSEXP *sexp, - int argc, - struct _FilterSEXPResult **argv, - void *data); - -typedef struct _FilterSEXPResult *(FilterSEXPIFunc)(struct _FilterSEXP *sexp, - int argc, - struct _FilterSEXPTerm **argv, - void *data); -enum _FilterSEXPResultType { - FSEXP_RES_ARRAY_PTR=0, /* type is a ptrarray, what it points to is implementation dependant */ - FSEXP_RES_INT, /* type is a number */ - FSEXP_RES_STRING, /* type is a pointer to a single string */ - FSEXP_RES_BOOL, /* boolean type */ - FSEXP_RES_UNDEFINED /* unknown type */ -}; - -struct _FilterSEXPResult { - enum _FilterSEXPResultType type; - union { - GPtrArray *ptrarray; - int number; - char *string; - int bool; - } value; -}; - -enum _FilterSEXPTermType { - FSEXP_TERM_INT = 0, /* integer literal */ - FSEXP_TERM_BOOL, /* boolean literal */ - FSEXP_TERM_STRING, /* string literal */ - FSEXP_TERM_FUNC, /* normal function, arguments are evaluated before calling */ - FSEXP_TERM_IFUNC, /* immediate function, raw terms are arguments */ - FSEXP_TERM_VAR, /* variable reference */ -}; - -struct _FilterSEXPSymbol { - int type; /* FSEXP_TERM_FUNC or FSEXP_TERM_VAR */ - char *name; - void *data; - union { - FilterSEXPFunc *func; - FilterSEXPIFunc *ifunc; - } f; -}; - -struct _FilterSEXPTerm { - enum _FilterSEXPTermType type; - union { - char *string; - int number; - int bool; - struct { - struct _FilterSEXPSymbol *sym; - struct _FilterSEXPTerm **terms; - int termcount; - } func; - struct _FilterSEXPSymbol *var; - } value; -}; - - - -struct _FilterSEXP { - GtkObject object; - - GScanner *scanner; /* for parsing text version */ - FilterSEXPTerm *tree; /* root of expression tree */ -}; - -struct _FilterSEXPClass { - GtkObjectClass parent_class; - -}; - -guint filter_sexp_get_type (void); -FilterSEXP *filter_sexp_new (void); -void filter_sexp_add_function (FilterSEXP *f, int scope, char *name, FilterSEXPFunc *func, void *data); -void filter_sexp_add_ifunction (FilterSEXP *f, int scope, char *name, FilterSEXPIFunc *func, void *data); -void filter_sexp_add_variable (FilterSEXP *f, int scope, char *name, FilterSEXPTerm *value); -void filter_sexp_remove_symbol (FilterSEXP *f, int scope, char *name); -int filter_sexp_set_scope (FilterSEXP *f, int scope); - -void filter_sexp_input_text (FilterSEXP *f, char *text, int len); -void filter_sexp_input_file (FilterSEXP *f, int fd); - - -void filter_sexp_parse (FilterSEXP *f); -FilterSEXPResult *filter_sexp_eval (FilterSEXP *f); - -FilterSEXPResult *filter_sexp_term_eval (struct _FilterSEXP *f, struct _FilterSEXPTerm *t); -FilterSEXPResult *filter_sexp_result_new (int type); -void filter_sexp_result_free (struct _FilterSEXPResult *t); - -#endif /* _FILTER_SEXP_H */ diff --git a/filter/filter-xml.c b/filter/filter-xml.c deleted file mode 100644 index 7615350acf..0000000000 --- a/filter/filter-xml.c +++ /dev/null @@ -1,553 +0,0 @@ -/* -*- Mode: C; c-file-style: "linux"; indent-tabs-mode: t; c-basic-offset: 8; -*- */ - -/* Load save filter descriptions/options from an xml file */ - -#include -#include -#include -#include - -#include -#include - -#include "filter-arg-types.h" -#include "filter-xml.h" - -struct token_tab { - char *name; - enum filter_xml_token token; -}; - -struct token_tab token_table[] = { - { "action", FILTER_XML_ACTION }, - { "address", FILTER_XML_ADDRESS }, - { "code", FILTER_XML_CODE }, - { "description", FILTER_XML_DESC }, - { "except", FILTER_XML_EXCEPT }, - { "folder", FILTER_XML_FOLDER }, - { "match", FILTER_XML_MATCH }, - { "name", FILTER_XML_NAME }, - { "option", FILTER_XML_OPTION }, - { "optionrule", FILTER_XML_OPTIONRULE }, - { "optionset", FILTER_XML_OPTIONSET }, - { "optionvalue", FILTER_XML_OPTIONVALUE }, - { "receive", FILTER_XML_RECEIVE }, - { "rule", FILTER_XML_RULE }, - { "ruleset", FILTER_XML_RULESET }, - { "send", FILTER_XML_SEND }, - { "source", FILTER_XML_SOURCE }, - { "text", FILTER_XML_TEXT }, -}; - -/* convert a name to a token value */ -static int -tokenise(const char *name) -{ - int i; - int len = sizeof(token_table)/sizeof(token_table[0]); - - if (name) { - for (i=0;i=0) { - for (i=0;i"; -} - - -static xmlNodePtr -find_node(xmlNodePtr start, char *name) -{ - printf("trying to find node '%s'\n", name); - while (start && strcmp(start->name, name)) - start = start->next; - printf("node = %p\n", start); - return start; -} - -static xmlNodePtr -find_node_attr(xmlNodePtr start, char *name, char *attrname, char *attrvalue) -{ - xmlNodePtr node; - char *s; - - printf("looking for node named %s with attribute %s=%s\n", name, attrname, attrvalue); - - while ( start && (start = find_node(start, name)) ) { - s = xmlGetProp(start, attrname); - printf(" comparing '%s' to '%s'\n", s, attrvalue); - if (s && !strcmp(s, attrvalue)) - break; - start = start->next; - } - return start; -} - -static GList * -load_desc(xmlNodePtr node, int type, int vartype, char *varname) -{ - struct filter_desc *desc; - xmlNodePtr n; - int newtype; - int newvartype; - char *newvarname; - GList *list = NULL; - - while (node) { - if (node->content) { - desc = g_malloc0(sizeof(*desc)); - desc->data = node->content; - desc->type = type; - desc->vartype = vartype; - desc->varname = varname?g_strdup(varname):0; - printf(" **** node name = %s var name = %s var type = %s\n", node->name, varname, detokenise(vartype)); - list = g_list_append(list, desc); - printf("appending '%s'\n", node->content); - newtype = type; - newvartype = -1; - newvarname = NULL; - } else { - newtype = tokenise(node->name); - newvartype = tokenise(xmlGetProp(node, "type")); - newvarname = xmlGetProp(node, "name"); - } - n = node->childs; - while (n) { - printf("adding child '%s'\n", n->name); - list = g_list_concat(list, load_desc(n, newtype, newvartype, newvarname)); - n = n->next; - } - node = node->next; - } - return list; -} - -GList * -filter_load_ruleset(xmlDocPtr doc) -{ - xmlNodePtr ruleset, rule, n; - struct filter_rule *r; - int type; - int ruletype; - GList *rules = NULL; - - g_return_val_if_fail(doc!=NULL, NULL); - - ruleset = find_node(doc->root->childs, "ruleset"); - - while (ruleset) { - - rule = ruleset->childs; - - ruletype = tokenise(xmlGetProp(ruleset, "type")); - - printf("ruleset, name = %s\n", ruleset->name); - - while (rule) { - - n = rule->childs; - r = g_malloc0(sizeof(*r)); - r->type = ruletype; - r->name = xmlGetProp(rule, "name"); - - printf(" rule, name = %s\n", r->name); - - while (n) { - type = tokenise(n->name); - printf(" n, name = %s\n", n->name); - printf(" ncontent = %s\n", n->content); - printf(" childs = %p\n", n->childs); - if (n->childs) { - printf(" childs content = %s\n", n->childs->content); - } - switch(type) { - case FILTER_XML_CODE: - r->code = xmlNodeGetContent(n); - break; - case FILTER_XML_DESC: - printf(" ** loading description\n"); - r->description = load_desc(n->childs, type, -1, NULL); - printf(" ** done loading description\n"); - break; - default: - printf("warning, unknown token encountered\n"); - break; - } - n = n->next; - } - if (r) - rules = g_list_append(rules, r); - rule = rule->next; - } - ruleset = find_node(ruleset->next, "ruleset"); - } - return rules; -} - -int -filter_find_rule(struct filter_rule *a, char *name) -{ - printf("finding, is %s = %s?\n", a->name, name); - return strcmp(a->name, name); -} - -int -filter_find_arg(FilterArg *a, char *name) -{ - printf("finding, is %s = %s?\n", a->name, name); - return strcmp(a->name, name); -} - -static FilterArg * -load_optionvalue(struct filter_desc *desc, xmlNodePtr node) -{ - xmlNodePtr n; - int token; - int lasttoken = -2; - FilterArg *arg = NULL; - char *name; - - printf("creating arg entry for '%s'\n", desc->varname); - - switch(desc->vartype) { - case FILTER_XML_ADDRESS: - arg = filter_arg_address_new(name); - break; - case FILTER_XML_FOLDER: - arg = filter_arg_folder_new(name); - break; - default: - printf("ok, maybe we're not\n"); - /* unknown arg type, drop it */ - return NULL; - } - - if (node == NULL) - return arg; - - filter_arg_values_add_xml(arg, node); - - return arg; -} - -/* loads a blank (empty args) optionrule from a rule */ -static struct filter_optionrule * -optionrule_new(struct filter_rule *rule) -{ - GList *ldesc; - struct filter_desc *desc; - struct filter_optionrule *optionrule; - - optionrule = g_malloc0(sizeof(*optionrule)); - optionrule->rule = rule; - - ldesc = rule->description; - while (ldesc) { - desc = ldesc->data; - if (desc->varname && desc->vartype!=-1) { - FilterArg *arg; - arg = load_optionvalue(desc, NULL); - if (arg) - optionrule->args = g_list_append(optionrule->args, arg); - } - ldesc = g_list_next(ldesc); - } - return optionrule; -} - -GList * -filter_load_optionset(xmlDocPtr doc, GList *rules) -{ - xmlNodePtr optionset, option, o, or; - struct filter_option *op; - struct filter_optionrule *optionrule; - struct filter_rule *fr; - struct filter_desc *desc; - int type, token; - GList *l = NULL; - GList *lrule; - GList *ldesc; - - g_return_val_if_fail(doc!=NULL, NULL); - - optionset = find_node(doc->root->childs, "optionset"); - if (optionset == NULL) { - printf("optionset not found\n"); - return; - } - option = find_node(optionset->childs, "option"); - while (option) { - o = option->childs; - op = g_malloc0(sizeof(*op)); - printf("option = %s\n", o->name); - printf("option, type=%s\n", xmlGetProp(option, "type")); - op->type = tokenise(xmlGetProp(option, "type")); - while (o) { - type = tokenise(o->name); - switch (type) { - case FILTER_XML_OPTIONRULE: - lrule = g_list_find_custom(rules, xmlGetProp(o, "rule"), (GCompareFunc) filter_find_rule); - if (lrule) { - fr = lrule->data; - printf("found rule : %s\n", fr->name); - optionrule = g_malloc0(sizeof(*optionrule)); - optionrule->rule = fr; - op->options = g_list_append(op->options, optionrule); - - /* scan through all variables required, setup blank variables if they do not exist */ - ldesc = fr->description; - while (ldesc) { - desc = ldesc->data; - if (desc->varname && desc->vartype!=-1) { - FilterArg *arg; - /* try and see if there is a setting for this value */ - or = find_node_attr(o->childs, "optionvalue", "name", desc->varname); - arg = load_optionvalue(desc, or); - if (arg) - optionrule->args = g_list_append(optionrule->args, arg); - } - ldesc = g_list_next(ldesc); - } - } else { - printf("Cannot find rule: %s\n", xmlGetProp(o, "rule")); - } - break; - case FILTER_XML_DESC: - printf("loading option descriptiong\n"); - op->description = load_desc(option->childs, type, -1, NULL); - break; - } - o = o->next; - } - l = g_list_append(l, op); - option = find_node(option->next, "option"); - } - return l; -} - -xmlNodePtr -filter_write_optionset(xmlDocPtr doc, GList *optionl) -{ - xmlNodePtr root, cur, option, optionrule, optionvalue; - GList *optionrulel, *argl; - struct filter_optionrule *or; - - root = xmlNewDocNode(doc, NULL, "optionset", NULL); - - /* for all options */ - while (optionl) { - struct filter_option *op = optionl->data; - - option = xmlNewDocNode(doc, NULL, "option", NULL); - xmlSetProp(option, "type", detokenise(op->type)); - - optionrulel = op->options; - while (optionrulel) { - or = optionrulel->data; - - optionrule = xmlNewDocNode(doc, NULL, "optionrule", NULL); - xmlSetProp(optionrule, "type", detokenise(or->rule->type)); - xmlSetProp(optionrule, "rule", or->rule->name); - - argl = or->args; - while (argl) { - FilterArg *arg = argl->data; - - optionvalue = filter_arg_values_get_xml(arg); - if (optionvalue) - xmlAddChild(optionrule, optionvalue); - - argl = g_list_next(argl); - } - - xmlAddChild(option, optionrule); - - optionrulel = g_list_next(optionrulel); - } - - xmlAddChild(root, option); - optionl = g_list_next(optionl); - } - - return root; -} - -/* utility functions */ -struct filter_optionrule * -filter_clone_optionrule(struct filter_optionrule *or) -{ - GList *arg; - struct filter_optionrule *rule; - - rule = g_malloc0(sizeof(*rule)); - - rule->rule = or->rule; - arg = or->args; - while (arg) { - FilterArg *new = filter_arg_clone(FILTER_ARG(arg->data)); - gtk_object_set_data(new, "origin", arg->data); - rule->args = g_list_append(rule->args, new); - arg = g_list_next(arg); - } - return rule; -} - -void -filter_clone_optionrule_free(struct filter_optionrule *or) -{ - GList *argl; - struct filter_optionrule *rule; - - argl = or->args; - while (argl) { - gtk_object_unref(GTK_OBJECT(argl->data)); - argl = g_list_next(argl); - } - g_list_free(or->args); - g_free(or); -} - -struct filter_optionrule * -filter_optionrule_new_from_rule(struct filter_rule *rule) -{ - struct filter_optionrule *or; - GList *descl; - - or = g_malloc0(sizeof(*or)); - - or->rule = rule; - - descl = rule->description; - while (descl) { - struct filter_desc *desc = descl->data; - if (desc->varname && desc->vartype != -1) { - FilterArg *arg = NULL; - switch (desc->vartype) { - case FILTER_XML_ADDRESS: - arg = filter_arg_address_new(desc->varname); - break; - case FILTER_XML_FOLDER: - arg = filter_arg_folder_new(desc->varname); - break; - } - if (arg) { - or->args = g_list_append(or->args, arg); - } - } - descl = g_list_next(descl); - } - return or; -} - -void -filter_description_free(GList *descl) -{ - GList *node; - - node = descl; - while (node) { - GList *next = g_list_next(node); - struct filter_desc *d = node->data; - - g_free(d->data); - g_free(d->varname); - g_free(d); - - node = next; - } - g_list_free(descl); -} - -void -filter_load_ruleset_free(GList *nodel) -{ - GList *node = nodel; - - while (node) { - GList *next = g_list_next(node); - struct filter_rule *r = node->data; - - filter_description_free(r->description); - - /* g_free(r->name); */ - /* g_free(r->code); */ - - g_free(r); - node = next; - } - g_list_free(nodel); -} - -void -filter_load_optionset_free(GList *optionl) -{ - GList *option = optionl; - while (option) { - GList *next = g_list_next(option); - struct filter_option *fo = option->data; - GList *optionrule = fo->options; - - while (optionrule) { - GList *next = g_list_next(optionrule); - struct filter_optionrule *or = optionrule->data; - GList *arg = or->args; - - while (arg) { - gtk_object_unref(arg->data); - arg = g_list_next(arg); - } - - g_list_free(or->args); - g_free(or); - optionrule = next; - } - filter_description_free(fo->description); - g_list_free(fo->options); - g_free(fo); - option = next; - } -} - -#ifdef TESTER -int main(int argc, char **argv) -{ - GList *rules, *options; - xmlDocPtr doc, out, optionset, filteroptions; - - gnome_init("Test", "0.0", argc, argv); - - doc = xmlParseFile("filterdescription.xml"); - - rules = load_ruleset(doc); - options = load_optionset(doc, rules); - - out = xmlParseFile("saveoptions.xml"); - options = load_optionset(doc, rules); -#if 0 - out = xmlNewDoc("1.0"); - optionset = save_optionset(out, options); - filteroptions = xmlNewDocNode(out, NULL, "filteroptions", NULL); - xmlAddChild(filteroptions, optionset); - xmlDocSetRootElement(out, filteroptions); - xmlSaveFile("saveoptions.xml", out); -#endif - return 0; -} -#endif - diff --git a/filter/filter-xml.h b/filter/filter-xml.h deleted file mode 100644 index a2e0cfada0..0000000000 --- a/filter/filter-xml.h +++ /dev/null @@ -1,69 +0,0 @@ - -#ifndef _FILTER_XML_H -#define _FILTER_XML_H - -#include -#include - -#include "filter-arg.h" - -enum filter_xml_token { - FILTER_XML_TEXT=0, - FILTER_XML_RULE, - FILTER_XML_CODE, - FILTER_XML_DESC, - FILTER_XML_RULESET, - FILTER_XML_OPTION, - FILTER_XML_OPTIONRULE, - FILTER_XML_OPTIONSET, - FILTER_XML_OPTIONVALUE, - FILTER_XML_SOURCE, - FILTER_XML_SEND, - FILTER_XML_RECEIVE, - FILTER_XML_ADDRESS, - FILTER_XML_FOLDER, - FILTER_XML_NAME, - FILTER_XML_MATCH, - FILTER_XML_ACTION, - FILTER_XML_EXCEPT -}; - -struct filter_desc { - int type; - char *data; - char *varname; /* for named types */ - int vartype; -}; - -struct filter_rule { - int type; - char *name; - char *code; - GList *description; -}; - -struct filter_optionrule { - struct filter_rule *rule; - GList *args; /* FilterArg objects */ -}; - -struct filter_option { - int type; /* 'send' 'receive'? */ - GList *description; /* filter_desc */ - GList *options; /* option_rule */ -}; - -GList *filter_load_ruleset(xmlDocPtr doc); -GList *filter_load_optionset(xmlDocPtr doc, GList *rules); -xmlNodePtr filter_write_optionset(xmlDocPtr doc, GList *optionl); - -/* callbacks for searching GLists of various types */ -int filter_find_rule(struct filter_rule *a, char *name); -int filter_find_arg(FilterArg *a, char *name); - -/* utility functions */ -struct filter_optionrule *filter_clone_optionrule(struct filter_optionrule *or); -void filter_clone_optionrule_free(struct filter_optionrule *or); -struct filter_optionrule *filter_optionrule_new_from_rule(struct filter_rule *rule); - -#endif /* ! _FILTER_XML_H */ diff --git a/help/.cvsignore b/help/.cvsignore deleted file mode 100644 index 550bd25cdb..0000000000 --- a/help/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile - 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 7b7cf6f821..0000000000 --- a/help/Design +++ /dev/null @@ -1,201 +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 and a number of auxiliary - CORBA servers that act as the storage backends. - - Evolution will copy the best user interface bits and the best - ideas and features found on contemporary groupware systems. - -* Evolution internals. - - Evolution can store its information locally (files for mail, - calendar and address book) or on a remote server (imap/pop, - cap, ldap). - - Given the importance of syncing in this modern PDA world, - the Evolution GUI acts as a client to the data repository. - The data repository is a GUI-less CORBA server called Wombat. - - Wombat provides a unified access system to the calendar and - addressbook data (doing mail is a bit hard, so we are leaving - this as a TODO item for now). - - Wombat's CORBA interfaces are notifier-based. This means that - CORBA requests sent to Wombat do not return values - inmediately, but rather than for Wombat requests the user has - to provide a CORBA object that will be notified of what - happened. - - Yes, that sounds hairy. It is actually pretty simple. It - basically means that you submit requests to Wombat, and a - callback is invoked in your code when the request has been - carried away. - - This enables a Palm to sync to the repository without having - the GUI for Evolution running. It also means that volunteers - will be able to write text-based and web-based versions of - Evolution (not me though :-). - -* Evolution as a platform - - Evolution is more than a client for managing the above - information: Evolution is a platform for building groupware - applications that use the above components to get their work done. - - To achieve this Evolution is designed to be scriptable, and it - exports its internals trough CORBA/Bonobo. It is implemented - as a collection of Bonobo containers and Bonobo components. - - There is a clean separation between the views (the user - interface) and the model (the view). The views that we are - writing are GNOME based, and they talk to the Wombat CORBA - server. - - Wombat takes care of notifications to the various clients for - the data. - -* 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). - -** Folders - - Michael Zucchi is working on a system that will let users - easily define rules for splitting their incoming mail into - physical folders. - - A further refinement to Folders are Virtual Folders. This - basically provides a powerful search and viewing facility for - mail. It works like this: when a mail is "incorporated" into - Evolution it is scanned and indexed. - - Then users can enter queries into Evolution that will search - the entire database of messages. - -** 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. - - Ettore has been working on adding editing support to the - GtkHTML and he is working currently on a Bonobo component that - will provide a ready-to-use Bonobo control for embedding into - other applications. - diff --git a/libibex/.cvsignore b/libibex/.cvsignore deleted file mode 100644 index 9a14585748..0000000000 --- a/libibex/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la -lookup -mkindex diff --git a/libibex/COPYING.LIB b/libibex/COPYING.LIB deleted file mode 100644 index eb685a5ec9..0000000000 --- a/libibex/COPYING.LIB +++ /dev/null @@ -1,481 +0,0 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, 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 library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, 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 companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, 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 library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete 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 distribute a copy of this License along with the -Library. - - 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 Library or any portion -of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -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 Library, 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 Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you 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. - - If distribution of 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 satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. 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. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library 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. - - 9. 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 Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -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. - - 11. 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 Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library 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 Library. - -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. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library 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. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library 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 Library -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 Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -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 - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "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 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. 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 LIBRARY 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 -LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. 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. - - - Copyright (C) - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/libibex/ChangeLog b/libibex/ChangeLog deleted file mode 100644 index ba785db21a..0000000000 --- a/libibex/ChangeLog +++ /dev/null @@ -1,46 +0,0 @@ -2000-02-25 Dan Winship - - * *.c: add gtk-doc-style comments - -2000-02-21 Matt Loper - - * .cvsignore: Added mkindex. - -2000-02-21 NotZed - - * Makefile.am: change noinst_LIBRARIES to noinst_LTLIBRARIES, and - supply -static to LDFLAGS. Duh, and changed LDADD back to - libibex.la. - -2000-02-20 Matt Loper - - * Makefile.am: changed mkindex_LDADD to libibex.a instead of - libibex.la. - -2000-02-19 Matt Loper - - * .cvsignore: added lookup. - -2000-02-18 Miguel de Icaza - - * Makefile.am (lookup_LDADD): For now. make a libibex.a library so - we can link it with the camel provider. I hate libtool - -2000-02-16 Dan Winship - - * Makefile.am: automakify - -2000-02-16 NotZed - - * find.[ch] (ibex_find_name): Finds if a word is indexed under a - given name. - -2000-02-14 NotZed - - * Makefile: Hack together a build using libtool. This should all - be auto*'d at some point I guess. - -2000-02-13 NotZed - - * Added ChangeLog file. - diff --git a/libibex/Makefile.am b/libibex/Makefile.am deleted file mode 100644 index a8949d1c40..0000000000 --- a/libibex/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -## Process this file with automake to produce Makefile.in - -noinst_LTLIBRARIES = libibex.la - -libibex_la_SOURCES = file.c index.c find.c words.c ibex.h -libibex_la_LDFLAGS = -static - -noinst_HEADERS = ibex_internal.h - -INCLUDES = -I$(srcdir) $(GLIB_CFLAGS) $(UNICODE_CFLAGS) - - -noinst_PROGRAMS = mkindex lookup - -mkindex_SOURCES = mkindex.c -mkindex_LDADD = libibex.la $(GLIB_LIBS) $(UNICODE_LIBS) - -lookup_SOURCES = lookup.c -lookup_LDADD = libibex.la $(GLIB_LIBS) $(UNICODE_LIBS) - diff --git a/libibex/TODO b/libibex/TODO deleted file mode 100644 index a087c8d1f3..0000000000 --- a/libibex/TODO +++ /dev/null @@ -1,61 +0,0 @@ -Stability ---------- -* ibex_open should never crash, and should never return NULL without -errno being set. Should check for errors when reading. - - -Performance ------------ -* Profiling, keep thinking about data structures, etc. - -* Check memory usage - -* See if writing the "inverse image" of long ref streams helps -compression without hurting performance now. (ie, if a word appears in -more than half of the files, write out the list of files it _doesn't_ -appear in). (I tried this before, and it wasn't working well, but the -file format and data structures have changed a lot.) - -* We could save a noticeable chunk of time if normalize_word computed -the hash of the word and then we could pass that into -g_hash_table_insert somehow. - -* Make a copy of the buffer to be indexed (or provide interface for -caller to say ibex can munge the provided data) and then use that -rather than constantly copying things. ? - - -Functionality -------------- -* ibex file locking - -* specify file mode in ibex_open - -* ibex_find* need to normalize the search words... should this be done -by the caller or by ibex_find? - -* Needs to be some way to do a secondary search after getting results -back from ibex_find* (ie, for "foo near bar"). This either has to be -done by ibex, or requires us to export the normalize interface. - -* Does there need to be an ibex_find_any, or is that easy enough for the -caller to do? - -* utf8_trans needs to cover at least two more code pages. This is -tricky because it's not clear whether some of the letters there should -be translated to ASCII or left as UTF8. This requires some -investigation. - -* ibex_index_* need to ignore HTML tags. - NAME = [A-Za-z][A-Za-z0-9.-]* - - - - ugh. ok, simplifying, we get: - <[^!](([^"'>]*("[^"]*"|'[^']*'))*> or - - - which is still not simple. sigh. - -* ibex_index_* need to recognize and ignore "non-text". Particularly -BinHex and uuencoding. diff --git a/libibex/file.c b/libibex/file.c deleted file mode 100644 index 0cf637764e..0000000000 --- a/libibex/file.c +++ /dev/null @@ -1,412 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code, Inc. - * - * This program 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 the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* file.c: index file read/write ops */ - -#include -#include -#include -#include -#include -#include - -#include "ibex_internal.h" - -static unsigned long read_number (FILE *f); -static void write_number (FILE *f, unsigned long n); -static char *get_compressed_word (FILE *f, char **lastword); - -static gint free_file (gpointer key, gpointer value, gpointer data); -static void free_word (gpointer key, gpointer value, gpointer data); - -/* The file format is: - * - * version string (currently "ibex1") - * file count - * list of compressed filenames, separated by \0 - * word count - * list of compressed words, each followed by \0, a count, and that - * many references. - * - * All numbers are stored 7-bit big-endian, with the high bit telling - * whether or not the number continues to the next byte. - * - * compressed text consists of a byte telling how many characters the - * line has in common with the line before it, followed by the rest of - * the string. Obviously this only really works if the lists are sorted. - */ - -/** - * ibex_open: open (or possibly create) an ibex index - * @file: the name of the file - * @create: whether or not to create the file if it doesn't exist. - * - * Open and/or create the named ibex file and return a handle to it. - * - * Return value: an ibex handle, or NULL if an error occurred. - **/ -ibex * -ibex_open (char *file, gboolean create) -{ - ibex *ib; - FILE *f; - char vbuf[sizeof (IBEX_VERSION) - 1]; - char *word, *lastword; - unsigned long nfiles, nwords, nrefs, ref; - ibex_file **ibfs = NULL; - int i; - GPtrArray *refs; - - f = fopen (file, "r"); - if (!f && (errno != ENOENT || !create)) { - if (errno == 0) - errno = ENOMEM; - return NULL; - } - - ib = g_malloc (sizeof (ibex)); - ib->dirty = FALSE; - ib->path = g_strdup (file); - ib->files = g_tree_new (strcmp); - ib->words = g_hash_table_new (g_str_hash, g_str_equal); - ib->oldfiles = g_ptr_array_new (); - - if (!f) - return ib; - - /* Check version. */ - if (fread (vbuf, 1, sizeof (vbuf), f) != sizeof (vbuf)) { - if (feof (f)) - errno = EINVAL; - goto errout; - } - if (strncmp (vbuf, IBEX_VERSION, sizeof (vbuf) != 0)) { - errno = EINVAL; - goto errout; - } - - /* Read list of files. */ - nfiles = read_number (f); - ibfs = g_malloc (nfiles * sizeof (ibex_file *)); - lastword = NULL; - for (i = 0; i < nfiles; i++) { - ibfs[i] = g_malloc (sizeof (ibex_file)); - ibfs[i]->name = get_compressed_word (f, &lastword); - if (!ibfs[i]->name) - goto errout; - ibfs[i]->index = 0; - g_tree_insert (ib->files, ibfs[i]->name, ibfs[i]); - } - - /* Read list of words. */ - nwords = read_number (f); - lastword = NULL; - for (i = 0; i < nwords; i++) { - word = get_compressed_word (f, &lastword); - if (!word) - goto errout; - - nrefs = read_number (f); - refs = g_ptr_array_new (); - g_ptr_array_set_size (refs, nrefs); - while (nrefs--) { - ref = read_number (f); - if (ref >= nfiles) - goto errout; - refs->pdata[nrefs] = ibfs[ref]; - } - - g_hash_table_insert (ib->words, word, refs); - } - - g_free (ibfs); - fclose (f); - return ib; - -errout: - fclose (f); - g_tree_traverse (ib->files, free_file, G_IN_ORDER, NULL); - g_tree_destroy (ib->files); - g_hash_table_foreach (ib->words, free_word, NULL); - g_hash_table_destroy (ib->words); - g_ptr_array_free (ib->oldfiles, TRUE); - if (ibfs) - g_free (ibfs); - g_free (ib->path); - g_free (ib); - - return NULL; -} - -struct ibex_write_data { - unsigned long index; - FILE *f; - char *lastname; -}; - -/* This is an internal function to find the longest common initial - * prefix between the last-written word and the current word. - */ -static int -get_prefix (struct ibex_write_data *iwd, char *name) -{ - int i = 0; - if (iwd->lastname) { - while (!strncmp (iwd->lastname, name, i + 1)) - i++; - } - iwd->lastname = name; - return i; -} - -static gint -write_file (gpointer key, gpointer value, gpointer data) -{ - char *file = key; - ibex_file *ibf = value; - struct ibex_write_data *iwd = data; - int prefix; - - ibf->index = iwd->index++; - prefix = get_prefix (iwd, file); - fprintf (iwd->f, "%c%s", prefix, file + prefix); - fputc (0, iwd->f); - return FALSE; -} - -static void -store_word (gpointer key, gpointer value, gpointer data) -{ - GTree *wtree = data; - - g_tree_insert (wtree, key, value); -} - -static gint -write_word (gpointer key, gpointer value, gpointer data) -{ - char *word = key; - GPtrArray *refs = value; - struct ibex_write_data *iwd = data; - ibex_file *ibf; - int i, ind, prefix; - - for (i = ind = 0; i < refs->len; i++) { - ibf = g_ptr_array_index (refs, i); - if (ibf->index == -1) { - g_ptr_array_remove_index_fast (refs, i); - i--; - } else - ind++; - } - - if (ind != 0) { - prefix = get_prefix (iwd, word); - fprintf (iwd->f, "%c%s", prefix, word + prefix); - fputc (0, iwd->f); - - write_number (iwd->f, ind); - - for (i = 0; i < refs->len; i++) { - ibf = g_ptr_array_index (refs, i); - write_number (iwd->f, ibf->index); - } - } - return FALSE; -} - -/** - * ibex_write: Write an ibex out to disk. - * @ib: the ibex - * - * This writes an ibex to disk. - * - * Return value: 0 for success, -1 for failure (in which case errno - * is set). - **/ -int -ibex_write (ibex *ib) -{ - struct ibex_write_data iwd; - GTree *wtree; - char *tmpfile; - - tmpfile = g_strdup_printf ("%s~", ib->path); - iwd.f = fopen (tmpfile, "w"); - if (!iwd.f) { - if (errno == 0) - errno = ENOMEM; - g_free (tmpfile); - return -1; - } - - fputs (IBEX_VERSION, iwd.f); - if (ferror (iwd.f)) - goto lose; - - iwd.index = 0; - iwd.lastname = NULL; - write_number (iwd.f, g_tree_nnodes (ib->files)); - if (ferror (iwd.f)) - goto lose; - g_tree_traverse (ib->files, write_file, G_IN_ORDER, &iwd); - if (ferror (iwd.f)) - goto lose; - - iwd.lastname = NULL; - write_number (iwd.f, g_hash_table_size (ib->words)); - if (ferror (iwd.f)) - goto lose; - wtree = g_tree_new (strcmp); - g_hash_table_foreach (ib->words, store_word, wtree); - g_tree_traverse (wtree, write_word, G_IN_ORDER, &iwd); - g_tree_destroy (wtree); - if (ferror (iwd.f)) - goto lose; - - if (fclose (iwd.f) == 0 && rename (tmpfile, ib->path) == 0) { - g_free (tmpfile); - ib->dirty = FALSE; - return 0; - } - -lose: - unlink (tmpfile); - g_free (tmpfile); - return -1; -} - -/** - * ibex_close: Write out the ibex file (if it has changed) and free - * the data associated with it. - * @ib: the ibex - * - * If this ibex file has been modified since it was opened, this will - * call ibex_write() to write it out to disk. It will then free all data - * associated with the ibex. After calling ibex_close(), @ib will no - * longer be a valid ibex. - * - * Return value: 0 on success, -1 on an ibex_write() failure (in which - * case @ib will not be destroyed). - **/ -int -ibex_close (ibex *ib) -{ - ibex_file *ibf; - - if (ib->dirty && ibex_write (ib) == -1) - return -1; - - g_tree_traverse (ib->files, free_file, G_IN_ORDER, NULL); - g_tree_destroy (ib->files); - g_hash_table_foreach (ib->words, free_word, NULL); - g_hash_table_destroy (ib->words); - - while (ib->oldfiles->len) { - ibf = g_ptr_array_remove_index (ib->oldfiles, 0); - g_free (ibf->name); - g_free (ibf); - } - g_ptr_array_free (ib->oldfiles, TRUE); - g_free (ib->path); - g_free (ib); - - return 0; -} - -static gint -free_file (gpointer key, gpointer value, gpointer data) -{ - ibex_file *ibf = value; - - g_free (ibf->name); - g_free (ibf); - return FALSE; -} - -static void -free_word (gpointer key, gpointer value, gpointer data) -{ - g_free (key); - g_ptr_array_free (value, TRUE); -} - -static char * -get_compressed_word (FILE *f, char **lastword) -{ - char *buf, *p; - int c, size; - - c = getc (f); - if (c == EOF) - return NULL; - - size = c + 10; - buf = g_malloc (size); - if (*lastword) - strncpy (buf, *lastword, c); - p = buf + c; - do { - c = getc (f); - if (c == EOF) - return NULL; - if (p == buf + size) { - buf = g_realloc (buf, size + 10); - p = buf + size; - size += 10; - } - *p++ = c; - } while (c != 0); - - *lastword = buf; - return buf; -} - -static void -write_number (FILE *f, unsigned long number) -{ - int i, flag = 0; - char buf[4]; - - i = 4; - do { - buf[--i] = (number & 0x7F) | flag; - number = number >> 7; - flag = 0x80; - } while (number != 0); - - fwrite (buf + i, 1, 4 - i, f); -} - -static unsigned long -read_number (FILE *f) -{ - int byte; - unsigned long num; - - num = 0; - do { - byte = getc (f); - num = num << 7 | (byte & 0x7F); - } while (byte & 0x80); - - return num; -} - diff --git a/libibex/find.c b/libibex/find.c deleted file mode 100644 index 91e611401c..0000000000 --- a/libibex/find.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code, Inc. - * - * This program 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 the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* find.c: index file searching ops */ - -#include - -#include "ibex_internal.h" - -/** - * ibex_find: search an ibex for a word - * @ib: an ibex - * @word: the word - * - * This routine searches an ibex for a word and returns a GPtrArray - * containing the names of the files in the ibex that contain the word. - * If no matches are found, it will return an empty array (not NULL). - * The caller must free the array, but MUST NOT free or alter its - * elements. - * - * Return value: the array of filenames containing @word - **/ -GPtrArray * -ibex_find (ibex *ib, char *word) -{ - GPtrArray *refs, *ret; - ibex_file *ibf; - int i; - - ret = g_ptr_array_new (); - refs = g_hash_table_lookup (ib->words, word); - if (refs) { - for (i = 0; i < refs->len; i++) { - ibf = g_ptr_array_index (refs, i); - g_ptr_array_add (ret, ibf->name); - } - } - return ret; -} - -/** - * ibex_find_name: Check if a word occurs in a given file - * @ib: an ibex - * @name: a filename - * @word: a word - * - * This checks if the given word occurs in the given file. - * - * Return value: TRUE or FALSE - **/ -gboolean -ibex_find_name (ibex *ib, char *name, char *word) -{ - GPtrArray *refs; - ibex_file *ibf; - int i; - - refs = g_hash_table_lookup (ib->words, word); - if (refs) { - for (i = 0; i < refs->len; i++) { - ibf = g_ptr_array_index (refs, i); - if (!strcmp (ibf->name, name)) - return TRUE; - } - } - return FALSE; -} - -static gint -build_array (gpointer key, gpointer value, gpointer data) -{ - char *name = key; - unsigned int count = GPOINTER_TO_UINT (value); - GPtrArray *ret = data; - - if (count == 1) - g_ptr_array_add (ret, name); - return FALSE; -} - -/** - * ibex_find_all: Find files containing multiple words - * @ib: an ibex - * @words: a GPtrArray of words - * - * This works like ibex_find(), but returns an array of filenames - * which contain all of the words in @words. - * - * Return value: an array of matches - **/ -GPtrArray * -ibex_find_all (ibex *ib, GPtrArray *words) -{ - GTree *work; - GPtrArray *wrefs, *ret; - int i, j, count; - char *word; - ibex_file *ibf; - - if (words->len == 0) - return g_ptr_array_new (); - else if (words->len == 1) - return ibex_find (ib, g_ptr_array_index (words, 0)); - - work = g_tree_new (strcmp); - for (i = 0; i < words->len; i++) { - word = g_ptr_array_index (words, i); - wrefs = g_hash_table_lookup (ib->words, word); - if (!wrefs) { - /* One of the words isn't even in the index. */ - g_tree_destroy (work); - return g_ptr_array_new (); - } - - if (i == 0) { - /* Copy the references into a tree, using the - * filenames as keys and the size of words as - * the value. - */ - for (j = 0; j < wrefs->len; j++) { - ibf = g_ptr_array_index (wrefs, j); - g_tree_insert (work, ibf->name, - GUINT_TO_POINTER (words->len)); - } - } else { - /* Increment the counts in the working tree - * for the references for this word. - */ - for (j = 0; j < wrefs->len; j++) { - ibf = g_ptr_array_index (wrefs, j); - count = GPOINTER_TO_UINT (g_tree_lookup (work, ibf->name)); - if (count) { - g_tree_insert (work, ibf->name, - GUINT_TO_POINTER (count - 1)); - } - } - } - } - - /* Build an array with the refs that contain all the words. */ - ret = g_ptr_array_new (); - g_tree_traverse (work, build_array, G_IN_ORDER, ret); - g_tree_destroy (work); - return ret; -} diff --git a/libibex/ibex.h b/libibex/ibex.h deleted file mode 100644 index b74db1ed93..0000000000 --- a/libibex/ibex.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code, Inc. - * - * This program 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 the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef IBEX_H -#define IBEX_H - -#include -#include - -struct ibex; -typedef struct ibex ibex; - -/* All functions that can fail set errno and return NULL or -1 on - * failure. - */ - -/* Open the named ibex index file. If CREATE is true, create the file - * if it doesn't already exist. - */ -ibex *ibex_open (char *file, gboolean create); - -/* Write the ibex to disk. */ -int ibex_write (ibex *ib); - -/* Write the ibex to disk if it has changed, and free all memory - * associated with it. - */ -int ibex_close (ibex *ib); - - - -/* Index the named file. (If the FILENAME is already in the index, - * remove the old copy. - */ -int ibex_index_file (ibex *ib, char *filename); - -/* Index LEN bytes off FD, using NAME as the filename in the index. - * (If NAME already exists in the index, this adds more data to it.) - */ -int ibex_index_fd (ibex *ib, char *name, int fd, size_t len); - -/* Like ibex_index_fd, but with a buffer rather than a file descriptor. - * The buffer does not need to be '\0'-terminated. If UNREAD is not - * NULL, then the indexer won't assume that the buffer ends on a word - * boundary, and will return (in UNREAD) the number of bytes from the - * end of the buffer that it didn't use, if any. - */ -int ibex_index_buffer (ibex *ib, char *name, char *buffer, - size_t len, size_t *unread); - -/* Remove entries for a given file from the index. (Most of the removal - * isn't actually done until the file is written out to disk, so this - * is very fast.) - */ -void ibex_unindex (ibex *ib, char *name); - -/* Rename a file in the index. (This is also fast.) */ -void ibex_rename (ibex *ib, char *oldfilename, char *newfilename); - - - -/* Find a word in the index. Returns an array of strings: the caller - * should free the array, but should not free or modify the strings. - */ -GPtrArray *ibex_find (ibex *ib, char *word); - -/* Find if a word is contained in a specific name reference. - */ -gboolean ibex_find_name (ibex *ib, char *name, char *word); - -/* Return all the files containing all of the words in the given - * array. Returned data is like with ibex_find. - */ -GPtrArray *ibex_find_all (ibex *ib, GPtrArray *words); - -#endif /* ! IBEX_H */ - diff --git a/libibex/ibex_internal.h b/libibex/ibex_internal.h deleted file mode 100644 index 1647147a3a..0000000000 --- a/libibex/ibex_internal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code, Inc. - * - * This program 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 the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include "ibex.h" - -#define IBEX_VERSION "ibex1" - -struct ibex { - char *path; - GTree *files; - GHashTable *words; - GPtrArray *oldfiles; - gboolean dirty; -}; - -struct ibex_file { - char *name; - long index; -}; -typedef struct ibex_file ibex_file; diff --git a/libibex/index.c b/libibex/index.c deleted file mode 100644 index 5e3e9cf588..0000000000 --- a/libibex/index.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code, Inc. - * - * This program 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 the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* index.c: high-level indexing ops */ - -#include -#include -#include -#include -#include - -#include "ibex_internal.h" - -/** - * ibex_index_file: Index a file by name - * @ib: an ibex - * @filename: name of the file to index - * - * This indexes the given file into @ib. If @filename is already in - * the ibex, the existing index entries for it are discarded and the - * file is indexed anew. - * - * Return value: 0 on success, -1 on failure. - **/ -int -ibex_index_file (ibex *ib, char *filename) -{ - int fd; - int status; - struct stat st; - - fd = open (filename, O_RDONLY); - if (fd < 0) - return -1; - - if (fstat (fd, &st) == -1) { - close (fd); - return -1; - } - if (!S_ISREG (st.st_mode)) { - close (fd); - errno = EINVAL; - return -1; - } - - ibex_unindex (ib, filename); - status = ibex_index_fd (ib, filename, fd, st.st_size); - close (fd); - return status; -} - -/** - * ibex_index_fd: Index a file given a file descriptor - * @ib: an ibex - * @name: the name of the file being indexed - * @fd: a file descriptor, open for reading - * @len: the number of bytes to read from the file - * - * This indexes a file, or a part of a file, given an open file - * descriptor and a size. There is no requirement that @name - * actually correspond to @fd in any particular way. - * - * If the function returns successfully, the file descriptor offset of - * @fd will be exactly @len bytes beyond where it was when the - * function was called. The indexer assumes that this point is a word - * boundary. - * - * The behavior of this function is not defined if it is not - * possible to read @len bytes off @fd. - * - * Return value: 0 on success, -1 on failure. - **/ -int -ibex_index_fd (ibex *ib, char *name, int fd, size_t len) -{ - char *buf; - int off = 0, nread, status; - - buf = g_malloc (len); - do { - nread = read (fd, buf + off, len - off); - if (nread == -1) { - g_free (buf); - return -1; - } - off += nread; - } while (off != len); - - status = ibex_index_buffer (ib, name, buf, len, NULL); - g_free (buf); - - return status; -} - -/** - * ibex_unindex: Remove a file from the ibex - * @ib: an ibex - * @name: name of the file to remove - * - * This removes all references to @name from @ib. No memory is freed - * right away, but further searches on @ib will never return @name. - **/ -void -ibex_unindex (ibex *ib, char *name) -{ - ibex_file *ibf; - - ibf = g_tree_lookup (ib->files, name); - if (ibf) { - ibf->index = -1; - g_tree_remove (ib->files, name); - g_ptr_array_add (ib->oldfiles, ibf); - } -} - -/** - * ibex_rename: Rename a file in the ibex - * @ib: an ibex - * @oldname: the old name of the file - * @newname: the new name of the file - * - * This renames a file in the ibex. - **/ -void -ibex_rename (ibex *ib, char *oldname, char *newname) -{ - ibex_file *ibf; - - ibf = g_tree_lookup (ib->files, oldname); - if (ibf) { - g_tree_remove (ib->files, oldname); - g_free (ibf->name); - ibf->name = g_strdup (newname); - g_tree_insert (ib->files, ibf->name, ibf); - } -} diff --git a/libibex/lookup.c b/libibex/lookup.c deleted file mode 100644 index aa09fc6557..0000000000 --- a/libibex/lookup.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 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 - */ - -/* lookup.c: a simple client, part 2 */ - -#include -#include -#include -#include - -#include "ibex.h" - -extern int optind; -extern char *optarg; - -static void -usage (void) -{ - fprintf (stderr, "Usage: lookup [-f indexfile] word ...\n"); - exit (1); -} - -int -main (int argc, char **argv) -{ - ibex *ib; - GPtrArray *ans, *words; - int opt, i; - char *file = "INDEX"; - - while ((opt = getopt (argc, argv, "f:")) != -1) { - switch (opt) { - case 'f': - file = optarg; - break; - - default: - usage (); - break; - } - } - argc -= optind; - argv += optind; - - if (argc == 0) - usage (); - - ib = ibex_open (file, FALSE); - if (!ib) { - printf ("Couldn't open %s: %s\n", file, strerror (errno)); - exit (1); - } - - words = g_ptr_array_new (); - while (argc--) - g_ptr_array_add (words, argv[argc]); - - ans = ibex_find_all (ib, words); - if (ans) { - for (i = 0; i < ans->len; i++) - printf ("%s\n", (char *)g_ptr_array_index (ans, i)); - exit (0); - } else { - printf ("Nope.\n"); - exit (1); - } -} diff --git a/libibex/mkindex.c b/libibex/mkindex.c deleted file mode 100644 index 9d6841e90b..0000000000 --- a/libibex/mkindex.c +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 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 - */ - -/* mkindex.c: a simple client, part 1 */ - -#include -#include -#include -#include - -#include "ibex.h" - -extern int optind; -extern char *optarg; - -static void -usage (void) -{ - fprintf (stderr, "Usage: mkindex [-f indexfile] file ...\n"); - exit (1); -} - -int -main (int argc, char **argv) -{ - ibex *ib; - int opt; - char *file = "INDEX"; - - while ((opt = getopt (argc, argv, "f:")) != -1) { - switch (opt) { - case 'f': - file = optarg; - break; - - default: - usage (); - break; - } - } - argc -= optind; - argv += optind; - - if (argc == 0) - usage (); - - ib = ibex_open (file, TRUE); - if (!ib) { - fprintf (stderr, "Couldn't open index file %s: %s\n", - file, strerror (errno)); - exit (1); - } - - while (argc--) { - if (ibex_index_file (ib, argv[argc]) == -1) { - fprintf (stderr, "Couldn't index %s: %s\n", - argv[argc], strerror (errno)); - exit (1); - } - } - - if (ibex_close (ib) != 0) { - fprintf (stderr, "Failed to write index file %s: %s\n", - file, strerror (errno)); - exit (1); - } - exit (0); -} diff --git a/libibex/words.c b/libibex/words.c deleted file mode 100644 index 40e0452403..0000000000 --- a/libibex/words.c +++ /dev/null @@ -1,268 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2000 Helix Code, Inc. - * - * This program 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 the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* words.c: low-level indexing ops */ - -#include -#include -#include - -#include - -#include "ibex_internal.h" - -static signed char utf8_trans[] = { - 'A', 'A', 'A', 'A', 'A', 'A', -1, 'C', 'E', 'E', 'E', 'E', 'I', 'I', - 'I', 'I', -2, 'N', 'O', 'O', 'O', 'O', 'O', '*', 'O', 'U', 'U', 'U', - 'U', 'Y', -3, -4, 'a', 'a', 'a', 'a', 'a', 'a', -5, 'c', 'e', 'e', - 'e', 'e', 'i', 'i', 'i', 'i', -6, 'n', 'o', 'o', 'o', 'o', 'o', '/', - 'o', 'u', 'u', 'u', 'u', 'y', -7, 'y', 'A', 'a', 'A', 'a', 'A', 'a', - 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', - 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', - 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', - 'I', 'i', -8, -9, 'J', 'j', 'K', 'k', 'k', 'L', 'l', 'L', 'l', 'L', - 'l', 'L', 'l', 'L', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', -10, -11, - 'O', 'o', 'O', 'o', 'O', 'o', -12, -13, 'R', 'r', 'R', 'r', 'R', 'r', - 'S', 'r', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', - 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', - 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's' -}; - -static char *utf8_long_trans[] = { - "AE", "TH", "TH", "ss", "ae", "th", "th", "IJ", "ij", - "NG", "ng", "OE", "oe" -}; - -/* This is a bit weird. It takes pointers to the start and end (actually - * just past the end) of a UTF-8-encoded word, and a buffer at least 1 - * byte longer than the length of the word. It copies the word into the - * buffer in all lowercase without accents, and splits up ligatures. - * (Since any ligature would be a multi-byte character in UTF-8, splitting - * them into two US-ASCII characters won't overrun the buffer.) - * - * It is not safe to call this routine with bad UTF-8. - */ -static void -normalize_word (char *start, char *end, char *buf) -{ - unsigned char *s, *d; - unicode_char_t uc; - - s = (unsigned char *)start; - d = (unsigned char *)buf; - while (s < (unsigned char *)end) { - if (*s < 0x80) { - /* US-ASCII character: copy unless it's - * an apostrophe. - */ - if (*s != '\'') - *d++ = tolower (*s); - s++; - } else { - char *next = unicode_get_utf8 (s, &uc); - if (uc >= 0xc0 && uc < 0xc0 + sizeof (utf8_trans)) { - signed char ch = utf8_trans[uc - 0xc0]; - if (ch > 0) - *d++ = tolower (ch); - else { - *d++ = tolower (utf8_long_trans[-ch - 1][0]); - *d++ = tolower (utf8_long_trans[-ch - 1][1]); - } - s = next; - } else { - while (s < (unsigned char *)next) - *d++ = *s++; - } - } - } - *d = '\0'; -} - -enum { IBEX_ALPHA, IBEX_NONALPHA, IBEX_INVALID, IBEX_INCOMPLETE }; - -/* This incorporates parts of libunicode, because there's no way to - * force libunicode to not read past a certain point. - */ -static int -utf8_category (char *sp, char **snp, char *send) -{ - unsigned char *p = (unsigned char *)sp, **np = (unsigned char **)snp; - unsigned char *end = (unsigned char *)send; - - if (isascii (*p)) { - *np = p + 1; - if (isalpha (*p) || *p == '\'') - return IBEX_ALPHA; - return IBEX_NONALPHA; - } else { - unicode_char_t uc; - int more; - - if ((*p & 0xe0) == 0xc0) { - more = 1; - uc = *p & 0x1f; - } else if ((*p & 0xf0) == 0xe0) { - more = 2; - uc = *p & 0x0f; - } else if ((*p & 0xf8) == 0xf0) { - more = 3; - uc = *p & 0x07; - } else if ((*p & 0xfc) == 0xf8) { - more = 4; - uc = *p & 0x03; - } else if ((*p & 0xfe) == 0xfc) { - more = 5; - uc = *p & 0x01; - } else - return IBEX_INVALID; - - if (p + more > end) - return IBEX_INCOMPLETE; - - while (more--) { - if ((*++p & 0xc0) != 0x80) - return IBEX_INVALID; - uc <<= 6; - uc |= *p & 0x3f; - } - - *np = p + 1; - if (unicode_isalpha (uc)) - return IBEX_ALPHA; - else - return IBEX_NONALPHA; - } -} - -static ibex_file * -get_ibex_file (ibex *ib, char *name) -{ - ibex_file *ibf; - - ibf = g_tree_lookup (ib->files, name); - if (!ibf) { - ibf = g_malloc (sizeof (ibex_file)); - ibf->name = strdup (name); - ibf->index = 0; - g_tree_insert (ib->files, ibf->name, ibf); - ib->dirty = TRUE; - } - return ibf; -} - -static void -ref_word (ibex *ib, ibex_file *ibf, char *word) -{ - GPtrArray *refs; - - refs = g_hash_table_lookup (ib->words, word); - if (!refs) { - refs = g_ptr_array_new (); - g_hash_table_insert (ib->words, g_strdup (word), refs); - g_ptr_array_add (refs, ibf); - ib->dirty = TRUE; - } else if (g_ptr_array_index (refs, refs->len - 1) != ibf) { - g_ptr_array_add (refs, ibf); - ib->dirty = TRUE; - } -} - -/** - * ibex_index_buffer: the lowest-level ibex indexing interface - * @ib: an ibex - * @name: the name of the file being indexed - * @buffer: a buffer containing data from the file - * @len: the length of @buffer - * @unread: an output argument containing the number of unread bytes - * - * This routine indexes up to @len bytes from @buffer into @ib. - * If @unread is NULL, the indexer assumes that the buffer ends on a - * word boundary, and will index all the way to the end of the - * buffer. If @unread is not NULL, and the buffer ends with an - * alphabetic character, the indexer will assume that the buffer has - * been cut off in the middle of a word, and return the number of - * un-indexed bytes at the end of the buffer in *@unread. The caller - * should then read in more data through whatever means it has - * and pass in the unread bytes from the original buffer, followed - * by the new data, on its next call. - * - * Return value: 0 on success, -1 on failure. - **/ -int -ibex_index_buffer (ibex *ib, char *name, char *buffer, - size_t len, size_t *unread) -{ - char *p, *q, *nq, *end, *word; - ibex_file *ibf = get_ibex_file (ib, name); - int wordsiz, cat; - - end = buffer + len; - wordsiz = 20; - word = g_malloc (wordsiz); - - p = buffer; - while (p < end) { - while (p < end) { - cat = utf8_category (p, &q, end); - if (cat != IBEX_NONALPHA) - break; - p = q; - } - if (p == end) { - g_free (word); - return 0; - } else if (cat == IBEX_INVALID) { - errno = EINVAL; - g_free (word); - return -1; - } else if (cat == IBEX_INCOMPLETE) - q = end; - - while (q < end) { - cat = utf8_category (q, &nq, end); - if (cat != IBEX_ALPHA) - break; - q = nq; - } - if (cat == IBEX_INVALID || - (cat == IBEX_INCOMPLETE && !unread)) { - errno = EINVAL; - g_free (word); - return -1; - } else if (cat == IBEX_INCOMPLETE || (q == end && unread)) { - *unread = end - p; - g_free (word); - return 0; - } - - if (wordsiz < q - p + 1) { - wordsiz = q - p + 1; - word = g_realloc (word, wordsiz); - } - normalize_word (p, q, word); - ref_word (ib, ibf, word); - p = q; - } - - if (unread) - *unread = 0; - g_free (word); - return 0; -} diff --git a/libical/.cvsignore b/libical/.cvsignore deleted file mode 100644 index dfdde624c1..0000000000 --- a/libical/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -config.log -Makefile -configure -config.status -Makefile.in \ No newline at end of file diff --git a/libical/CHANGES b/libical/CHANGES deleted file mode 100644 index c4e550cb9e..0000000000 --- a/libical/CHANGES +++ /dev/null @@ -1,230 +0,0 @@ -Version 0.15a 17 Feb 00 ---------------------- - -Fixed icalvalue_set_text to convert escaped characters into the proper -values. - -Other minor code tweaks. - - -Version 0.15 7 Feb 00 ---------------------- - -Split the storage classess ( icalstore, icalcluster, icalcalendar ) -into a seperate library, libicalss - -Implemented restriction checking in file icalrestrictions.c. The -checking is not complete, but can handle the bulk of the restrictions -described in RFC 2446. - -Created a new value type, METHOD. Changed METHOD property to use the -new value. The METHOD value uses an enumeration. - - -Version 0.14b -------------- - -Implemented parsing of RECUR values, although it does not handle BYDAY -specs with numbers. - -Fixed error in icalparser_next_line that mangled lines longer than the -temp buffer (1024 chars.) The temp buffer is now 80 chars, and it can -handle (apparently) arbitrary length lines - -Fixed severe brokenness in a value, but I forgot which one. - -Cleaned cruft out of the distribution, so the tarfile is smaller. - - -Version 0.14a 14 Jan 00 ------------------------ - -Fixed bug in ROLE parameter -- missing '-' in the text of allowed values - -Fixed bug in X-parameters - -Version 0.14 11 Jan 00 ----------------------- - -Fixed wrong value type for TRIGGER property - -Added Calendar object. Calendar is an aggregate of two stores and two -clusters, and can store all of the inforamation associated with a -calendar. - -icalcomponent_add_property and icalcomponent_add_component will -complain if you try to add a component or property that is already -part of an other component. The *_free routines wil complain if you try -to free a linked component or property. - -More improvements to error handling. - -Parser is much more robust. - -Minor memory enhancements. - -Regression test runs without memory leaks. - -Version 0.13d 21Dec99 ---------------------- - -Seperated perl interface and library - -Added autoconf support - -Scripts that generate derived properties, values and parameters now -change source and header files inline. - -Changed icalstore to cluster all components with DTSTART in a month -into a single file. This should reduce number of file accesses by a -factor of 60. - -Ran code through Purify and fixed memory leaks. - - -Version 0.13 16Nov99 ---------------------- - -Yet more bug fixes! Yeah! - -Added better error handling. The Parser inserts X-LIC-*ERROR -properties to warn of parsing errors. - -The imip source/sink programs in /src/imip is demonstrably functional. - -Version 0.12b 17Oct99 ---------------------- - -More bug fixes, particularily in parse from string routines - -ICal::Store is mostly functional - -This is version is a checkpoint, not a release. - -Version 0.12a 10Oct99 ---------------------- - -Expanded perl interface: - Added 1/2 of Store module - Fixed bugs - Implemeted get_{first,next}_property - -Extended C interface - Made get_{first,next}_property work properly - Fixed bugs - - -This is version is a checkpoint, not a release. - -Version 0.12 27Aug99 --------------------- - -Added a rudimentatry perl interface - -This is version is a checkpoint, not a release. - - -Version 0.11 11Aug99 --------------------- - -Eliminated most use of flex/bison -- all parsing, except for the -values, is done in C. - -Cleaned up memory leaks. Purify claims that I got them all. - -Moved all derived component/prop/param/value code ( in .inc / .h -files) into main files ( icalcomponent.{c,h}, icalproperty.{c,h}, etc/ -) - -Implemented *_clone routines. - -Fixed a lot of bugs. - -Implemented more value types. Still unimplemeneted are BINARY and RECUR - -Included MacOS/Code Warior files from Graham Davison - - -Version 0.10 8Jul99 -------------------- - -Eliminated shift/reduce and reduce/reduce conflicts in the parser. -This version is almost feature complete -- it has the basic structure -for all of the library's functionality, and it will only require -implementing procedure shells and fixing bugs. I think that all of the -hard work is done... - -Version 0.09a,b 3,7 Jul99 -------------------------- - -Various improvements to the parser, added some functionality. The parser code -is mostly complete, and should be fully functional, except for a horde of -bugs. Also added support for X-Properties. - -Version 0.09 25Jun99 --------------------- - -Added a parser in files src/comp/icalitip.{y,l} The lexer is mostly -functional, but the parser is not. - - -Version 0.08 2Jun99 --------------------- - -All files now have MPL licensing - -Implement enough of the code to perform some rudimentary testing - - -Version 0.07 14May99 --------------------- - -Remove all interfaces that construct object from a string - -Moved most code back into comp directory - -Implemented C files for most headers -- usecases.c now links. - -Many improvements to generation scripts. - - - -Version 0.06 25Apr99 --------------------- - -Expanded distribution to include: - Directory structure that can accomodate future expansion - Several levels of Makefiles - This CHANGES file - -Added headers for irip and parse modules - -Added several files with design information - -Added scripts that I had used to generate much of the ical header code. - -Split C headers from CC headers - -Added data for iTIP and iCAL component restrictions in restrictions.csv - -Version 0.05 11Apr99 ----------------------- - -Changes to ical headers - - Added derived Property classes. - - Improved the interface to the derived property and parameter classes - - Added derived component classes. - - Created usecases.c and ccusecases.cc to demonstrate use - - C++ interface compile - - -Version 0.04 5Apr99 -------------------- - -Version 0.02 30Mar99 --------------------- \ No newline at end of file diff --git a/libical/MacOS/errno.h b/libical/MacOS/errno.h deleted file mode 100644 index 4be3479b50..0000000000 --- a/libical/MacOS/errno.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)errno.h 7.13 (Berkeley) 2/19/91 - */ - -#ifdef macintosh -#include -#else -#ifndef KERNEL -extern int errno; /* global error number */ -#endif -#endif - - -#define EPERM 1 /* Operation not permitted */ -/* MSL defines ENOMEM, EACCES, ENOENT, ENOSYS. We give in. */ -#ifndef ENOENT -#define ENOENT 2 /* No such file or directory */ -#endif -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* Input/output error */ -#define ENXIO 6 /* Device not configured */ -#define E2BIG 7 /* Argument list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file descriptor */ -#define ECHILD 10 /* No child processes */ -#define EDEADLK 11 /* Resource deadlock avoided */ - /* 11 was EAGAIN */ -#ifndef ENOMEM -#define ENOMEM 12 /* Cannot allocate memory */ -#define EACCES 13 /* Permission denied */ -#endif -#define EFAULT 14 /* Bad address */ -#ifndef _POSIX_SOURCE -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Device busy */ -#endif -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* Operation not supported by device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Inappropriate ioctl for device */ -#ifndef _POSIX_SOURCE -#define ETXTBSY 26 /* Text file busy */ -#endif -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ - -#ifndef __MWERKS__ -/* math software */ -#define EDOM 33 /* Numerical argument out of domain */ -#define ERANGE 34 /* Result too large */ -#endif - -/* non-blocking and interrupt i/o */ -#if defined(macintosh) -#ifndef EAGAIN -#define EAGAIN 11 -#endif -#else -#define EAGAIN 35 /* Resource temporarily unavailable */ -#endif -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#ifndef _POSIX_SOURCE -/* Did I tell that MSL also occupies errnos 33-40? We give in. */ -#if ENOMEM==37 -#define EINPROGRESS 136 /* Operation now in progress */ -#define EALREADY 137 /* Operation already in progress */ - -/* ipc/network software -- argument errors */ -#define ENOTSOCK 138 /* Socket operation on non-socket */ -#define EDESTADDRREQ 139 /* Destination address required */ -#define EMSGSIZE 140 /* Message too long */ -#else -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ - -/* ipc/network software -- argument errors */ -#define ENOTSOCK 38 /* Socket operation on non-socket */ -#define EDESTADDRREQ 39 /* Destination address required */ -#define EMSGSIZE 40 /* Message too long */ -#endif -#define EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 42 /* Protocol not available */ -#define EPROTONOSUPPORT 43 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define EOPNOTSUPP 45 /* Operation not supported on socket */ -#define EPFNOSUPPORT 46 /* Protocol family not supported */ -#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define EADDRINUSE 48 /* Address already in use */ -#define EADDRNOTAVAIL 49 /* Can't assign requested address */ - -/* ipc/network software -- operational errors */ -#define ENETDOWN 50 /* Network is down */ -#define ENETUNREACH 51 /* Network is unreachable */ -#define ENETRESET 52 /* Network dropped connection on reset */ -#define ECONNABORTED 53 /* Software caused connection abort */ -#define ECONNRESET 54 /* Connection reset by peer */ -#define ENOBUFS 55 /* No buffer space available */ -#define EISCONN 56 /* Socket is already connected */ -#define ENOTCONN 57 /* Socket is not connected */ -#define ESHUTDOWN 58 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 59 /* Too many references: can't splice */ -#define ETIMEDOUT 60 /* Connection timed out */ -#define ECONNREFUSED 61 /* Connection refused */ - -#define ELOOP 62 /* Too many levels of symbolic links */ -#endif /* _POSIX_SOURCE */ -#define ENAMETOOLONG 63 /* File name too long */ - -/* should be rearranged */ -#ifndef _POSIX_SOURCE -#define EHOSTDOWN 64 /* Host is down */ -#define EHOSTUNREACH 65 /* No route to host */ -#endif /* _POSIX_SOURCE */ -#define ENOTEMPTY 66 /* Directory not empty */ - -/* quotas & mush */ -#ifndef _POSIX_SOURCE -#define EPROCLIM 67 /* Too many processes */ -#define EUSERS 68 /* Too many users */ -#define EDQUOT 69 /* Disc quota exceeded */ - -/* Network File System */ -#define ESTALE 70 /* Stale NFS file handle */ -#define EREMOTE 71 /* Too many levels of remote in path */ -#define EBADRPC 72 /* RPC struct is bad */ -#define ERPCMISMATCH 73 /* RPC version wrong */ -#define EPROGUNAVAIL 74 /* RPC prog. not avail */ -#define EPROGMISMATCH 75 /* Program version wrong */ -#define EPROCUNAVAIL 76 /* Bad procedure for program */ -#endif /* _POSIX_SOURCE */ - -#define ENOLCK 77 /* No locks available */ - -#ifndef ENOSYS -#define ENOSYS 78 /* Function not implemented */ -#endif - -#define EFTYPE 79 /* Inappropriate file type or format */ - -#ifdef KERNEL -/* pseudo-errors returned inside kernel to modify return to process */ -#define ERESTART -1 /* restart syscall */ -#define EJUSTRETURN -2 /* don't modify regs, just return */ -#endif diff --git a/libical/MacOS/libical.mcp b/libical/MacOS/libical.mcp deleted file mode 100644 index 1c0ec4a35b..0000000000 Binary files a/libical/MacOS/libical.mcp and /dev/null differ diff --git a/libical/MacOS/libical.mcp.exp b/libical/MacOS/libical.mcp.exp deleted file mode 100644 index 07c84e0efc..0000000000 --- a/libical/MacOS/libical.mcp.exp +++ /dev/null @@ -1 +0,0 @@ -icalvalue_get_utcoffset icalvalue_set_utcoffset icalvalue_new_utcoffset icalvalue_get_uri icalvalue_set_uri icalvalue_new_uri icalvalue_get_trigger icalvalue_set_trigger icalvalue_new_trigger icalvalue_get_time icalvalue_set_time icalvalue_new_time icalvalue_get_text icalvalue_set_text icalvalue_new_text icalvalue_get_recur icalvalue_set_recur icalvalue_new_recur icalvalue_get_period icalvalue_set_period icalvalue_new_period icalvalue_get_integer icalvalue_set_integer icalvalue_new_integer icalvalue_get_geo icalvalue_set_geo icalvalue_new_geo icalvalue_get_float icalvalue_set_float icalvalue_new_float icalvalue_get_duration icalvalue_set_duration icalvalue_new_duration icalvalue_get_datetimeperiod icalvalue_set_datetimeperiod icalvalue_new_datetimeperiod icalvalue_get_datetimedate icalvalue_set_datetimedate icalvalue_new_datetimedate icalvalue_get_datetime icalvalue_set_datetime icalvalue_new_datetime icalvalue_get_date icalvalue_set_date icalvalue_new_date icalvalue_get_caladdress icalvalue_set_caladdress icalvalue_new_caladdress icalvalue_get_boolean icalvalue_set_boolean icalvalue_new_boolean icalvalue_get_binary icalvalue_set_binary icalvalue_new_binary icalvalue_get_attach icalvalue_set_attach icalvalue_new_attach icalvalue_isa_value icalvalue_isa icalvalue_as_ical_string icalvalue_trigger_as_ical_string icalvalue_period_as_ical_string icalvalue_datetimeperiod_as_ical_string icalvalue_recur_as_ical_string icalvalue_geo_as_ical_string icalvalue_float_as_ical_string icalvalue_datetimedate_as_ical_string icalvalue_datetime_as_ical_string icalvalue_date_as_ical_string icalvalue_time_as_ical_string icalvalue_duration_as_ical_string icalvalue_attach_as_ical_string icalvalue_string_as_ical_string icalvalue_int_as_ical_string icalvalue_binary_as_ical_string icalvalue_is_valid icalvalue_free icalvalue_new icalvalue_new_impl icalproperty_get_action icalproperty_set_action icalproperty_vanew_action icalproperty_new_action icalproperty_get_due icalproperty_set_due icalproperty_vanew_due icalproperty_new_due icalproperty_get_dtstamp icalproperty_set_dtstamp icalproperty_vanew_dtstamp icalproperty_new_dtstamp icalproperty_get_completed icalproperty_set_completed icalproperty_vanew_completed icalproperty_new_completed icalproperty_get_geo icalproperty_set_geo icalproperty_vanew_geo icalproperty_new_geo icalproperty_get_created icalproperty_set_created icalproperty_vanew_created icalproperty_new_created icalproperty_get_calscale icalproperty_set_calscale icalproperty_vanew_calscale icalproperty_new_calscale icalproperty_get_percentcomplete icalproperty_set_percentcomplete icalproperty_vanew_percentcomplete icalproperty_new_percentcomplete icalproperty_get_exrule icalproperty_set_exrule icalproperty_vanew_exrule icalproperty_new_exrule icalproperty_get_attach icalproperty_set_attach icalproperty_vanew_attach icalproperty_new_attach icalproperty_get_url icalproperty_set_url icalproperty_vanew_url icalproperty_new_url icalproperty_get_rdate icalproperty_set_rdate icalproperty_vanew_rdate icalproperty_new_rdate icalproperty_get_tzname icalproperty_set_tzname icalproperty_vanew_tzname icalproperty_new_tzname icalproperty_get_dtend icalproperty_set_dtend icalproperty_vanew_dtend icalproperty_new_dtend icalproperty_get_summary icalproperty_set_summary icalproperty_vanew_summary icalproperty_new_summary icalproperty_get_recurrenceid icalproperty_set_recurrenceid icalproperty_vanew_recurrenceid icalproperty_new_recurrenceid icalproperty_get_dtstart icalproperty_set_dtstart icalproperty_vanew_dtstart icalproperty_new_dtstart icalproperty_get_freebusy icalproperty_set_freebusy icalproperty_vanew_freebusy icalproperty_new_freebusy icalproperty_get_priority icalproperty_set_priority icalproperty_vanew_priority icalproperty_new_priority icalproperty_get_repeat icalproperty_set_repeat icalproperty_vanew_repeat icalproperty_new_repeat icalproperty_get_tzurl icalproperty_set_tzurl icalproperty_vanew_tzurl icalproperty_new_tzurl icalproperty_get_resources icalproperty_set_resources icalproperty_vanew_resources icalproperty_new_resources icalproperty_get_tzid icalproperty_set_tzid icalproperty_vanew_tzid icalproperty_new_tzid icalproperty_get_exdate icalproperty_set_exdate icalproperty_vanew_exdate icalproperty_new_exdate icalproperty_get_requeststatus icalproperty_set_requeststatus icalproperty_vanew_requeststatus icalproperty_new_requeststatus icalproperty_get_location icalproperty_set_location icalproperty_vanew_location icalproperty_new_location icalproperty_get_sequence icalproperty_set_sequence icalproperty_vanew_sequence icalproperty_new_sequence icalproperty_get_transp icalproperty_set_transp icalproperty_vanew_transp icalproperty_new_transp icalproperty_get_tzoffsetto icalproperty_set_tzoffsetto icalproperty_vanew_tzoffsetto icalproperty_new_tzoffsetto icalproperty_get_x_name icalproperty_get_x icalproperty_set_x_name icalproperty_set_x icalproperty_vanew_x icalproperty_new_x icalproperty_get_class icalproperty_set_class icalproperty_vanew_class icalproperty_new_class icalproperty_get_trigger icalproperty_set_trigger icalproperty_vanew_trigger icalproperty_new_trigger icalproperty_get_comment icalproperty_set_comment icalproperty_vanew_comment icalproperty_new_comment icalproperty_get_organizer icalproperty_set_organizer icalproperty_vanew_organizer icalproperty_new_organizer icalproperty_get_relatedto icalproperty_set_relatedto icalproperty_vanew_relatedto icalproperty_new_relatedto icalproperty_get_contact icalproperty_set_contact icalproperty_vanew_contact icalproperty_new_contact icalproperty_get_attendee icalproperty_set_attendee icalproperty_vanew_attendee icalproperty_new_attendee icalproperty_get_rrule icalproperty_set_rrule icalproperty_vanew_rrule icalproperty_new_rrule icalproperty_get_tzoffsetfrom icalproperty_set_tzoffsetfrom icalproperty_vanew_tzoffsetfrom icalproperty_new_tzoffsetfrom icalproperty_get_version icalproperty_set_version icalproperty_vanew_version icalproperty_new_version icalproperty_get_categories icalproperty_set_categories icalproperty_vanew_categories icalproperty_new_categories icalproperty_get_description icalproperty_set_description icalproperty_vanew_description icalproperty_new_description icalproperty_get_status icalproperty_set_status icalproperty_vanew_status icalproperty_new_status icalproperty_get_prodid icalproperty_set_prodid icalproperty_vanew_prodid icalproperty_new_prodid icalproperty_get_uid icalproperty_set_uid icalproperty_vanew_uid icalproperty_new_uid icalproperty_get_lastmodified icalproperty_set_lastmodified icalproperty_vanew_lastmodified icalproperty_new_lastmodified icalproperty_get_method icalproperty_set_method icalproperty_vanew_method icalproperty_new_method icalproperty_get_value icalproperty_set_value icalproperty_get_next_parameter icalproperty_get_first_parameter icalproperty_count_parameters icalproperty_remove_parameter icalproperty_add_parameter icalproperty_isa_property icalproperty_isa icalproperty_as_ical_string icalproperty_free icalproperty_new icalproperty_new_impl icalproperty_add_parameters icalparameter_set_x icalparameter_get_x icalparameter_new_x icalparameter_set_value icalparameter_get_value icalparameter_new_value icalparameter_set_tzid icalparameter_get_tzid icalparameter_new_tzid icalparameter_set_sentby icalparameter_get_sentby icalparameter_new_sentby icalparameter_set_rsvp icalparameter_get_rsvp icalparameter_new_rsvp icalparameter_set_role icalparameter_get_role icalparameter_new_role icalparameter_set_reltype icalparameter_get_reltype icalparameter_new_reltype icalparameter_set_related icalparameter_get_related icalparameter_new_related icalparameter_set_range icalparameter_get_range icalparameter_new_range icalparameter_set_partstat icalparameter_get_partstat icalparameter_new_partstat icalparameter_set_member icalparameter_get_member icalparameter_new_member icalparameter_set_language icalparameter_get_language icalparameter_new_language icalparameter_set_fmttype icalparameter_get_fmttype icalparameter_new_fmttype icalparameter_set_fbtype icalparameter_get_fbtype icalparameter_new_fbtype icalparameter_set_encoding icalparameter_get_encoding icalparameter_new_encoding icalparameter_set_dir icalparameter_get_dir icalparameter_new_dir icalparameter_set_delegatedto icalparameter_get_delegatedto icalparameter_new_delegatedto icalparameter_set_delegatedfrom icalparameter_get_delegatedfrom icalparameter_new_delegatedfrom icalparameter_set_cutype icalparameter_get_cutype icalparameter_new_cutype icalparameter_set_cn icalparameter_get_cn icalparameter_new_cn icalparameter_set_altrep icalparameter_get_altrep icalparameter_new_altrep icalparameter_get_xname icalparameterset_xname icalparameter_isa_parameter icalparameter_isa icalparameter_is_valid icalparameter_as_ical_string icalparameter_free icalparameter_new icalparameter_new_impl icalenum_string_to_component_kind icalenum_component_kind_to_string icalenum_value_kind_by_prop icalenum_string_to_parameter_kind icalenum_parameter_kind_to_string icalenum_string_to_property_kind icalenum_property_kind_to_string icalcomponent_get_component icalcomponent_get_next_component icalcomponent_get_first_component icalcomponent_count_components icalcomponent_remove_component icalcomponent_add_component icalcomponent_get_properties icalcomponent_get_next_property icalcomponent_get_first_property icalcomponent_count_properties icalcomponent_remove_property icalcomponent_add_property icalcomponent_isa_component icalcomponent_isa icalcomponent_is_valid icalcomponent_as_ical_string icalcomponent_free icalcomponent_vanew icalcomponent_new icalcomponent_new_impl icalcomponent_add_children #pvl_list_count #pvl_elem_count #pvl_apply #pvl_data #pvl_tail #pvl_head #pvl_prior #pvl_next #pvl_count #pvl_clear #pvl_find_next #pvl_find #pvl_remove #pvl_insert_before #pvl_insert_after #pvl_insert_ordered #pvl_pop #pvl_push #pvl_shift #pvl_unshift #pvl_new_element #pvl_newlist #strdup icalrestriction_records icalrestriction_is_parameter_allowed icalrestriction_get_component_restriction icalrestriction_get_property_restriction icalerrno icalerror_set_errno icalerror_clear_errno buffer_ring initialized buffer_pos icalmemory_append_string icalmemory_free_buffer icalmemory_resize_buffer icalmemory_new_buffer icalmemory_free_tmp_buffer icalmemory_resize_tmp_buffer icalmemory_new_tmp_buffer #__msipl_rd__3std # std::__msipl_rd #__dt__Q23std18__random_generatorFv # std::__random_generator::~__random_generator() #seed__Q23std18__random_generatorFUl # std::__random_generator::seed(unsigned long) #setfill__3stdFi # std::setfill(int) #setbase__3stdFi # std::setbase(int) #setiosflags__3stdFl # std::setiosflags(long) #resetiosflags__3stdFl # std::resetiosflags(long) #ffill__3stdFRQ23std35basic_ios>w # std::ffill(std::basic_ios>&,wchar_t) #ffill__3stdFRQ23std35basic_ios>i # std::ffill(std::basic_ios>&,int) #setw__3stdFi # std::setw(int) #setprecision__3stdFi # std::setprecision(int) #__vt__Q23std39basic_istream> # std::basic_istream>::__vt #__vt__Q23std35basic_ios> # std::basic_ios>::__vt #__vt__Q23std39basic_ostream> # std::basic_ostream>::__vt #__vt__Q23std39basic_filebuf> # std::basic_filebuf>::__vt #__vt__Q23std41basic_streambuf> # std::basic_streambuf>::__vt #__vt__Q23std8bad_cast # std::bad_cast::__vt #__vt__Q23std9exception # std::exception::__vt #cerr__3std # std::cerr #clog__3std # std::clog #cout__3std # std::cout #cin__3std # std::cin #index__Q23std8ios_base # std::ios_base::index #heap_size__Q23std14base_allocator # std::base_allocator::heap_size #end_free__Q23std14base_allocator # std::base_allocator::end_free #start_free__Q23std14base_allocator # std::base_allocator::start_free #free_list__Q23std14base_allocator # std::base_allocator::free_list #init_cnt__Q33std8ios_base4Init # std::ios_base::Init::init_cnt #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #what__Q23std9exceptionCFv # std::exception::what() const #what__Q23std8bad_castCFv # std::bad_cast::what() const #__dt__Q23std9exceptionFv # std::exception::~exception() #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #__dt__Q23std8bad_castFv # std::bad_cast::~bad_cast() #init__Q23std35basic_ios>FPQ23std41basic_streambuf> # std::basic_ios>::init(std::basic_streambuf>*) #always_noconv__Q23std23_Generic_codecvtCFv # std::_Generic_codecvt::always_noconv() const #out__Q23std23_Generic_codecvtCFRiPCcPCcRPCcPcPcRPc # std::_Generic_codecvt::out(int&,const char*,const char*,const char*&,char*,char*,char*&) const #__ct__Q23std39basic_ostream>FPQ23std41basic_streambuf> # std::basic_ostream>::basic_ostream(std::basic_streambuf>*) #__ct__Q23std39basic_istream>FPQ23std41basic_streambuf> # std::basic_istream>::basic_istream(std::basic_streambuf>*) #__dt__Q33std39basic_ostream>6sentryFv # std::basic_ostream>::sentry::~sentry() #flush__Q23std39basic_ostream>Fv # std::basic_ostream>::flush() #close__Q23std39basic_filebuf>Fv # std::basic_filebuf>::close() #overflow__Q23std41basic_streambuf>Fi # std::basic_streambuf>::overflow(int) #xsputn__Q23std41basic_streambuf>FPCci # std::basic_streambuf>::xsputn(const char*,int) #pbackfail__Q23std41basic_streambuf>Fi # std::basic_streambuf>::pbackfail(int) #uflow__Q23std41basic_streambuf>Fv # std::basic_streambuf>::uflow() #underflow__Q23std41basic_streambuf>Fv # std::basic_streambuf>::underflow() #xsgetn__Q23std41basic_streambuf>FPci # std::basic_streambuf>::xsgetn(char*,int) #showmanyc__Q23std41basic_streambuf>Fv # std::basic_streambuf>::showmanyc() #sync__Q23std41basic_streambuf>Fv # std::basic_streambuf>::sync() #seekpos__Q23std41basic_streambuf>FQ23std7fposs # std::basic_streambuf>::seekpos(std::fpos,short) #seekoff__Q23std41basic_streambuf>FlQ33std8ios_base7seekdirs # std::basic_streambuf>::seekoff(long,std::ios_base::seekdir,short) #setbuf__Q23std41basic_streambuf>FPci # std::basic_streambuf>::setbuf(char*,int) #imbue__Q23std41basic_streambuf>FRCQ23std6locale # std::basic_streambuf>::imbue(const std::locale&) #xsputn__Q23std39basic_filebuf>FPCci # std::basic_filebuf>::xsputn(const char*,int) #xsgetn__Q23std39basic_filebuf>FPci # std::basic_filebuf>::xsgetn(char*,int) #showmanyc__Q23std39basic_filebuf>Fv # std::basic_filebuf>::showmanyc() #imbue__Q23std39basic_filebuf>FRCQ23std6locale # std::basic_filebuf>::imbue(const std::locale&) #uflow__Q23std39basic_filebuf>Fv # std::basic_filebuf>::uflow() #sync__Q23std39basic_filebuf>Fv # std::basic_filebuf>::sync() #setbuf__Q23std39basic_filebuf>FPci # std::basic_filebuf>::setbuf(char*,int) #seekpos__Q23std39basic_filebuf>FQ23std7fposs # std::basic_filebuf>::seekpos(std::fpos,short) #seekoff__Q23std39basic_filebuf>FlQ33std8ios_base7seekdirs # std::basic_filebuf>::seekoff(long,std::ios_base::seekdir,short) #underflow__Q23std39basic_filebuf>Fv # std::basic_filebuf>::underflow() #pbackfail__Q23std39basic_filebuf>Fi # std::basic_filebuf>::pbackfail(int) #overflow__Q23std39basic_filebuf>Fi # std::basic_filebuf>::overflow(int) #@8@68@__dt__Q23std39basic_ostream>Fv #__dt__Q23std35basic_ios>Fv # std::basic_ios>::~basic_ios() #@12@68@__dt__Q23std39basic_istream>Fv #__dt__Q23std39basic_istream>Fv # std::basic_istream>::~basic_istream() #__dt__Q23std39basic_ostream>Fv # std::basic_ostream>::~basic_ostream() #__dt__Q33std8ios_base4InitFv # std::ios_base::Init::~Init() #__dt__Q23std41basic_streambuf>Fv # std::basic_streambuf>::~basic_streambuf() #__ct__Q33std8ios_base4InitFv # std::ios_base::Init::Init() #__dt__Q23std39basic_filebuf>Fv # std::basic_filebuf>::~basic_filebuf() #__mask_map__3std # std::__mask_map #__vt__Q23std15moneypunct # std::moneypunct::__vt #__vt__Q23std15moneypunct # std::moneypunct::__vt #__vt__Q23std15moneypunct # std::moneypunct::__vt #__vt__Q23std15moneypunct # std::moneypunct::__vt #__vt__Q23std12timepunct # std::timepunct::__vt #__vt__Q23std12timepunct # std::timepunct::__vt #__vt__Q23std11numpunct # std::numpunct::__vt #__vt__Q23std11numpunct # std::numpunct::__vt #__vt__Q23std14codecvt # std::codecvt::__vt #__vt__Q23std14codecvt # std::codecvt::__vt #__vt__Q23std15ctype_byname # std::ctype_byname::__vt #__vt__Q23std8ctype # std::ctype::__vt #__vt__Q23std8ctype # std::ctype::__vt #__vt__Q33std6locale5facet # std::locale::facet::__vt #__vt__Q23std13runtime_error # std::runtime_error::__vt #__vt__Q23std12out_of_range # std::out_of_range::__vt #__vt__Q23std12length_error # std::length_error::__vt #__vt__Q23std11logic_error # std::logic_error::__vt #__vt__Q23std9bad_alloc # std::bad_alloc::__vt #__vt__Q23std23_Generic_codecvt # std::_Generic_codecvt::__vt #__vt__Q23std23_Generic_codecvt # std::_Generic_codecvt::__vt #__vt__Q23std64num_get>> # std::num_get>>::__vt #__vt__Q23std64num_get>> # std::num_get>>::__vt #__vt__Q23std64num_put>> # std::num_put>>::__vt #__vt__Q23std64num_put>> # std::num_put>>::__vt #__vt__Q23std20_Generic_numpunct # std::_Generic_numpunct::__vt #__vt__Q23std20_Generic_numpunct # std::_Generic_numpunct::__vt #__vt__Q23std10collate # std::collate::__vt #__vt__Q23std10collate # std::collate::__vt #__vt__Q23std21_Generic_timepunct # std::_Generic_timepunct::__vt #__vt__Q23std21_Generic_timepunct # std::_Generic_timepunct::__vt #__vt__Q23std65time_get>> # std::time_get>>::__vt #__vt__Q23std65time_get>> # std::time_get>>::__vt #__vt__Q23std65time_put>> # std::time_put>>::__vt #__vt__Q23std65time_put>> # std::time_put>>::__vt #__vt__Q23std66money_get>> # std::money_get>>::__vt #__vt__Q23std66money_get>> # std::money_get>>::__vt #__vt__Q23std66money_put>> # std::money_put>>::__vt #__vt__Q23std66money_put>> # std::money_put>>::__vt #__vt__Q23std24_Generic_moneypunct # std::_Generic_moneypunct::__vt #__vt__Q23std24_Generic_moneypunct # std::_Generic_moneypunct::__vt #__vt__Q23std24_Generic_moneypunct # std::_Generic_moneypunct::__vt #__vt__Q23std24_Generic_moneypunct # std::_Generic_moneypunct::__vt #id__Q23std64num_get>> # std::num_get>>::id #__init__id__Q23std64num_get>> #id__Q23std64num_get>> # std::num_get>>::id #__init__id__Q23std64num_get>> #id__Q23std64num_put>> # std::num_put>>::id #__init__id__Q23std64num_put>> #id__Q23std64num_put>> # std::num_put>>::id #__init__id__Q23std64num_put>> #id__Q23std10collate # std::collate::id #__init__id__Q23std10collate #id__Q23std10collate # std::collate::id #__init__id__Q23std10collate #id__Q23std65time_get>> # std::time_get>>::id #__init__id__Q23std65time_get>> #id__Q23std65time_get>> # std::time_get>>::id #__init__id__Q23std65time_get>> #id__Q23std65time_put>> # std::time_put>>::id #__init__id__Q23std65time_put>> #id__Q23std65time_put>> # std::time_put>>::id #__init__id__Q23std65time_put>> #id__Q23std66money_get>> # std::money_get>>::id #__init__id__Q23std66money_get>> #id__Q23std66money_get>> # std::money_get>>::id #__init__id__Q23std66money_get>> #id__Q23std66money_put>> # std::money_put>>::id #__init__id__Q23std66money_put>> #id__Q23std66money_put>> # std::money_put>>::id #__init__id__Q23std66money_put>> #id__Q23std15moneypunct # std::moneypunct::id #__init__id__Q23std15moneypunct #id__Q23std15moneypunct # std::moneypunct::id #__init__id__Q23std15moneypunct #id__Q23std15moneypunct # std::moneypunct::id #__init__id__Q23std15moneypunct #id__Q23std15moneypunct # std::moneypunct::id #__init__id__Q23std15moneypunct #id__Q23std12timepunct # std::timepunct::id #__init__id__Q23std12timepunct #id__Q23std12timepunct # std::timepunct::id #__init__id__Q23std12timepunct #id__Q23std11numpunct # std::numpunct::id #__init__id__Q23std11numpunct #id__Q23std11numpunct # std::numpunct::id #__init__id__Q23std11numpunct #id__Q23std14codecvt # std::codecvt::id #__init__id__Q23std14codecvt #id__Q23std14codecvt # std::codecvt::id #__init__id__Q23std14codecvt #id__Q23std8ctype # std::ctype::id #__init__id__Q23std8ctype #id__Q23std8ctype # std::ctype::id #__init__id__Q23std8ctype #global_s__Q23std6locale # std::locale::global_s #id_count_s__Q33std6locale2id # std::locale::id::id_count_s #insert__Q23std32vector>FPPvUlRCPv # std::vector>::insert(void**,unsigned long,void*const&) #erase__Q23std32vector>FPPvPPv # std::vector>::erase(void**,void**) #do_assign__Q23std32vector>FPCPvPCPvQ23std20forward_iterator_tag # std::vector>::do_assign(void*const*,void*const*,std::forward_iterator_tag) #resize__Q23std32vector>FUlPv # std::vector>::resize(unsigned long,void*) #compare__Q23std59basic_string,Q23std12allocator>CFUlUlPCcUl # std::basic_string, std::allocator>::compare(unsigned long,unsigned long,const char*,unsigned long) const #max_size__Q23std13allocatorCFv # std::allocator::max_size() const #max_size__Q23std12allocatorCFv # std::allocator::max_size() const #max_size__Q23std12allocatorCFv # std::allocator::max_size() const #init__Q23std59basic_string,Q23std12allocator>FPCcPCcRCQ23std12allocatorQ23std26random_access_iterator_tag # std::basic_string, std::allocator>::init(const char*,const char*,const std::allocator&,std::random_access_iterator_tag) #append__Q23std59basic_string,Q23std12allocator>FRCQ23std59basic_string,Q23std12allocator>UlUl # std::basic_string, std::allocator>::append(const std::basic_string, std::allocator>&,unsigned long,unsigned long) #init__Q23std59basic_string,Q23std12allocator>FPCwPCwRCQ23std12allocatorQ23std26random_access_iterator_tag # std::basic_string, std::allocator>::init(const wchar_t*,const wchar_t*,const std::allocator&,std::random_access_iterator_tag) #__dt__Q23std66money_put>>Fv # std::money_put>>::~money_put() #__dt__Q23std66money_put>>Fv # std::money_put>>::~money_put() #__dt__Q23std66money_get>>Fv # std::money_get>>::~money_get() #__dt__Q23std66money_get>>Fv # std::money_get>>::~money_get() #__dt__Q23std65time_put>>Fv # std::time_put>>::~time_put() #__dt__Q23std65time_put>>Fv # std::time_put>>::~time_put() #__dt__Q23std65time_get>>Fv # std::time_get>>::~time_get() #__dt__Q23std65time_get>>Fv # std::time_get>>::~time_get() #__dt__Q23std10collateFv # std::collate::~collate() #__dt__Q23std10collateFv # std::collate::~collate() #__dt__Q23std64num_put>>Fv # std::num_put>>::~num_put() #__dt__Q23std64num_put>>Fv # std::num_put>>::~num_put() #__dt__Q23std64num_get>>Fv # std::num_get>>::~num_get() #__dt__Q23std64num_get>>Fv # std::num_get>>::~num_get() #what__Q23std9bad_allocCFv # std::bad_alloc::what() const #what__Q23std11logic_errorCFv # std::logic_error::what() const #replace>>>__Q33std6locale3impFRCQ23std65time_put>> # std::locale::imp::replace>>>(const std::time_put>>&) #replace>>>__Q33std6locale3impFRCQ23std65time_get>> # std::locale::imp::replace>>>(const std::time_get>>&) #replace>__Q33std6locale3impFRCQ23std12timepunct # std::locale::imp::replace>(const std::timepunct&) #replace>>>__Q33std6locale3impFRCQ23std65time_put>> # std::locale::imp::replace>>>(const std::time_put>>&) #replace>>>__Q33std6locale3impFRCQ23std65time_get>> # std::locale::imp::replace>>>(const std::time_get>>&) #replace>__Q33std6locale3impFRCQ23std12timepunct # std::locale::imp::replace>(const std::timepunct&) #replace>>>__Q33std6locale3impFRCQ23std64num_put>> # std::locale::imp::replace>>>(const std::num_put>>&) #replace>>>__Q33std6locale3impFRCQ23std64num_get>> # std::locale::imp::replace>>>(const std::num_get>>&) #replace>__Q33std6locale3impFRCQ23std11numpunct # std::locale::imp::replace>(const std::numpunct&) #replace>>>__Q33std6locale3impFRCQ23std64num_put>> # std::locale::imp::replace>>>(const std::num_put>>&) #replace>>>__Q33std6locale3impFRCQ23std64num_get>> # std::locale::imp::replace>>>(const std::num_get>>&) #replace>__Q33std6locale3impFRCQ23std11numpunct # std::locale::imp::replace>(const std::numpunct&) #replace>>>__Q33std6locale3impFRCQ23std66money_put>> # std::locale::imp::replace>>>(const std::money_put>>&) #replace>>>__Q33std6locale3impFRCQ23std66money_get>> # std::locale::imp::replace>>>(const std::money_get>>&) #replace>__Q33std6locale3impFRCQ23std15moneypunct # std::locale::imp::replace>(const std::moneypunct&) #replace>__Q33std6locale3impFRCQ23std15moneypunct # std::locale::imp::replace>(const std::moneypunct&) #replace>>>__Q33std6locale3impFRCQ23std66money_put>> # std::locale::imp::replace>>>(const std::money_put>>&) #replace>>>__Q33std6locale3impFRCQ23std66money_get>> # std::locale::imp::replace>>>(const std::money_get>>&) #replace>__Q33std6locale3impFRCQ23std15moneypunct # std::locale::imp::replace>(const std::moneypunct&) #replace>__Q33std6locale3impFRCQ23std15moneypunct # std::locale::imp::replace>(const std::moneypunct&) #replace>__Q33std6locale3impFRCQ23std14codecvt # std::locale::imp::replace>(const std::codecvt&) #replace>__Q33std6locale3impFRCQ23std8ctype # std::locale::imp::replace>(const std::ctype&) #replace>__Q33std6locale3impFRCQ23std14codecvt # std::locale::imp::replace>(const std::codecvt&) #replace>__Q33std6locale3impFRCQ23std8ctype # std::locale::imp::replace>(const std::ctype&) #replace>__Q33std6locale3impFRCQ23std10collate # std::locale::imp::replace>(const std::collate&) #replace>__Q33std6locale3impFRCQ23std10collate # std::locale::imp::replace>(const std::collate&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>>>__3stdFRCQ23std6locale # std::use_facet>>>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #use_facet>__3stdFRCQ23std6locale # std::use_facet>(const std::locale&) #__ct__Q23std32vector>FRCQ23std32vector> # std::vector>::vector(const std::vector>&) #__as__Q23std32vector>FRCQ23std32vector> # std::vector>::operator =(const std::vector>&) #init__Q23std32vector>FUlRCPv # std::vector>::init(unsigned long,void*const&) #__ne,Q23std12allocator>__3stdFRCQ23std59basic_string,Q23std12allocator>PCc # std::operator !=, std::allocator>(const std::basic_string, std::allocator>&,const char*) #__pl,Q23std12allocator>__3stdFRCQ23std59basic_string,Q23std12allocator>RCQ23std59basic_string,Q23std12allocator> # std::operator +, std::allocator>(const std::basic_string, std::allocator>&,const std::basic_string, std::allocator>&) #__ct__Q33std59basic_string,Q23std12allocator>9CharArrayFRCQ23std12allocatorUl # std::basic_string, std::allocator>::CharArray::CharArray(const std::allocator&,unsigned long) #__dt__Q23std40_EmptyMemberOpt,Ul>Fv # std::_EmptyMemberOpt, unsigned long>::~_EmptyMemberOpt() #__ct__Q33std59basic_string,Q23std12allocator>9CharArrayFRCQ33std59basic_string,Q23std12allocator>9CharArray # std::basic_string, std::allocator>::CharArray::CharArray(const std::basic_string, std::allocator>::CharArray&) #get_allocator__Q23std59basic_string,Q23std12allocator>CFv # std::basic_string, std::allocator>::get_allocator() const #__ct__Q23std59basic_string,Q23std12allocator>FRCQ23std59basic_string,Q23std12allocator>UlUl # std::basic_string, std::allocator>::basic_string(const std::basic_string, std::allocator>&,unsigned long,unsigned long) #__ct__Q23std59basic_string,Q23std12allocator>FPCwRCQ23std12allocator # std::basic_string, std::allocator>::basic_string(const wchar_t*,const std::allocator&) #init__Q23std59basic_string,Q23std12allocator>FUlwRCQ23std12allocator # std::basic_string, std::allocator>::init(unsigned long,wchar_t,const std::allocator&) #change_size__Q23std59basic_string,Q23std12allocator>FUlb # std::basic_string, std::allocator>::change_size(unsigned long,bool) #__ct__Q33std59basic_string,Q23std12allocator>9CharArrayFRCQ23std12allocatorUl # std::basic_string, std::allocator>::CharArray::CharArray(const std::allocator&,unsigned long) #get_allocator__Q23std59basic_string,Q23std12allocator>CFv # std::basic_string, std::allocator>::get_allocator() const #__ct__Q23std59basic_string,Q23std12allocator>FRCQ23std59basic_string,Q23std12allocator>UlUl # std::basic_string, std::allocator>::basic_string(const std::basic_string, std::allocator>&,unsigned long,unsigned long) #__ct__Q23std59basic_string,Q23std12allocator>FPCcRCQ23std12allocator # std::basic_string, std::allocator>::basic_string(const char*,const std::allocator&) #__dt__Q23std40_EmptyMemberOpt,Ul>Fv # std::_EmptyMemberOpt, unsigned long>::~_EmptyMemberOpt() #__ct__Q33std59basic_string,Q23std12allocator>9CharArrayFRCQ33std59basic_string,Q23std12allocator>9CharArray # std::basic_string, std::allocator>::CharArray::CharArray(const std::basic_string, std::allocator>::CharArray&) #assign__Q23std59basic_string,Q23std12allocator>FRCQ23std59basic_string,Q23std12allocator>UlUl # std::basic_string, std::allocator>::assign(const std::basic_string, std::allocator>&,unsigned long,unsigned long) #replace__Q23std59basic_string,Q23std12allocator>FUlUlUlc # std::basic_string, std::allocator>::replace(unsigned long,unsigned long,unsigned long,char) #__dt__Q23std12out_of_rangeFv # std::out_of_range::~out_of_range() #init__Q23std59basic_string,Q23std12allocator>FUlcRCQ23std12allocator # std::basic_string, std::allocator>::init(unsigned long,char,const std::allocator&) #__dt__Q23std11logic_errorFv # std::logic_error::~logic_error() #change_size__Q23std59basic_string,Q23std12allocator>FUlb # std::basic_string, std::allocator>::change_size(unsigned long,bool) #__dt__Q23std12length_errorFv # std::length_error::~length_error() #__ct__62_RefCountedPtr>FPQ33std6locale3imp # _RefCountedPtr>::_RefCountedPtr(std::locale::imp*) #__as__62_RefCountedPtr>FRC62_RefCountedPtr> # _RefCountedPtr>::operator =(const _RefCountedPtr>&) #__dt__28_RefCountedPtr>Fv # _RefCountedPtr>::~_RefCountedPtr() #__ct__62_RefCountedPtr>FRC62_RefCountedPtr> # _RefCountedPtr>::_RefCountedPtr(const _RefCountedPtr>&) #assign__Q23std59basic_string,Q23std12allocator>FPCcUl # std::basic_string, std::allocator>::assign(const char*,unsigned long) #__vc__Q23std59basic_string,Q23std12allocator>FUl # std::basic_string, std::allocator>::operator [](unsigned long) #resize__Q23std59basic_string,Q23std12allocator>FUlc # std::basic_string, std::allocator>::resize(unsigned long,char) #end__Q23std59basic_string,Q23std12allocator>Fv # std::basic_string, std::allocator>::end() #begin__Q23std59basic_string,Q23std12allocator>Fv # std::basic_string, std::allocator>::begin() #__ct__Q23std59basic_string,Q23std12allocator>FRCQ23std12allocator # std::basic_string, std::allocator>::basic_string(const std::allocator&) #__vc__Q23std59basic_string,Q23std12allocator>FUl # std::basic_string, std::allocator>::operator [](unsigned long) #resize__Q23std59basic_string,Q23std12allocator>FUlw # std::basic_string, std::allocator>::resize(unsigned long,wchar_t) #__ct__Q23std59basic_string,Q23std12allocator>FRCQ23std12allocator # std::basic_string, std::allocator>::basic_string(const std::allocator&) #__dt__Q23std9bad_allocFv # std::bad_alloc::~bad_alloc() #__dt__Q23std23_Generic_codecvtFv # std::_Generic_codecvt::~_Generic_codecvt() #__ct__Q23std23_Generic_codecvtFUl # std::_Generic_codecvt::_Generic_codecvt(unsigned long) #__dt__Q23std23_Generic_codecvtFv # std::_Generic_codecvt::~_Generic_codecvt() #__ct__Q23std23_Generic_codecvtFUl # std::_Generic_codecvt::_Generic_codecvt(unsigned long) #__ct__Q23std64num_get>>FUl # std::num_get>>::num_get(unsigned long) #__ct__Q23std64num_get>>FUl # std::num_get>>::num_get(unsigned long) #__ct__Q23std64num_put>>FUl # std::num_put>>::num_put(unsigned long) #__ct__Q23std64num_put>>FUl # std::num_put>>::num_put(unsigned long) #__dt__Q23std20_Generic_numpunctFv # std::_Generic_numpunct::~_Generic_numpunct() #__ct__Q23std20_Generic_numpunctFUl # std::_Generic_numpunct::_Generic_numpunct(unsigned long) #__dt__Q23std20_Generic_numpunctFv # std::_Generic_numpunct::~_Generic_numpunct() #__ct__Q23std20_Generic_numpunctFUl # std::_Generic_numpunct::_Generic_numpunct(unsigned long) #__ct__Q23std10collateFUl # std::collate::collate(unsigned long) #__ct__Q23std10collateFUl # std::collate::collate(unsigned long) #__dt__Q23std21_Generic_timepunctFv # std::_Generic_timepunct::~_Generic_timepunct() #__ct__Q23std21_Generic_timepunctFUl # std::_Generic_timepunct::_Generic_timepunct(unsigned long) #__dt__Q23std21_Generic_timepunctFv # std::_Generic_timepunct::~_Generic_timepunct() #__ct__Q23std21_Generic_timepunctFUl # std::_Generic_timepunct::_Generic_timepunct(unsigned long) #__ct__Q23std65time_get>>FUl # std::time_get>>::time_get(unsigned long) #__ct__Q23std65time_get>>FUl # std::time_get>>::time_get(unsigned long) #__ct__Q23std65time_put>>FUl # std::time_put>>::time_put(unsigned long) #__ct__Q23std65time_put>>FUl # std::time_put>>::time_put(unsigned long) #__ct__Q23std66money_get>>FUl # std::money_get>>::money_get(unsigned long) #__ct__Q23std66money_get>>FUl # std::money_get>>::money_get(unsigned long) #__ct__Q23std66money_put>>FUl # std::money_put>>::money_put(unsigned long) #__ct__Q23std66money_put>>FUl # std::money_put>>::money_put(unsigned long) #__dt__Q23std24_Generic_moneypunctFv # std::_Generic_moneypunct::~_Generic_moneypunct() #__ct__Q23std24_Generic_moneypunctFUl # std::_Generic_moneypunct::_Generic_moneypunct(unsigned long) #__dt__Q23std24_Generic_moneypunctFv # std::_Generic_moneypunct::~_Generic_moneypunct() #__ct__Q23std24_Generic_moneypunctFUl # std::_Generic_moneypunct::_Generic_moneypunct(unsigned long) #__dt__Q23std24_Generic_moneypunctFv # std::_Generic_moneypunct::~_Generic_moneypunct() #__ct__Q23std24_Generic_moneypunctFUl # std::_Generic_moneypunct::_Generic_moneypunct(unsigned long) #__dt__Q23std24_Generic_moneypunctFv # std::_Generic_moneypunct::~_Generic_moneypunct() #__ct__Q23std24_Generic_moneypunctFUl # std::_Generic_moneypunct::_Generic_moneypunct(unsigned long) #__ct__Q23std13allocatorFRCQ23std31allocator # std::allocator::!(const std::allocator&) #__ct__Q23std88allocator,Q23std12allocator>9CharArray>FRCQ23std12allocator # std::allocator, std::allocator>::CharArray>::!(const std::allocator&) #__ct__Q23std88allocator,Q23std12allocator>9CharArray>FRCQ23std12allocator # std::allocator, std::allocator>::CharArray>::!(const std::allocator&) #what__Q23std13runtime_errorCFv # std::runtime_error::what() const #__dt__Q23std8ctypeFv # std::ctype::~ctype() #__dt__Q23std15ctype_bynameFv # std::ctype_byname::~ctype_byname() #__dt__Q23std14codecvtFv # std::codecvt::~codecvt() #__dt__Q23std14codecvtFv # std::codecvt::~codecvt() #do_falsename__Q23std11numpunctCFv # std::numpunct::do_falsename() const #do_truename__Q23std11numpunctCFv # std::numpunct::do_truename() const #do_grouping__Q23std11numpunctCFv # std::numpunct::do_grouping() const #do_thousands_sep__Q23std11numpunctCFv # std::numpunct::do_thousands_sep() const #do_decimal_point__Q23std11numpunctCFv # std::numpunct::do_decimal_point() const #__dt__Q23std11numpunctFv # std::numpunct::~numpunct() #do_falsename__Q23std11numpunctCFv # std::numpunct::do_falsename() const #do_truename__Q23std11numpunctCFv # std::numpunct::do_truename() const #do_grouping__Q23std11numpunctCFv # std::numpunct::do_grouping() const #do_thousands_sep__Q23std11numpunctCFv # std::numpunct::do_thousands_sep() const #do_decimal_point__Q23std11numpunctCFv # std::numpunct::do_decimal_point() const #__dt__Q23std11numpunctFv # std::numpunct::~numpunct() #__dt__Q23std12timepunctFv # std::timepunct::~timepunct() #__dt__Q23std12timepunctFv # std::timepunct::~timepunct() #do_neg_format__Q23std15moneypunctCFv # std::moneypunct::do_neg_format() const #do_pos_format__Q23std15moneypunctCFv # std::moneypunct::do_pos_format() const #do_frac_digits__Q23std15moneypunctCFv # std::moneypunct::do_frac_digits() const #do_negative_sign__Q23std15moneypunctCFv # std::moneypunct::do_negative_sign() const #do_positive_sign__Q23std15moneypunctCFv # std::moneypunct::do_positive_sign() const #do_curr_symbol__Q23std15moneypunctCFv # std::moneypunct::do_curr_symbol() const #do_grouping__Q23std15moneypunctCFv # std::moneypunct::do_grouping() const #do_thousands_sep__Q23std15moneypunctCFv # std::moneypunct::do_thousands_sep() const #do_decimal_point__Q23std15moneypunctCFv # std::moneypunct::do_decimal_point() const #__dt__Q23std15moneypunctFv # std::moneypunct::~moneypunct() #do_neg_format__Q23std15moneypunctCFv # std::moneypunct::do_neg_format() const #do_pos_format__Q23std15moneypunctCFv # std::moneypunct::do_pos_format() const #do_frac_digits__Q23std15moneypunctCFv # std::moneypunct::do_frac_digits() const #do_negative_sign__Q23std15moneypunctCFv # std::moneypunct::do_negative_sign() const #do_positive_sign__Q23std15moneypunctCFv # std::moneypunct::do_positive_sign() const #do_curr_symbol__Q23std15moneypunctCFv # std::moneypunct::do_curr_symbol() const #do_grouping__Q23std15moneypunctCFv # std::moneypunct::do_grouping() const #do_thousands_sep__Q23std15moneypunctCFv # std::moneypunct::do_thousands_sep() const #do_decimal_point__Q23std15moneypunctCFv # std::moneypunct::do_decimal_point() const #__dt__Q23std15moneypunctFv # std::moneypunct::~moneypunct() #__dt__Q23std88allocator,Q23std12allocator>9CharArray>Fv # std::allocator, std::allocator>::CharArray>::~allocator() #__dt__Q23std192_EmptyMemberOpt,Q23std12allocator>9CharArray>,PQ33std59basic_string,Q23std12allocator>9CharArray>Fv # std::_EmptyMemberOpt, std::allocator>::CharArray>, std::basic_string, std::allocator>::CharArray*>::~_EmptyMemberOpt() #__ct__Q23std59basic_string,Q23std12allocator>FUlwRCQ23std12allocator # std::basic_string, std::allocator>::basic_string(unsigned long,wchar_t,const std::allocator&) #do_neg_format__Q23std15moneypunctCFv # std::moneypunct::do_neg_format() const #do_pos_format__Q23std15moneypunctCFv # std::moneypunct::do_pos_format() const #do_frac_digits__Q23std15moneypunctCFv # std::moneypunct::do_frac_digits() const #do_negative_sign__Q23std15moneypunctCFv # std::moneypunct::do_negative_sign() const #do_positive_sign__Q23std15moneypunctCFv # std::moneypunct::do_positive_sign() const #do_curr_symbol__Q23std15moneypunctCFv # std::moneypunct::do_curr_symbol() const #do_grouping__Q23std15moneypunctCFv # std::moneypunct::do_grouping() const #do_thousands_sep__Q23std15moneypunctCFv # std::moneypunct::do_thousands_sep() const #do_decimal_point__Q23std15moneypunctCFv # std::moneypunct::do_decimal_point() const #__dt__Q23std15moneypunctFv # std::moneypunct::~moneypunct() #__dt__Q23std88allocator,Q23std12allocator>9CharArray>Fv # std::allocator, std::allocator>::CharArray>::~allocator() #__dt__Q23std192_EmptyMemberOpt,Q23std12allocator>9CharArray>,PQ33std59basic_string,Q23std12allocator>9CharArray>Fv # std::_EmptyMemberOpt, std::allocator>::CharArray>, std::basic_string, std::allocator>::CharArray*>::~_EmptyMemberOpt() #__ct__Q23std59basic_string,Q23std12allocator>FUlcRCQ23std12allocator # std::basic_string, std::allocator>::basic_string(unsigned long,char,const std::allocator&) #do_neg_format__Q23std15moneypunctCFv # std::moneypunct::do_neg_format() const #do_pos_format__Q23std15moneypunctCFv # std::moneypunct::do_pos_format() const #do_frac_digits__Q23std15moneypunctCFv # std::moneypunct::do_frac_digits() const #do_negative_sign__Q23std15moneypunctCFv # std::moneypunct::do_negative_sign() const #do_positive_sign__Q23std15moneypunctCFv # std::moneypunct::do_positive_sign() const #do_curr_symbol__Q23std15moneypunctCFv # std::moneypunct::do_curr_symbol() const #do_grouping__Q23std15moneypunctCFv # std::moneypunct::do_grouping() const #do_thousands_sep__Q23std15moneypunctCFv # std::moneypunct::do_thousands_sep() const #do_decimal_point__Q23std15moneypunctCFv # std::moneypunct::do_decimal_point() const #__dt__Q23std15moneypunctFv # std::moneypunct::~moneypunct() #__two_exp__3stdFs # std::__two_exp(short) #__amu__Q23std4_BCDFQ23std4_BCD # std::_BCD::operator *=(std::_BCD) #__apl__Q23std4_BCDFQ23std4_BCD # std::_BCD::operator +=(std::_BCD) #__ct__Q23std4_BCDFPCci # std::_BCD::_BCD(const char*,int) #to_string__Q23std4_BCDCFiRi # std::_BCD::to_string(int,int&) const #__ct__Q23std4_BCDFri # std::_BCD::_BCD(long double,int) #__dt__Q23std4_BCDFv # std::_BCD::~_BCD() #__ct__Q23std15moneypunctFUl # std::moneypunct::moneypunct(unsigned long) #__ct__Q23std15moneypunctFUl # std::moneypunct::moneypunct(unsigned long) #__ct__Q23std15moneypunctFUl # std::moneypunct::moneypunct(unsigned long) #__ct__Q23std15moneypunctFUl # std::moneypunct::moneypunct(unsigned long) #do_am_pm__Q23std12timepunctCFi # std::timepunct::do_am_pm(int) const #do_month_name__Q23std12timepunctCFUl # std::timepunct::do_month_name(unsigned long) const #do_weekday_name__Q23std12timepunctCFUl # std::timepunct::do_weekday_name(unsigned long) const #__ct__Q23std12timepunctFUl # std::timepunct::timepunct(unsigned long) #do_am_pm__Q23std12timepunctCFi # std::timepunct::do_am_pm(int) const #do_month_name__Q23std12timepunctCFUl # std::timepunct::do_month_name(unsigned long) const #do_weekday_name__Q23std12timepunctCFUl # std::timepunct::do_weekday_name(unsigned long) const #__ct__Q23std12timepunctFUl # std::timepunct::timepunct(unsigned long) #__ct__Q23std11numpunctFUl # std::numpunct::numpunct(unsigned long) #__ct__Q23std11numpunctFUl # std::numpunct::numpunct(unsigned long) #do_in__Q23std14codecvtCFRiPCcPCcRPCcPwPwRPw # std::codecvt::do_in(int&,const char*,const char*,const char*&,wchar_t*,wchar_t*,wchar_t*&) const #do_out__Q23std14codecvtCFRiPCwPCwRPCwPcPcRPc # std::codecvt::do_out(int&,const wchar_t*,const wchar_t*,const wchar_t*&,char*,char*,char*&) const #__ct__Q23std14codecvtFUl # std::codecvt::codecvt(unsigned long) #do_nothing__Q23std14codecvtCFPCcPCcRPCcPcPcRPc # std::codecvt::do_nothing(const char*,const char*,const char*&,char*,char*,char*&) const #__ct__Q23std14codecvtFUl # std::codecvt::codecvt(unsigned long) #__ct__Q23std15ctype_bynameFPCcUl # std::ctype_byname::ctype_byname(const char*,unsigned long) #do_tolower__Q23std8ctypeCFPcPCc # std::ctype::do_tolower(char*,const char*) const #do_toupper__Q23std8ctypeCFPcPCc # std::ctype::do_toupper(char*,const char*) const #scan_not__Q23std8ctypeCFQ33std10ctype_base4maskPCcPCc # std::ctype::scan_not(std::ctype_base::mask,const char*,const char*) const #scan_is__Q23std8ctypeCFQ33std10ctype_base4maskPCcPCc # std::ctype::scan_is(std::ctype_base::mask,const char*,const char*) const #is__Q23std8ctypeCFPCcPCcPQ33std10ctype_base4mask # std::ctype::is(const char*,const char*,std::ctype_base::mask*) const #__dt__Q23std8ctypeFv # std::ctype::~ctype() #__ct__Q23std8ctypeFPCQ33std10ctype_base4maskbUl # std::ctype::ctype(const std::ctype_base::mask*,bool,unsigned long) #__dt__Q23std59basic_string,Q23std12allocator>Fv # std::basic_string, std::allocator>::~basic_string() #__dt__Q23std12allocatorFv # std::allocator::~allocator() #widen__Q23std8ctypeCFRCQ23std59basic_string,Q23std12allocator> # std::ctype::widen(const std::basic_string, std::allocator>&) const #classify__Q23std8ctypeCFw # std::ctype::classify(wchar_t) const #do_narrow__Q23std8ctypeCFPCwPCwcPc # std::ctype::do_narrow(const wchar_t*,const wchar_t*,char,char*) const #do_widen__Q23std8ctypeCFPCcPCcPw # std::ctype::do_widen(const char*,const char*,wchar_t*) const #do_tolower__Q23std8ctypeCFPwPCw # std::ctype::do_tolower(wchar_t*,const wchar_t*) const #do_toupper__Q23std8ctypeCFPwPCw # std::ctype::do_toupper(wchar_t*,const wchar_t*) const #do_scan_not__Q23std8ctypeCFQ33std10ctype_base4maskPCwPCw # std::ctype::do_scan_not(std::ctype_base::mask,const wchar_t*,const wchar_t*) const #do_scan_is__Q23std8ctypeCFQ33std10ctype_base4maskPCwPCw # std::ctype::do_scan_is(std::ctype_base::mask,const wchar_t*,const wchar_t*) const #do_is__Q23std8ctypeCFPCwPCwPQ33std10ctype_base4mask # std::ctype::do_is(const wchar_t*,const wchar_t*,std::ctype_base::mask*) const #__as__Q33std6locale3impFRCQ33std6locale3imp # std::locale::imp::operator =(const std::locale::imp&) #__dt__Q33std6locale3impFv # std::locale::imp::~imp() #__ct__Q33std6locale3impFRCQ33std6locale3imp # std::locale::imp::imp(const std::locale::imp&) #__dt__Q23std32vector>Fv # std::vector>::~vector() #__dt__Q23std68vector>Fv # std::vector>::~vector() #__dt__Q23std31allocatorFv # std::allocator::~allocator() #__dt__Q23std13allocatorFv # std::allocator::~allocator() #__dt__Q23std41_EmptyMemberOpt,Ul>Fv # std::_EmptyMemberOpt, unsigned long>::~_EmptyMemberOpt() #__ct__Q33std6locale3impFUl # std::locale::imp::imp(unsigned long) #__dt__Q33std6locale5facetFv # std::locale::facet::~facet() #make_classic__Q23std6localeFv # std::locale::make_classic() #__ct__Q23std6localeFRC62_RefCountedPtr> # std::locale::locale(const _RefCountedPtr>&) #classic__Q23std6localeFv # std::locale::classic() #global__Q23std6localeFRCQ23std6locale # std::locale::global(const std::locale&) #name__Q23std6localeCFv # std::locale::name() const #__as__Q23std6localeFRCQ23std6locale # std::locale::operator =(const std::locale&) #__ct__Q23std6localeFRCQ23std6localeRCQ23std6localei # std::locale::locale(const std::locale&,const std::locale&,int) #__dt__Q23std6localeFv # std::locale::~locale() #__ct__Q23std6localeFRCQ23std6localePCci # std::locale::locale(const std::locale&,const char*,int) #__dt__Q23std10_MSLstringFv # std::_MSLstring::~_MSLstring() #__dt__Q23std12allocatorFv # std::allocator::~allocator() #__dt__Q23std59basic_string,Q23std12allocator>Fv # std::basic_string, std::allocator>::~basic_string() #__ct__Q23std6localeFPCc # std::locale::locale(const char*) #__dt__Q23std13runtime_errorFv # std::runtime_error::~runtime_error() #__ct__Q23std6localeFRCQ23std6locale # std::locale::locale(const std::locale&) #__dt__62_RefCountedPtr>Fv # _RefCountedPtr>::~_RefCountedPtr() #__ct__Q23std6localeFv # std::locale::locale() #__ct__28_RefCountedPtr>FPc # _RefCountedPtr>::_RefCountedPtr(char*) #__as__28_RefCountedPtr>FRC28_RefCountedPtr> # _RefCountedPtr>::operator =(const _RefCountedPtr>&) #__ct__Q23std10_MSLstringFRCQ23std59basic_string,Q23std12allocator> # std::_MSLstring::_MSLstring(const std::basic_string, std::allocator>&) #__vt__Q33std8ios_base7failure # std::ios_base::failure::__vt #__vt__Q23std8ios_base # std::ios_base::__vt #what__Q33std8ios_base7failureCFv # std::ios_base::failure::what() const #throwfailure__Q23std8ios_baseFv # std::ios_base::throwfailure() #__dt__Q33std8ios_base7failureFv # std::ios_base::failure::~failure() #__dt__Q23std8ios_baseFv # std::ios_base::~ios_base() #__ct__Q23std8ios_baseFv # std::ios_base::ios_base() #register_callback__Q23std8ios_baseFPFQ33std8ios_base5eventRQ23std8ios_basei_vi # std::ios_base::register_callback(void (*)(std::ios_base::event, std::ios_base&, int),int) #__ct__Q23std50pairFv # std::pair::pair() #pword__Q23std8ios_baseFi # std::ios_base::pword(int) #iword__Q23std8ios_baseFi # std::ios_base::iword(int) #getloc__Q23std8ios_baseCFv # std::ios_base::getloc() const #imbue__Q23std8ios_baseFRCQ23std6locale # std::ios_base::imbue(const std::locale&) #__vt__Q23std12strstreambuf # std::strstreambuf::__vt #init__Q23std12strstreambufFPciPc # std::strstreambuf::init(char*,int,char*) #setbuf__Q23std12strstreambufFPci # std::strstreambuf::setbuf(char*,int) #seekpos__Q23std12strstreambufFQ23std7fposs # std::strstreambuf::seekpos(std::fpos,short) #seekoff__Q23std12strstreambufFlQ33std8ios_base7seekdirs # std::strstreambuf::seekoff(long,std::ios_base::seekdir,short) #underflow__Q23std12strstreambufFv # std::strstreambuf::underflow() #pbackfail__Q23std12strstreambufFi # std::strstreambuf::pbackfail(int) #overflow__Q23std12strstreambufFi # std::strstreambuf::overflow(int) #freeze__Q23std12strstreambufFb # std::strstreambuf::freeze(bool) #__dt__Q23std12strstreambufFv # std::strstreambuf::~strstreambuf() #__console_exit #__stdio_exit #__aborting #__exit #exit #__atexit #atexit #abort #__malloc_pool #free #realloc #calloc #malloc #__files #__num_to_file #__file_to_num #__flush_line_buffered_output_files #__flush_all #__close_all #__init_file #__find_unopened_file #__llmod #__lmod #__mod #__lldiv #__ldiv #__div #__llmul #__lmul #__mul #__lladd #__ladd #__add #lldiv #ldiv #div #llabs #labs #abs #__assertion_failed #bsearch #setbuf #setvbuf #__flush_buffer #__load_buffer #__prep_buffer #__convert_to_newlines #__convert_from_newlines #puts #fputs #putchar #putc #fputc #__put_char #__ungotten #ungetc #gets #fgets #getchar #getc #fgetc #__get_char #__ctype_map #__lower_map #__upper_map #toupper #tolower #isxdigit #isupper #isspace #ispunct #isprint #islower #isgraph #isdigit #iscntrl #isalpha #isalnum #fwrite #fread #errno #__temp_file_mode #__set_idle_proc #__get_file_modes #__handle_reopen #__handle_open #freopen #fopen #fflush #fclose #tmpfile #tmpnam #rename #remove #rewind #fsetpos #fseek #_fseek #fgetpos #ftell #_ftell #__float_nan #__float_huge #__double_min #__double_max #__double_epsilon #__double_tiny #__double_huge #__double_nan #__extended_min #__extended_max #__extended_epsilon #__extended_tiny #__extended_huge #__extended_nan #__lconv #localeconv #setlocale #wcstombs #mbstowcs #wctomb #mbtowc #mblen #memcmp #__memrchr #memchr #memset #memmove #memcpy #__fill_mem #__copy_longs_rev_unaligned #__copy_longs_unaligned #__copy_longs_rev_aligned #__copy_longs_aligned #__move_mem #__copy_mem #__stdio_atexit #perror #ferror #feof #clearerr #__pool_free_all #__pool_free #__pool_realloc #__pool_alloc_clear #__pool_alloc #__pool_preassign #__pool_preallocate #__init_pool_obj #sprintf #snprintf #vsprintf #vsnprintf #printf #vprintf #fprintf #vfprintf #qsort #srand #rand #sscanf #__vsscanf #scanf #fscanf #__vfscanf #raise #signal #__strerror #strerror #strstr #strtok #strcspn #strspn #strpbrk #strrchr #strxfrm #strcoll #strchr #strncmp #strcmp #strncat #strcat #strncpy #strcpy #strlen #__close_string #__write_string #__read_string #__open_string_file #atof #strtod #__strtold #strtoumax #strtoimax #atol #atoi #strtoll #strtol #strtoull #strtoul #__strtoull #__strtoul #system #getenv #__month_to_days #strftime #localtime #gmtime #ctime #asctime #time #mktime #difftime #clock #__leap_year #ccommand #clrscr #__close_console #__write_console #__read_console #__end_critical_region #__begin_critical_region #__kill_critical_regions #__init_critical_regions #fcntl #creat #open #__rename_file #__delete_file #__temp_file_name #__close_file #__position_file #__write_file #__read_file #__open_temp_file #__open_file #__path2fss #__sys_free #__sys_alloc #mkdir #fstat #stat #__to_gm_time #__get_time #__get_clock #write #unlink #ttyname #sleep #rmdir #read #lseek #isatty #getlogin #getcwd #exec #cuserid #close #chdir #_ftype #_fcreator #tell #fdopen #fileno #__gettype #__getcreator #__ctopstring #__system7present #__myraise #utimes #utime #uname #fwide #fgetws #fputws #ungetwc #fgetwc #getwchar #getwc #fputwc #putwchar #putwc #watof #wcstod #__wcstold #wcstoumax #wcstoimax #watol #watoi #wcstoll #wcstol #wcstoull #wcstoul #__wcstoull #__wcstoul #wctrans #towctrans #__wctype_map #__wlower_map #__wupper_map #iswctype #wctype #wctob #towupper #towlower #iswxdigit #iswupper #iswspace #iswpunct #iswprint #iswlower #iswgraph #iswdigit #iswcntrl #iswalpha #iswalnum #wmemcmp #wmemchr #wmemset #wmemmove #wmemcpy #swprintf #vwprintf #vswprintf #wprintf #fwprintf #vfwprintf #swscanf #__vswscanf #vwscanf #wscanf #fwscanf #__vfwscanf #wcsstr #wcstok #wcscspn #wcsspn #wcspbrk #wcsrchr #wcsxfrm #wcscoll #wcschr #wcsncmp #wcscmp #wcsncat #wcscat #wcsncpy #wcscpy #wcslen #wcsftime #wctime #wasctime #ValidateMallocHeap #GetNextMallocHeapRegistration #GetFirstMallocHeapRegistration #UnregisterMallocHeap #RegisterMallocHeap #__fminl #__fmaxl #__fdiml #__nextafterl #__remquol #__copysignl #__remainderl #__fmodl #__modfl #__truncl #llroundl #lroundl #__roundl #llrintl #lrintl #__rintl #__nearbyintl #__floorl #__ceill #__lgammal #__gammal #__erfcl #__erfl #__hypotl #__sqrtl #__powl #__fabsl #scalblnl #scalbnl #__logbl #__log2l #__log1pl #__expm1l #__exp2l #__log10l #__logl #__ldexpl #__frexpl #__expl #__atanhl #__asinhl #__acoshl #__tanhl #__sinhl #__coshl #__tanl #__sinl #__cosl #__atan2l #__atanl #__asinl #__acosl #fminf #fmaxf #fdimf #remquof #copysignf #remainderf #fmodf #truncf #llroundf #lroundf #roundf #llrintf #lrintf #rintf #nearbyintf #floorf #ceilf #lgammaf #gammaf #erfcf #erff #hypotf #sqrtf #powf #fabsf #scalblnf #scalbnf #logbf #log2f #log1pf #expm1f #exp2f #log10f #logf #ldexpf #frexpf #expf #atanhf #asinhf #acoshf #tanhf #sinhf #coshf #tanf #sinf #cosf #atan2f #atanf #asinf #acosf #nextafter #llround #lround #llrint #lrint #scalbln #scalbn #__dc_arr #__del_arr #__new_arr #__init_arr #__copy #__som_check_ev #__som_check_new #__vt__Q23std13bad_exception # std::bad_exception::__vt #what__Q23std13bad_exceptionCFv # std::bad_exception::what() const #__end__catch #__throw #__ct__Q23std9exceptionFv # std::exception::exception() #__unexpected #__dt__Q23std13bad_exceptionFv # std::bad_exception::~bad_exception() #__unregister_fragment #__register_fragment #__global_destructor_chain #__destroy_global_chain #__register_global_object #__destroy_new_array2 #__destroy_new_array #__destroy_arr #__construct_array #__dt__26__partial_array_destructorFv # __partial_array_destructor::~__partial_array_destructor() #__construct_new_array #__throw_catch_compare #unexpected__3stdFv # std::unexpected() #set_unexpected__3stdFPFv_v # std::set_unexpected(void (*)(void)) #terminate__3stdFv # std::terminate() #set_terminate__3stdFPFv_v # std::set_terminate(void (*)(void)) #__vt__Q23std10bad_typeid # std::bad_typeid::__vt #what__Q23std10bad_typeidCFv # std::bad_typeid::what() const #__dynamic_cast #__get_typeid #__dt__Q23std10bad_typeidFv # std::bad_typeid::~bad_typeid() #nothrow__3std # std::nothrow #__dla__FPv # operator delete[](void*) #__nwa__FUlRCQ23std9nothrow_t # operator new[](unsigned long,const std::nothrow_t&) #__nwa__FUl # operator new[](unsigned long) #__dl__FPv # operator delete(void*) #__nw__FUlRCQ23std9nothrow_t # operator new(unsigned long,const std::nothrow_t&) #__nw__FUl # operator new(unsigned long) #_prealloc_newpool__3stdFUl # std::_prealloc_newpool(unsigned long) #_set_newnonptrmax__3stdFUl # std::_set_newnonptrmax(unsigned long) #_set_newpoolsize__3stdFUl # std::_set_newpoolsize(unsigned long) #__throws_bad_alloc__3std # std::__throws_bad_alloc #__new_handler__3std # std::__new_handler #__del_hdl #__new_hdl #set_new_handler__3stdFPFv_v # std::set_new_handler(void (*)(void)) #__throw_bad_alloc__3stdFv # std::__throw_bad_alloc() #qd #__terminate #__initialize #__start #__ptmf_null \ No newline at end of file diff --git a/libical/MacOS/libical_prefix.h b/libical/MacOS/libical_prefix.h deleted file mode 100644 index 0810563119..0000000000 --- a/libical/MacOS/libical_prefix.h +++ /dev/null @@ -1,5 +0,0 @@ -/* libical_prefix.h */ - -#include -#define _TIME_T -#include "errno.h" \ No newline at end of file diff --git a/libical/MacOS/restrictions.make b/libical/MacOS/restrictions.make deleted file mode 100644 index dd146f5ed3..0000000000 --- a/libical/MacOS/restrictions.make +++ /dev/null @@ -1 +0,0 @@ -#pseudo target all Ä {libical_c_src}parameterrestrictions.inc {libical_c_src}restrictionrecords.inc # Generate source file {libical_c_src}parameterrestrictions.inc Ä ¶ {libical_scripts}mkparameterrestrictions.pl ¶ {libical_data}params-in-prop.txt ¶ {libical_project}restrictions.make perl {libical_scripts}mkparameterrestrictions.pl {libical_data}params-in-prop.txt ¶ > {libical_c_src}parameterrestrictions.inc # Set file creator to CodeWarrior setfile {libical_c_src}parameterrestrictions.inc -c CWIE # Generate source file {libical_c_src}restrictionrecords.inc Ä ¶ {libical_scripts}mkrestrictionrecords.pl ¶ {libical_data}restrictions.csv ¶ {libical_project}restrictions.make perl {libical_scripts}mkrestrictionrecords.pl {libical_data}restrictions.csv ¶ > {libical_c_src}restrictionrecords.inc # Set file creator to CodeWarrior setfile {libical_c_src}restrictionrecords.inc -c CWIE \ No newline at end of file diff --git a/libical/MacOS/restrictions.script b/libical/MacOS/restrictions.script deleted file mode 100644 index ab719b87d5..0000000000 --- a/libical/MacOS/restrictions.script +++ /dev/null @@ -1 +0,0 @@ -directory {libical_project} # Generate source files make all -f restrictions.make > make.out make.out \ No newline at end of file diff --git a/libical/MacOS/strdup.c b/libical/MacOS/strdup.c deleted file mode 100644 index ae60fee3df..0000000000 --- a/libical/MacOS/strdup.c +++ /dev/null @@ -1,17 +0,0 @@ - -#include "strdup.h" -#include -#include - - -char *strdup(const char *s ) -{ - char *p; - - if ( (p = (char *) malloc( strlen( s ) + 1 )) == NULL ) - return( NULL ); - - strcpy( p, s ); - - return( p ); -} diff --git a/libical/MacOS/strdup.h b/libical/MacOS/strdup.h deleted file mode 100644 index 1bb73aa535..0000000000 --- a/libical/MacOS/strdup.h +++ /dev/null @@ -1,3 +0,0 @@ -/* strdup.h */ - -char * strdup(const char *str); diff --git a/libical/Makefile.am b/libical/Makefile.am deleted file mode 100644 index 9cca9b6582..0000000000 --- a/libical/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ - -EXTRA_DIST = \ - CHANGES \ - README \ - TEST \ - TODO - -SUBDIRS = src diff --git a/libical/README b/libical/README deleted file mode 100644 index 66c78995e1..0000000000 --- a/libical/README +++ /dev/null @@ -1,78 +0,0 @@ - -LIBICAL -- An implementation of basic iCAL protocols - -The code and datafiles in this distribution are licensed under the -Mozilla Public License. See http://www.mozilla.org/NPL/MPL-1.0.html -for a copy of the license. Alternately, you may use libical under the -terms of the GNU Library General Public License. See -http://www.fsf.org/copyleft/lesser.html for a copy of the LGPL. - -This dual license ensures that the library can be incorporated into -both proprietary code and GPL'd programs, and will benefit from -improvements made by programmers in both realms. I will only accept -changes into my version of the library if they are similarly -dual-licensed. - -The code in this distribution implements the iCal protocols as -described in RFC2445 and RFC2446. The code is in very early stages of -development. - -This code is under active development. If you would like to contribute -to the project, you can contact me, Eric Busboom, at -eric@softwarestudio.org. The project has a webpage at - - http://softwarestudio.org/libical/index.html - -and a mailing list that you can join by sending the following mail: - - ------------ - To: minimalist@softwarestudio.org - Subject: subscribe libical - ------------ - - -Building the library --------------------- - -This distribution is developed on Red Hat Linux 6.0 and usually -compiles on SunOS 5.6 and FreeBSD 2.27. I have reports of success of -previous version on MacOS ( with CodeWarrior ) but I don't know about -any other systems. - -The library is configured with automake. From the root directory, run - - ./configure - -To build all of the Makefiles for your system. If you will be installing the library, you may want to use the --prefix flag to set the directory where the library and header files will be installed. - - ./configure --prefix=/proj/local/ - -If configure runs fine, run "make" to build the library and -"make install" to install it. - -The current version of libical focuses on creating and -manipulating iCal objects. With it, you can parse text representations -of iCal components, add and remove sub-components, properties, -parameters and values, and print the components back out as strings. - -Perl Library ------------- - -There is a perl language binding of this library, LIBICAL. It is available from CPAN. or from http://www.softwarestudio.org/libical - -Parser ------- - -The parser is a test program that will convert a text representation -of an iCal object to the internal representation and print it back out -as text. It is primarily a test tool, but it is also a good -demonstration of how the library works. - -To use it, cat one of the test components into the parser -executable. For example, from the root of the distribution: - - src/test/icalparser < test-data/1.1 - - -Eric Busboom -eric@softwarestudio.org \ No newline at end of file diff --git a/libical/TEST b/libical/TEST deleted file mode 100644 index 90c3473b31..0000000000 --- a/libical/TEST +++ /dev/null @@ -1,4 +0,0 @@ - -Parser Tests ------------- -Use iCAL keywords as first words of unquoted strings \ No newline at end of file diff --git a/libical/TODO b/libical/TODO deleted file mode 100644 index feb723d244..0000000000 --- a/libical/TODO +++ /dev/null @@ -1,32 +0,0 @@ - -TODOs for libical-0.16 ---------------------- - -libical treats properties with multiple values incorrecty -- it always -seperates multiple values into multiple properties. This is not -acceptable for CATEGORIES and RESOURCES. - -Some TEXT valued properties, like METHOD, have a limited set of valid -values. The code should check that the values of these properites are -valid. ( Although METHOD now uses enums, and is not really TEXT valued ) - -Finish implementing values - ATTACH/BINARY - content_type - language - -Check for buffer overflow on external input. - -Error Handling - - Dates and times: the parser will accept many illegal date time - values - -RECUR values ignore integers in BYDAY clauses, ie 'FREQ=MONTHLY;BYDAY=-1SU' - -REQUEST-STATUS propery is broken. The parser treats the value as -normal text, backslashing the ';' seperators. - -Some of the X-LIC-ERROR types overlap with REQUEST-STATUS -values. There should be a routine to turn property, parameter and -value parse errors into REQUEST-STATUS diff --git a/libical/configure.scan b/libical/configure.scan deleted file mode 100644 index c07a9f6bf8..0000000000 --- a/libical/configure.scan +++ /dev/null @@ -1,30 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. -AC_INIT(src/comp-cc/usecases.cc) - -dnl Checks for programs. -AC_PROG_YACC -AC_PROG_CC -AC_PROG_LEX -AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_RANLIB - -dnl Checks for libraries. -dnl Replace `main' with a function in -lical: -AC_CHECK_LIB(ical, main) - -dnl Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h limits.h malloc.h unistd.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_OFF_T -AC_TYPE_SIZE_T -AC_STRUCT_TM - -dnl Checks for library functions. -AC_CHECK_FUNCS(mkdir strdup uname) - -AC_OUTPUT(src/libicalss/Makefile src/test/Makefile src/libical/Makefile src/Makefile src/pvl/Makefile src/comp-cc/Makefile Makefile) diff --git a/libical/design-data/components.txt b/libical/design-data/components.txt deleted file mode 100644 index 709c74ce13..0000000000 --- a/libical/design-data/components.txt +++ /dev/null @@ -1,20 +0,0 @@ -VCALENDAR -VEVENT -VTODO -VJOURNAL -VFREEBUSY -VTIMEZONE -XSTANDARDTIME -XDAYLIGHTSAVINGSTIME -VALARM -XAUDIOALARM -XDISPLAYALARM -XEMAILALARM -XPROCEDUREALARM -X -VSCHEDULE -VQUERY -VCAR -VCOMMAND -XLICINVALID - diff --git a/libical/design-data/param-c-types.txt b/libical/design-data/param-c-types.txt deleted file mode 100644 index d2f28e688a..0000000000 --- a/libical/design-data/param-c-types.txt +++ /dev/null @@ -1,23 +0,0 @@ -ALTREP char* -CN char* -CUTYPE icalparameter_cutype -DELEGATED-FROM char* -DELEGATED-TO char* -DIR char* -ENCODING icalparameter_encoding -FBTYPE icalparameter_fbtype -FMTTYPE char* -LANGUAGE char* -MEMBER char* -PARTSTAT icalparameter_partstat -RANGE icalparameter_range -RELATED icalparameter_related -RELTYPE icalparameter_reltype -ROLE icalparameter_role -RSVP int -SENT-BY char* -TZID char* -VALUE icalparameter_value -X char* -X-LIC-ERRORTYPE icalparameter_xlicerrortype -X-LIC-COMPARETYPE icalparameter_xliccomparetype diff --git a/libical/design-data/params-in-prop.txt b/libical/design-data/params-in-prop.txt deleted file mode 100644 index 4d4e133fc3..0000000000 --- a/libical/design-data/params-in-prop.txt +++ /dev/null @@ -1,55 +0,0 @@ -ACTION VALUE X -ATTACH FMTTYPE ENCODING VALUE X -ATTENDEE CN CUTYPE DELEGATED-FROM DELEGATED-TO DIR LANGUAGE MEMBER PARTSTAT ROLE RSVP SENT-BY X -CALSCALE X -CATEGORIES LANGUAGE X -CLASS X -COMMENT ALTREP LANGUAGE X -COMPLETED X -CONTACT ALTREP LANGUAGE X -CREATED X -DESCRIPTION ALTREP LANGUAGE X -DTEND VALUE TZID X -DTSTAMP X -DTSTART VALUE TZID X -DUE VALUE TZID X -DURATION X -EXDATE VALUE TZID X -EXRULE X -FREEBUSY FBTYPE X -GEO X -LAST-MODIFIED X -LOCATION ALTREP LANGUAGE X -METHOD X -ORGANIZER CN DIR LANGUAGE SENT-BY X -PERCENT-COMPLETE X -PRIORITY X -PRODID X -RDATE VALUE TZID X -RECURRENCE-ID VALUE RANGE TZID X -RELATED-TO RELTYPE X -REPEAT X -REQUEST-STATUS LANGUAGE X -RESOURCES ALTREP LANGUAGE X -RRULE X -SEQUENCE X -STATUS X -SUMMARY ALTREP LANGUAGE X -TRANSP X -TRIGGER VALUE RELATED X -TZID X -TZNAME LANGUAGE X -TZOFFSETFROM X -TZOFFSETTO X -TZURL X -UID X -URL X -VERSION X -XPROP LANGUAGE X -X-LIC-ERROR XLICEERRORTYPE X -SCOPE X -MAXRESULTS X -MAXRESULTSSIZE X -QUERY X -QUERYNAME X -TARGET X \ No newline at end of file diff --git a/libical/design-data/prop-to-value.txt b/libical/design-data/prop-to-value.txt deleted file mode 100644 index 58a40c26cb..0000000000 --- a/libical/design-data/prop-to-value.txt +++ /dev/null @@ -1,50 +0,0 @@ -CALSCALE TEXT -METHOD METHOD # Non-std. RFC2445 specifies TEXT -PRODID TEXT -VERSION TEXT -CATEGORIES TEXT -CLASS TEXT -COMMENT TEXT -DESCRIPTION TEXT -LOCATION TEXT -PERCENT-COMPLETE INTEGER -PRIORITY INTEGER -RESOURCES TEXT -STATUS TEXT -SUMMARY TEXT -COMPLETED DATE-TIME -FREEBUSY PERIOD -TRANSP TEXT -TZNAME TEXT -TZOFFSETFROM UTC-OFFSET -TZOFFSETTO UTC-OFFSET -TZURL URI -TZID TEXT -ATTENDEE CAL-ADDRESS -CONTACT TEXT -ORGANIZER CAL-ADDRESS -RELATED-TO TEXT -URL URI -UID TEXT -EXRULE RECUR -RRULE RECUR -ACTION TEXT -REPEAT INTEGER -CREATED DATE-TIME -DTSTAMP DATE-TIME -LAST-MODIFIED DATE-TIME -SEQUENCE INTEGER -X-LIC-ERROR TEXT -X-LIC-CLUSTERCOUNT INTEGER -REQUEST-STATUS TEXT -ATTACH ATTACH # Non-std: URI or BINARY -GEO GEO # Non-std: Two FLOATS -DTEND DATE-TIME-DATE # Non-std: DATE-TIME or DATE -DUE DATE-TIME-DATE # Non-std: DATE-TIME or DATE -DTSTART DATE-TIME-DATE # Non-std: DATE-TIME or DATE -RECURRENCE-ID DATE-TIME-DATE # Non-std: DATE-TIME or DATE -EXDATE DATE-TIME-DATE # Non-std: DATE-TIME or DATE -RDATE DATE-TIME-PERIOD # Non-std: DATE-TIME or DATE or PERIOD -TRIGGER TRIGGER # Non-std: DURATION or DATE-TIME -DURATION DURATION -QUERY QUERY diff --git a/libical/design-data/property-tokens.txt b/libical/design-data/property-tokens.txt deleted file mode 100644 index f8a95861c4..0000000000 --- a/libical/design-data/property-tokens.txt +++ /dev/null @@ -1,65 +0,0 @@ -8BIT -ACCEPTED -ADD -AUDIO -BASE64 -BINARY -BOOLEAN -BUSY -BUSY-TENTATIVE -BUSY-UNAVAILABLE -CAL-ADDRESS -CANCEL -CANCELLED -CHAIR -CHILD -COMPLETED -CONFIDENTIAL -CONFIRMED -COUNTER -DATE -DATE-TIME -DECLINECOUNTER -DECLINED -DELEGATED -DISPLAY -DRAFT -DURATION -EMAIL -END -FINAL -FLOAT -FREE -GREGORIAN -GROUP -INDIVIDUAL -IN-PROCESS -INTEGER -NEEDS-ACTION -NON-PARTICIPANT -OPAQUE -OPT-PARTICIPANT -PARENT -PERIOD -PRIVATE -PROCEDURE -PUBLIC -PUBLISH -RECUR -REFRESH -REPLY -REQ-PARTICIPANT -REQUEST -RESOURCE -ROOM -SIBLING -START -TENTATIVE -TEXT -THISANDFUTURE -THISANDPRIOR -TIME -TRANSPAENT -UNKNOWN -UTCOFFSET -XNAME diff --git a/libical/design-data/restrictions.csv b/libical/design-data/restrictions.csv deleted file mode 100644 index e93f0a2a2a..0000000000 --- a/libical/design-data/restrictions.csv +++ /dev/null @@ -1,1348 +0,0 @@ -# Method, Target component, Property, Sub-component, Restriction -PUBLISH,VEVENT,NONE,NONE,ONEPLUS -PUBLISH,VEVENT,DTSTAMP,NONE,ONE -PUBLISH,VEVENT,DTSTART,NONE,ONE -PUBLISH,VEVENT,ORGANIZER,NONE,ONE -PUBLISH,VEVENT,SUMMARY,NONE,ONE -PUBLISH,VEVENT,UID,NONE,ONE -PUBLISH,VEVENT,RECURRENCEID,NONE,ZEROORONE -PUBLISH,VEVENT,SEQUENCE,NONE,ZEROORONE -PUBLISH,VEVENT,ATTACH,NONE,ZEROPLUS -PUBLISH,VEVENT,CATEGORIES,NONE,ZEROORONE -PUBLISH,VEVENT,CLASS,NONE,ZEROORONE -PUBLISH,VEVENT,COMMENT,NONE,ZEROORONE -PUBLISH,VEVENT,CONTACT,NONE,ZEROPLUS -PUBLISH,VEVENT,CREATED,NONE,ZEROORONE -PUBLISH,VEVENT,DESCRIPTION,NONE,ZEROORONE -PUBLISH,VEVENT,DTEND,NONE,ZEROORONE -PUBLISH,VEVENT,DURATION,NONE,ZEROORONE -PUBLISH,VEVENT,EXDATE,NONE,ZEROPLUS -PUBLISH,VEVENT,EXRULE,NONE,ZEROPLUS -PUBLISH,VEVENT,GEO,NONE,ZEROORONE -PUBLISH,VEVENT,LASTMODIFIED,NONE,ZEROORONE -PUBLISH,VEVENT,LOCATION,NONE,ZEROORONE -PUBLISH,VEVENT,PRIORITY,NONE,ZEROORONE -PUBLISH,VEVENT,RDATE,NONE,ZEROPLUS -PUBLISH,VEVENT,RELATEDTO,NONE,ZEROPLUS -PUBLISH,VEVENT,RESOURCES,NONE,ZEROORONE -PUBLISH,VEVENT,RRULE,NONE,ZEROPLUS -PUBLISH,VEVENT,STATUS,NONE,ZEROORONE -PUBLISH,VEVENT,TRANSP,NONE,ZEROORONE -PUBLISH,VEVENT,URL,NONE,ZEROORONE -PUBLISH,VEVENT,X,NONE,ZEROPLUS -PUBLISH,VEVENT,ATTENDEE,NONE,ZERO -PUBLISH,VEVENT,REQUESTSTATUS,NONE,ZERO -PUBLISH,VEVENT,NONE,VALARM,ZEROPLUS -PUBLISH,VEVENT,NONE,VFREEBUSY,ZERO -PUBLISH,VEVENT,NONE,VJOURNAL,ZERO -PUBLISH,VEVENT,NONE,VTODO,ZERO -PUBLISH,VEVENT,NONE,VTIMEZONE,ZEROPLUS -PUBLISH,VEVENT,NONE,X,ZEROPLUS -REQUEST,VEVENT,NONE,NONE,ONEPLUS -REQUEST,VEVENT,ATTENDEE,NONE,ONEPLUS -REQUEST,VEVENT,DTSTAMP,NONE,ONE -REQUEST,VEVENT,DTSTART,NONE,ONE -REQUEST,VEVENT,ORGANIZER,NONE,ONE -REQUEST,VEVENT,SEQUENCE,NONE,ZEROORONE -REQUEST,VEVENT,SUMMARY,NONE,ONE -REQUEST,VEVENT,UID,NONE,ONE -REQUEST,VEVENT,ATTACH,NONE,ZEROPLUS -REQUEST,VEVENT,CATEGORIES,NONE,ZEROORONE -REQUEST,VEVENT,CLASS,NONE,ZEROORONE -REQUEST,VEVENT,COMMENT,NONE,ZEROORONE -REQUEST,VEVENT,CONTACT,NONE,ZEROPLUS -REQUEST,VEVENT,CREATED,NONE,ZEROORONE -REQUEST,VEVENT,DESCRIPTION,NONE,ZEROORONE -REQUEST,VEVENT,DTEND,NONE,ONEEXCLUSIVE,icalrestriction_check_exclusive -REQUEST,VEVENT,DURATION,NONE,ONEEXCLUSIVE,icalrestriction_check_exclusive -REQUEST,VEVENT,EXDATE,NONE,ZEROPLUS -REQUEST,VEVENT,EXRULE,NONE,ZEROPLUS -REQUEST,VEVENT,GEO,NONE,ZEROORONE -REQUEST,VEVENT,LASTMODIFIED,NONE,ZEROORONE -REQUEST,VEVENT,LOCATION,NONE,ZEROORONE -REQUEST,VEVENT,PRIORITY,NONE,ZEROORONE -REQUEST,VEVENT,RDATE,NONE,ZEROPLUS -REQUEST,VEVENT,RECURRENCEID,NONE,ZEROORONE -REQUEST,VEVENT,RELATEDTO,NONE,ZEROPLUS -REQUEST,VEVENT,REQUESTSTATUS,NONE,ZEROPLUS -REQUEST,VEVENT,RESOURCES,NONE,ZEROORONE -REQUEST,VEVENT,RRULE,NONE,ZEROPLUS -REQUEST,VEVENT,STATUS,NONE,ZEROORONE -REQUEST,VEVENT,TRANSP,NONE,ZEROORONE -REQUEST,VEVENT,URL,NONE,ZEROORONE -REQUEST,VEVENT,X,NONE,ZEROPLUS -REQUEST,VEVENT,NONE,VALARM,ZEROPLUS -REQUEST,VEVENT,NONE,VTIMEZONE,ZEROPLUS -REQUEST,VEVENT,NONE,X,ZEROPLUS -REQUEST,VEVENT,NONE,VFREEBUSY,ZERO -REQUEST,VEVENT,NONE,VJOURNAL,ZERO -REQUEST,VEVENT,NONE,VTODO,ZERO -REPLY,VEVENT,NONE,NONE,ONEPLUS -REPLY,VEVENT,ATTENDEE,NONE,ONE -REPLY,VEVENT,DTSTAMP,NONE,ONE -REPLY,VEVENT,ORGANIZER,NONE,ONE -REPLY,VEVENT,RECURRENCEID,NONE,ZEROORONE -REPLY,VEVENT,UID,NONE,ONE -REPLY,VEVENT,SEQUENCE,NONE,ZEROORONE -REPLY,VEVENT,ATTACH,NONE,ZEROPLUS -REPLY,VEVENT,CATEGORIES,NONE,ZEROORONE -REPLY,VEVENT,CLASS,NONE,ZEROORONE -REPLY,VEVENT,COMMENT,NONE,ZEROORONE -REPLY,VEVENT,CONTACT,NONE,ZEROPLUS -REPLY,VEVENT,CREATED,NONE,ZEROORONE -REPLY,VEVENT,DESCRIPTION,NONE,ZEROORONE -REPLY,VEVENT,DTEND,NONE,ONEEXCLUSIVE,icalrestriction_check_exclusive -REPLY,VEVENT,DTSTART,NONE,ZEROORONE -REPLY,VEVENT,DURATION,NONE,ONEEXCLUSIVE,icalrestriction_check_exclusive -REPLY,VEVENT,EXDATE,NONE,ZEROPLUS -REPLY,VEVENT,EXRULE,NONE,ZEROPLUS -REPLY,VEVENT,GEO,NONE,ZEROORONE -REPLY,VEVENT,LASTMODIFIED,NONE,ZEROORONE -REPLY,VEVENT,LOCATION,NONE,ZEROORONE -REPLY,VEVENT,PRIORITY,NONE,ZEROORONE -REPLY,VEVENT,RDATE,NONE,ZEROPLUS -REPLY,VEVENT,RELATEDTO,NONE,ZEROPLUS -REPLY,VEVENT,RESOURCES,NONE,ZEROORONE -REPLY,VEVENT,REQUESTSTATUS,NONE,ZEROPLUS -REPLY,VEVENT,RRULE,NONE,ZEROPLUS -REPLY,VEVENT,STATUS,NONE,ZEROORONE -REPLY,VEVENT,SUMMARY,NONE,ZEROORONE -REPLY,VEVENT,TRANSP,NONE,ZEROORONE -REPLY,VEVENT,URL,NONE,ZEROORONE -REPLY,VEVENT,X,NONE,ZEROPLUS -REPLY,VEVENT,NONE,VTIMEZONE,ZEROORONE -REPLY,VEVENT,NONE,X,ZEROPLUS -REPLY,VEVENT,NONE,VALARM,ZERO -REPLY,VEVENT,NONE,VFREEBUSY,ZERO -REPLY,VEVENT,NONE,VJOURNAL,ZERO -REPLY,VEVENT,NONE,VTODO,ZERO -ADD,VEVENT,NONE,NONE,ONE -ADD,VEVENT,DTSTAMP,NONE,ONE -ADD,VEVENT,DTSTART,NONE,ONE -ADD,VEVENT,ORGANIZER,NONE,ONE -ADD,VEVENT,SEQUENCE,NONE,ONE -ADD,VEVENT,SUMMARY,NONE,ONE -ADD,VEVENT,UID,NONE,ONE -ADD,VEVENT,ATTACH,NONE,ZEROPLUS -ADD,VEVENT,ATTENDEE,NONE,ZEROPLUS -ADD,VEVENT,CATEGORIES,NONE,ZEROORONE -ADD,VEVENT,CLASS,NONE,ZEROORONE -ADD,VEVENT,COMMENT,NONE,ZEROORONE -ADD,VEVENT,CONTACT,NONE,ZEROPLUS -ADD,VEVENT,CREATED,NONE,ZEROORONE -ADD,VEVENT,DESCRIPTION,NONE,ZEROORONE -ADD,VEVENT,DTEND,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -ADD,VEVENT,DURATION,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -ADD,VEVENT,EXDATE,NONE,ZEROPLUS -ADD,VEVENT,EXRULE,NONE,ZEROPLUS -ADD,VEVENT,GEO,NONE,ZEROORONE -ADD,VEVENT,LASTMODIFIED,NONE,ZEROORONE -ADD,VEVENT,LOCATION,NONE,ZEROORONE -ADD,VEVENT,PRIORITY,NONE,ZEROORONE -ADD,VEVENT,RDATE,NONE,ZEROPLUS -ADD,VEVENT,RELATEDTO,NONE,ZEROPLUS -ADD,VEVENT,RESOURCES,NONE,ZEROORONE -ADD,VEVENT,RRULE,NONE,ZEROPLUS -ADD,VEVENT,STATUS,NONE,ZEROORONE -ADD,VEVENT,TRANSP,NONE,ZEROORONE -ADD,VEVENT,URL,NONE,ZEROORONE -ADD,VEVENT,X,NONE,ZEROPLUS -ADD,VEVENT,RECURRENCEID,NONE,ZERO -ADD,VEVENT,REQUESTSTATUS,NONE,ZERO -ADD,VEVENT,NONE,VALARM,ZEROPLUS -ADD,VEVENT,NONE,VTIMEZONE,ZEROPLUS -ADD,VEVENT,NONE,X,ZEROPLUS -ADD,VEVENT,NONE,VFREEBUSY,ZERO -ADD,VEVENT,NONE,VTODO,ZERO -ADD,VEVENT,NONE,VJOURNAL,ZERO -CANCEL,VEVENT,NONE,NONE,ONEPLUS -CANCEL,VEVENT,ATTENDEE,NONE,ZEROPLUS -CANCEL,VEVENT,DTSTAMP,NONE,ONE -CANCEL,VEVENT,ORGANIZER,NONE,ONE -CANCEL,VEVENT,SEQUENCE,NONE,ONE -CANCEL,VEVENT,UID,NONE,ONE -CANCEL,VEVENT,COMMENT,NONE,ZEROORONE -CANCEL,VEVENT,ATTACH,NONE,ZEROPLUS -CANCEL,VEVENT,CATEGORIES,NONE,ZEROORONE -CANCEL,VEVENT,CLASS,NONE,ZEROORONE -CANCEL,VEVENT,CONTACT,NONE,ZEROPLUS -CANCEL,VEVENT,CREATED,NONE,ZEROORONE -CANCEL,VEVENT,DESCRIPTION,NONE,ZEROORONE -CANCEL,VEVENT,DTEND,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -CANCEL,VEVENT,DTSTART,NONE,ZEROORONE -CANCEL,VEVENT,DURATION,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -CANCEL,VEVENT,EXDATE,NONE,ZEROPLUS -CANCEL,VEVENT,EXRULE,NONE,ZEROPLUS -CANCEL,VEVENT,GEO,NONE,ZEROORONE -CANCEL,VEVENT,LASTMODIFIED,NONE,ZEROORONE -CANCEL,VEVENT,LOCATION,NONE,ZEROORONE -CANCEL,VEVENT,PRIORITY,NONE,ZEROORONE -CANCEL,VEVENT,RDATE,NONE,ZEROPLUS -CANCEL,VEVENT,RECURRENCEID,NONE,ZEROORONE -CANCEL,VEVENT,RELATEDTO,NONE,ZEROPLUS -CANCEL,VEVENT,RESOURCES,NONE,ZEROORONE -CANCEL,VEVENT,RRULE,NONE,ZEROPLUS -CANCEL,VEVENT,STATUS,NONE,ZEROORONE -CANCEL,VEVENT,SUMMARY,NONE,ZEROORONE -CANCEL,VEVENT,TRANSP,NONE,ZEROORONE -CANCEL,VEVENT,URL,NONE,ZEROORONE -CANCEL,VEVENT,X,NONE,ZEROPLUS -CANCEL,VEVENT,REQUESTSTATUS,NONE,ZERO -CANCEL,VEVENT,NONE,VTIMEZONE,ZEROPLUS -CANCEL,VEVENT,NONE,X,ZEROPLUS -CANCEL,VEVENT,NONE,VTODO,ZERO -CANCEL,VEVENT,NONE,VJOURNAL,ZERO -CANCEL,VEVENT,NONE,VFREEBUSY,ZERO -CANCEL,VEVENT,NONE,VALARM,ZERO -REFRESH,VEVENT,NONE,NONE,ONE -REFRESH,VEVENT,ATTENDEE,NONE,ONE -REFRESH,VEVENT,DTSTAMP,NONE,ONE -REFRESH,VEVENT,ORGANIZER,NONE,ONE -REFRESH,VEVENT,UID,NONE,ONE -REFRESH,VEVENT,COMMENT,NONE,ZEROORONE -REFRESH,VEVENT,RECURRENCEID,NONE,ZEROORONE -REFRESH,VEVENT,X,NONE,ZEROPLUS -REFRESH,VEVENT,ATTACH,NONE,ZERO -REFRESH,VEVENT,CATEGORIES,NONE,ZERO -REFRESH,VEVENT,CLASS,NONE,ZERO -REFRESH,VEVENT,CONTACT,NONE,ZERO -REFRESH,VEVENT,CREATED,NONE,ZERO -REFRESH,VEVENT,DESCRIPTION,NONE,ZERO -REFRESH,VEVENT,DTEND,NONE,ZERO -REFRESH,VEVENT,DTSTART,NONE,ZERO -REFRESH,VEVENT,DURATION,NONE,ZERO -REFRESH,VEVENT,EXDATE,NONE,ZERO -REFRESH,VEVENT,EXRULE,NONE,ZERO -REFRESH,VEVENT,GEO,NONE,ZERO -REFRESH,VEVENT,LASTMODIFIED,NONE,ZERO -REFRESH,VEVENT,LOCATION,NONE,ZERO -REFRESH,VEVENT,PRIORITY,NONE,ZERO -REFRESH,VEVENT,RDATE,NONE,ZERO -REFRESH,VEVENT,RELATEDTO,NONE,ZERO -REFRESH,VEVENT,REQUESTSTATUS,NONE,ZERO -REFRESH,VEVENT,RESOURCES,NONE,ZERO -REFRESH,VEVENT,RRULE,NONE,ZERO -REFRESH,VEVENT,SEQUENCE,NONE,ZERO -REFRESH,VEVENT,STATUS,NONE,ZERO -REFRESH,VEVENT,SUMMARY,NONE,ZERO -REFRESH,VEVENT,TRANSP,NONE,ZERO -REFRESH,VEVENT,URL,NONE,ZERO -REFRESH,VEVENT,NONE,X,ZEROPLUS -REFRESH,VEVENT,NONE,VTODO,ZERO -REFRESH,VEVENT,NONE,VJOURNAL,ZERO -REFRESH,VEVENT,NONE,VFREEBUSY,ZERO -REFRESH,VEVENT,NONE,VTIMEZONE,ZERO -REFRESH,VEVENT,NONE,VALARM,ZERO -COUNTER,VEVENT,NONE,NONE,ONE -COUNTER,VEVENT,DTSTAMP,NONE,ONE -COUNTER,VEVENT,DTSTART,NONE,ONE -COUNTER,VEVENT,ORGANIZER,NONE,ONE -COUNTER,VEVENT,SEQUENCE,NONE,ONE -COUNTER,VEVENT,SUMMARY,NONE,ONE -COUNTER,VEVENT,UID,NONE,ONE -COUNTER,VEVENT,ATTACH,NONE,ZEROPLUS -COUNTER,VEVENT,ATTENDEE,NONE,ZEROPLUS -COUNTER,VEVENT,CATEGORIES,NONE,ZEROORONE -COUNTER,VEVENT,CLASS,NONE,ZEROORONE -COUNTER,VEVENT,COMMENT,NONE,ZEROORONE -COUNTER,VEVENT,CONTACT,NONE,ZEROPLUS -COUNTER,VEVENT,CREATED,NONE,ZEROORONE -COUNTER,VEVENT,DESCRIPTION,NONE,ZEROORONE -COUNTER,VEVENT,DTEND,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -COUNTER,VEVENT,DURATION,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -COUNTER,VEVENT,EXDATE,NONE,ZEROPLUS -COUNTER,VEVENT,EXRULE,NONE,ZEROPLUS -COUNTER,VEVENT,GEO,NONE,ZEROORONE -COUNTER,VEVENT,LASTMODIFIED,NONE,ZEROORONE -COUNTER,VEVENT,LOCATION,NONE,ZEROORONE -COUNTER,VEVENT,PRIORITY,NONE,ZEROORONE -COUNTER,VEVENT,RDATE,NONE,ZEROPLUS -COUNTER,VEVENT,RECURRENCEID,NONE,ZEROORONE -COUNTER,VEVENT,RELATEDTO,NONE,ZEROPLUS -COUNTER,VEVENT,REQUESTSTATUS,NONE,ZEROPLUS -COUNTER,VEVENT,RESOURCES,NONE,ZEROORONE -COUNTER,VEVENT,RRULE,NONE,ZEROPLUS -COUNTER,VEVENT,STATUS,NONE,ZEROORONE -COUNTER,VEVENT,TRANSP,NONE,ZEROORONE -COUNTER,VEVENT,URL,NONE,ZEROORONE -COUNTER,VEVENT,X,NONE,ZEROPLUS -COUNTER,VEVENT,NONE,VALARM,ZEROPLUS -COUNTER,VEVENT,NONE,VTIMEZONE,ZEROPLUS -COUNTER,VEVENT,NONE,X,ZEROPLUS -COUNTER,VEVENT,NONE,VTODO,ZERO -COUNTER,VEVENT,NONE,VJOURNAL,ZERO -COUNTER,VEVENT,NONE,VFREEBUSY,ZERO -DECLINECOUNTER,VEVENT,NONE,NONE,ONE -DECLINECOUNTER,VEVENT,DTSTAMP,NONE,ONE -DECLINECOUNTER,VEVENT,ORGANIZER,NONE,ONE -DECLINECOUNTER,VEVENT,UID,NONE,ONE -DECLINECOUNTER,VEVENT,COMMENT,NONE,ZEROORONE -DECLINECOUNTER,VEVENT,RECURRENCEID,NONE,ZEROORONE -DECLINECOUNTER,VEVENT,REQUESTSTATUS,NONE,ZEROPLUS -DECLINECOUNTER,VEVENT,SEQUENCE,NONE,ZERO -DECLINECOUNTER,VEVENT,X,NONE,ZEROPLUS -DECLINECOUNTER,VEVENT,ATTACH,NONE,ZERO -DECLINECOUNTER,VEVENT,ATTENDEE,NONE,ZERO -DECLINECOUNTER,VEVENT,CATEGORIES,NONE,ZERO -DECLINECOUNTER,VEVENT,CLASS,NONE,ZERO -DECLINECOUNTER,VEVENT,CONTACT,NONE,ZERO -DECLINECOUNTER,VEVENT,CREATED,NONE,ZERO -DECLINECOUNTER,VEVENT,DESCRIPTION,NONE,ZERO -DECLINECOUNTER,VEVENT,DTEND,NONE,ZERO -DECLINECOUNTER,VEVENT,DTSTART,NONE,ZERO -DECLINECOUNTER,VEVENT,DURATION,NONE,ZERO -DECLINECOUNTER,VEVENT,EXDATE,NONE,ZERO -DECLINECOUNTER,VEVENT,EXRULE,NONE,ZERO -DECLINECOUNTER,VEVENT,GEO,NONE,ZERO -DECLINECOUNTER,VEVENT,LASTMODIFIED,NONE,ZERO -DECLINECOUNTER,VEVENT,LOCATION,NONE,ZERO -DECLINECOUNTER,VEVENT,PRIORITY,NONE,ZERO -DECLINECOUNTER,VEVENT,RDATE,NONE,ZERO -DECLINECOUNTER,VEVENT,RELATEDTO,NONE,ZERO -DECLINECOUNTER,VEVENT,RESOURCES,NONE,ZERO -DECLINECOUNTER,VEVENT,RRULE,NONE,ZERO -DECLINECOUNTER,VEVENT,STATUS,NONE,ZERO -DECLINECOUNTER,VEVENT,SUMMARY,NONE,ZERO -DECLINECOUNTER,VEVENT,TRANSP,NONE,ZERO -DECLINECOUNTER,VEVENT,URL,NONE,ZERO -DECLINECOUNTER,VEVENT,NONE,X,ZEROPLUS -DECLINECOUNTER,VEVENT,NONE,VTODO,ZERO -DECLINECOUNTER,VEVENT,NONE,VJOURNAL,ZERO -DECLINECOUNTER,VEVENT,NONE,VFREEBUSY,ZERO -DECLINECOUNTER,VEVENT,NONE,VTIMEZONE,ZERO -DECLINECOUNTER,VEVENT,NONE,VALARM,ZERO -PUBLISH,VFREEBUSY,NONE,NONE,ONEPLUS -PUBLISH,VFREEBUSY,DTSTAMP,NONE,ONE -PUBLISH,VFREEBUSY,DTSTART,NONE,ONE -PUBLISH,VFREEBUSY,DTEND,NONE,ONE -PUBLISH,VFREEBUSY,FREEBUSY,NONE,ONEPLUS -PUBLISH,VFREEBUSY,ORGANIZER,NONE,ONE -PUBLISH,VFREEBUSY,COMMENT,NONE,ZEROORONE -PUBLISH,VFREEBUSY,CONTACT,NONE,ZEROPLUS -PUBLISH,VFREEBUSY,X,NONE,ZEROPLUS -PUBLISH,VFREEBUSY,URL,NONE,ZEROORONE -PUBLISH,VFREEBUSY,ATTENDEE,NONE,ZERO -PUBLISH,VFREEBUSY,DURATION,NONE,ZERO -PUBLISH,VFREEBUSY,REQUESTSTATUS,NONE,ZERO -PUBLISH,VFREEBUSY,UID,NONE,ZERO -PUBLISH,VFREEBUSY,NONE,X,ZEROPLUS -PUBLISH,VFREEBUSY,NONE,VEVENT,ZERO -PUBLISH,VFREEBUSY,NONE,VTODO,ZERO -PUBLISH,VFREEBUSY,NONE,VJOURNAL,ZERO -PUBLISH,VFREEBUSY,NONE,VTIMEZONE,ZERO -PUBLISH,VFREEBUSY,NONE,VALARM,ZERO -REQUEST,VFREEBUSY,NONE,NONE,ONE -REQUEST,VFREEBUSY,ATTENDEE,NONE,ONEPLUS -REQUEST,VFREEBUSY,DTEND,NONE,ONE -REQUEST,VFREEBUSY,DTSTAMP,NONE,ONE -REQUEST,VFREEBUSY,DTSTART,NONE,ONE -REQUEST,VFREEBUSY,ORGANIZER,NONE,ONE -REQUEST,VFREEBUSY,UID,NONE,ONE -REQUEST,VFREEBUSY,COMMENT,NONE,ZEROORONE -REQUEST,VFREEBUSY,CONTACT,NONE,ZEROPLUS -REQUEST,VFREEBUSY,X,NONE,ZEROPLUS -REQUEST,VFREEBUSY,FREEBUSY,NONE,ZERO -REQUEST,VFREEBUSY,DURATION,NONE,ZERO -REQUEST,VFREEBUSY,REQUESTSTATUS,NONE,ZERO -REQUEST,VFREEBUSY,URL,NONE,ZERO -REQUEST,VFREEBUSY,NONE,X,ZEROPLUS -REQUEST,VFREEBUSY,NONE,VALARM,ZERO -REQUEST,VFREEBUSY,NONE,VEVENT,ZERO -REQUEST,VFREEBUSY,NONE,VTODO,ZERO -REQUEST,VFREEBUSY,NONE,VJOURNAL,ZERO -REQUEST,VFREEBUSY,NONE,VTIMEZONE,ZERO -REPLY,VFREEBUSY,NONE,NONE,ONE -REPLY,VFREEBUSY,ATTENDEE,NONE,ONE -REPLY,VFREEBUSY,DTSTAMP,NONE,ONE -REPLY,VFREEBUSY,DTEND,NONE,ONE -REPLY,VFREEBUSY,DTSTART,NONE,ONE -REPLY,VFREEBUSY,FREEBUSY,NONE,ONEPLUS -REPLY,VFREEBUSY,ORGANIZER,NONE,ONE -REPLY,VFREEBUSY,UID,NONE,ONE -REPLY,VFREEBUSY,COMMENT,NONE,ZEROORONE -REPLY,VFREEBUSY,CONTACT,NONE,ZEROPLUS -REPLY,VFREEBUSY,REQUESTSTATUS,NONE,ZEROPLUS -REPLY,VFREEBUSY,URL,NONE,ZEROORONE -REPLY,VFREEBUSY,X,NONE,ZEROPLUS -REPLY,VFREEBUSY,DURATION,NONE,ZERO -REPLY,VFREEBUSY,SEQUENCE,NONE,ZERO -REPLY,VFREEBUSY,NONE,X,ZEROPLUS -REPLY,VFREEBUSY,NONE,VALARM,ZERO -REPLY,VFREEBUSY,NONE,VEVENT,ZERO -REPLY,VFREEBUSY,NONE,VTODO,ZERO -REPLY,VFREEBUSY,NONE,VJOURNAL,ZERO -REPLY,VFREEBUSY,NONE,VTIMEZONE,ZERO -PUBLISH,VTODO,NONE,NONE,ONEPLUS -PUBLISH,VTODO,DTSTAMP,NONE,ONE -PUBLISH,VTODO,DTSTART,NONE,ONE -PUBLISH,VTODO,ORGANIZER,NONE,ONE -PUBLISH,VTODO,PRIORITY,NONE,ONE -PUBLISH,VTODO,SEQUENCE,NONE,ZEROORONE -PUBLISH,VTODO,SUMMARY,NONE,ONE -PUBLISH,VTODO,UID,NONE,ONE -PUBLISH,VTODO,ATTACH,NONE,ZEROPLUS -PUBLISH,VTODO,CATEGORIES,NONE,ZEROORONE -PUBLISH,VTODO,CLASS,NONE,ZEROORONE -PUBLISH,VTODO,COMMENT,NONE,ZEROORONE -PUBLISH,VTODO,CONTACT,NONE,ZEROPLUS -PUBLISH,VTODO,CREATED,NONE,ZEROORONE -PUBLISH,VTODO,DESCRIPTION,NONE,ZEROORONE -PUBLISH,VTODO,DUE,NONE,ZEROORONE -PUBLISH,VTODO,DURATION,NONE,ZEROORONE -PUBLISH,VTODO,EXDATE,NONE,ZEROPLUS -PUBLISH,VTODO,EXRULE,NONE,ZEROPLUS -PUBLISH,VTODO,GEO,NONE,ZEROORONE -PUBLISH,VTODO,LASTMODIFIED,NONE,ZEROORONE -PUBLISH,VTODO,LOCATION,NONE,ZEROORONE -PUBLISH,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -PUBLISH,VTODO,RDATE,NONE,ZEROPLUS -PUBLISH,VTODO,RECURRENCEID,NONE,ZEROORONE -PUBLISH,VTODO,RELATEDTO,NONE,ZEROPLUS -PUBLISH,VTODO,RESOURCES,NONE,ZEROORONE -PUBLISH,VTODO,RRULE,NONE,ZEROPLUS -PUBLISH,VTODO,STATUS,NONE,ZEROORONE -PUBLISH,VTODO,URL,NONE,ZEROORONE -PUBLISH,VTODO,X,NONE,ZEROPLUS -PUBLISH,VTODO,ATTENDEE,NONE,ZERO -PUBLISH,VTODO,REQUESTSTATUS,NONE,ZERO -PUBLISH,VTODO,NONE,VTIMEZONE,ZEROPLUS -PUBLISH,VTODO,NONE,VALARM,ZEROPLUS -PUBLISH,VTODO,NONE,X,ZEROPLUS -PUBLISH,VTODO,NONE,VFREEBUSY,ZERO -PUBLISH,VTODO,NONE,VEVENT,ZERO -PUBLISH,VTODO,NONE,VJOURNAL,ZERO -REQUEST,VTODO,NONE,NONE,ONEPLUS -REQUEST,VTODO,ATTENDEE,NONE,ONEPLUS -REQUEST,VTODO,DTSTAMP,NONE,ONE -REQUEST,VTODO,DTSTART,NONE,ONE -REQUEST,VTODO,ORGANIZER,NONE,ONE -REQUEST,VTODO,PRIORITY,NONE,ONE -REQUEST,VTODO,SEQUENCE,NONE,ZEROORONE -REQUEST,VTODO,SUMMARY,NONE,ONE -REQUEST,VTODO,UID,NONE,ONE -REQUEST,VTODO,ATTACH,NONE,ZEROPLUS -REQUEST,VTODO,CATEGORIES,NONE,ZEROORONE -REQUEST,VTODO,CLASS,NONE,ZEROORONE -REQUEST,VTODO,COMMENT,NONE,ZEROORONE -REQUEST,VTODO,CONTACT,NONE,ZEROPLUS -REQUEST,VTODO,CREATED,NONE,ZEROORONE -REQUEST,VTODO,DESCRIPTION,NONE,ZEROORONE -REQUEST,VTODO,DUE,NONE,ZEROORONE -REQUEST,VTODO,DURATION,NONE,ZEROORONE -REQUEST,VTODO,EXDATE,NONE,ZEROPLUS -REQUEST,VTODO,EXRULE,NONE,ZEROPLUS -REQUEST,VTODO,GEO,NONE,ZEROORONE -REQUEST,VTODO,LASTMODIFIED,NONE,ZEROORONE -REQUEST,VTODO,LOCATION,NONE,ZEROORONE -REQUEST,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -REQUEST,VTODO,RDATE,NONE,ZEROPLUS -REQUEST,VTODO,RECURRENCEID,NONE,ZEROORONE -REQUEST,VTODO,RELATEDTO,NONE,ZEROPLUS -REQUEST,VTODO,RESOURCES,NONE,ZEROORONE -REQUEST,VTODO,RRULE,NONE,ZEROPLUS -REQUEST,VTODO,STATUS,NONE,ZEROORONE -REQUEST,VTODO,URL,NONE,ZEROORONE -REQUEST,VTODO,X,NONE,ZEROPLUS -REQUEST,VTODO,REQUESTSTATUS,NONE,ZERO -REQUEST,VTODO,NONE,VALARM,ZEROPLUS -REQUEST,VTODO,NONE,VTIMEZONE,ZEROPLUS -REQUEST,VTODO,NONE,X,ZEROPLUS -REQUEST,VTODO,NONE,VEVENT,ZERO -REQUEST,VTODO,NONE,VFREEBUSY,ZERO -REQUEST,VTODO,NONE,VJOURNAL,ZERO -REPLY,VTODO,NONE,NONE,ONEPLUS -REPLY,VTODO,ATTENDEE,NONE,ONEPLUS -REPLY,VTODO,DTSTAMP,NONE,ONE -REPLY,VTODO,ORGANIZER,NONE,ONE -REPLY,VTODO,REQUESTSTATUS,NONE,ONEPLUS -REPLY,VTODO,UID,NONE,ONE -REPLY,VTODO,ATTACH,NONE,ZEROPLUS -REPLY,VTODO,CATEGORIES,NONE,ZEROORONE -REPLY,VTODO,CLASS,NONE,ZEROORONE -REPLY,VTODO,COMMENT,NONE,ZEROORONE -REPLY,VTODO,CONTACT,NONE,ZEROPLUS -REPLY,VTODO,CREATED,NONE,ZEROORONE -REPLY,VTODO,DESCRIPTION,NONE,ZEROORONE -REPLY,VTODO,DTSTART,NONE,ZEROORONE -REPLY,VTODO,DUE,NONE,ZEROORONE -REPLY,VTODO,DURATION,NONE,ZEROORONE -REPLY,VTODO,EXDATE,NONE,ZEROPLUS -REPLY,VTODO,EXRULE,NONE,ZEROPLUS -REPLY,VTODO,GEO,NONE,ZEROORONE -REPLY,VTODO,LASTMODIFIED,NONE,ZEROORONE -REPLY,VTODO,LOCATION,NONE,ZEROORONE -REPLY,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -REPLY,VTODO,PRIORITY,NONE,ZEROORONE -REPLY,VTODO,RDATE,NONE,ZEROPLUS -REPLY,VTODO,RELATEDTO,NONE,ZEROPLUS -REPLY,VTODO,RESOURCES,NONE,ZEROORONE -REPLY,VTODO,RRULE,NONE,ZEROPLUS -REPLY,VTODO,RECURRENCEID,NONE,ZEROORONE -REPLY,VTODO,SEQUENCE,NONE,ZEROORONE -REPLY,VTODO,STATUS,NONE,ZEROORONE -REPLY,VTODO,SUMMARY,NONE,ZEROORONE -REPLY,VTODO,URL,NONE,ZEROORONE -REPLY,VTODO,X,NONE,ZEROPLUS -REPLY,VTODO,NONE,VTIMEZONE,ZEROORONE -REPLY,VTODO,NONE,X,ZEROPLUS -REPLY,VTODO,NONE,VALARM,ZERO -REPLY,VTODO,NONE,VEVENT,ZERO -REPLY,VTODO,NONE,VFREEBUSY,ZERO -ADD,VTODO,NONE,NONE,ONE -ADD,VTODO,DTSTAMP,NONE,ONE -ADD,VTODO,ORGANIZER,NONE,ONE -ADD,VTODO,PRIORITY,NONE,ONE -ADD,VTODO,SEQUENCE,NONE,ONE -ADD,VTODO,SUMMARY,NONE,ONE -ADD,VTODO,UID,NONE,ONE -ADD,VTODO,ATTACH,NONE,ZEROPLUS -ADD,VTODO,ATTENDEE,NONE,ZEROPLUS -ADD,VTODO,CATEGORIES,NONE,ZEROORONE -ADD,VTODO,CLASS,NONE,ZEROORONE -ADD,VTODO,COMMENT,NONE,ZEROORONE -ADD,VTODO,CONTACT,NONE,ZEROPLUS -ADD,VTODO,CREATED,NONE,ZEROORONE -ADD,VTODO,DESCRIPTION,NONE,ZEROORONE -ADD,VTODO,DTSTART,NONE,ZEROORONE -ADD,VTODO,DUE,NONE,ZEROORONE -ADD,VTODO,DURATION,NONE,ZEROORONE -ADD,VTODO,EXDATE,NONE,ZEROPLUS -ADD,VTODO,EXRULE,NONE,ZEROPLUS -ADD,VTODO,GEO,NONE,ZEROORONE -ADD,VTODO,LASTMODIFIED,NONE,ZEROORONE -ADD,VTODO,LOCATION,NONE,ZEROORONE -ADD,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -ADD,VTODO,RDATE,NONE,ZEROPLUS -ADD,VTODO,RELATEDTO,NONE,ZEROPLUS -ADD,VTODO,RESOURCES,NONE,ZEROORONE -ADD,VTODO,RRULE,NONE,ZEROPLUS -ADD,VTODO,STATUS,NONE,ZEROORONE -ADD,VTODO,URL,NONE,ZEROORONE -ADD,VTODO,X,NONE,ZEROPLUS -ADD,VTODO,RECURRENCEID,NONE,ZERO -ADD,VTODO,REQUESTSTATUS,NONE,ZERO -ADD,VTODO,NONE,VALARM,ZEROPLUS -ADD,VTODO,NONE,VTIMEZONE,ZEROPLUS -ADD,VTODO,NONE,X,ZEROPLUS -ADD,VTODO,NONE,VEVENT,ZERO -ADD,VTODO,NONE,VJOURNAL,ZERO -ADD,VTODO,NONE,VFREEBUSY,ZERO -CANCEL,VTODO,NONE,NONE,ONE -CANCEL,VTODO,ATTENDEE,NONE,ZEROPLUS -CANCEL,VTODO,UID,NONE,ONE -CANCEL,VTODO,DTSTAMP,NONE,ONE -CANCEL,VTODO,ORGANIZER,NONE,ONE -CANCEL,VTODO,SEQUENCE,NONE,ONE -CANCEL,VTODO,ATTACH,NONE,ZEROPLUS -CANCEL,VTODO,CATEGORIES,NONE,ZEROORONE -CANCEL,VTODO,CLASS,NONE,ZEROORONE -CANCEL,VTODO,COMMENT,NONE,ZEROORONE -CANCEL,VTODO,CONTACT,NONE,ZEROPLUS -CANCEL,VTODO,CREATED,NONE,ZEROORONE -CANCEL,VTODO,DESCRIPTION,NONE,ZEROORONE -CANCEL,VTODO,DTSTART,NONE,ZEROORONE -CANCEL,VTODO,DUE,NONE,ZEROORONE -CANCEL,VTODO,DURATION,NONE,ZEROORONE -CANCEL,VTODO,EXDATE,NONE,ZEROPLUS -CANCEL,VTODO,EXRULE,NONE,ZEROPLUS -CANCEL,VTODO,GEO,NONE,ZEROORONE -CANCEL,VTODO,LASTMODIFIED,NONE,ZEROORONE -CANCEL,VTODO,LOCATION,NONE,ZEROORONE -CANCEL,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -CANCEL,VTODO,RDATE,NONE,ZEROPLUS -CANCEL,VTODO,RECURRENCEID,NONE,ZEROORONE -CANCEL,VTODO,RELATEDTO,NONE,ZEROPLUS -CANCEL,VTODO,RESOURCES,NONE,ZEROORONE -CANCEL,VTODO,RRULE,NONE,ZEROPLUS -CANCEL,VTODO,PRIORITY,NONE,ZEROORONE -CANCEL,VTODO,STATUS,NONE,ZEROORONE -CANCEL,VTODO,URL,NONE,ZEROORONE -CANCEL,VTODO,X,NONE,ZEROPLUS -CANCEL,VTODO,REQUESTSTATUS,NONE,ZERO -CANCEL,VTODO,NONE,VTIMEZONE,ZEROORONE -CANCEL,VTODO,NONE,X,ZEROPLUS -CANCEL,VTODO,NONE,VALARM,ZERO -CANCEL,VTODO,NONE,VEVENT,ZERO -CANCEL,VTODO,NONE,VFREEBUSY,ZERO -REFRESH,VTODO,NONE,NONE,ONE -REFRESH,VTODO,ATTENDEE,NONE,ONE -REFRESH,VTODO,DTSTAMP,NONE,ONE -REFRESH,VTODO,UID,NONE,ONE -REFRESH,VTODO,RECURRENCEID,NONE,ZEROORONE -REFRESH,VTODO,X,NONE,ZEROPLUS -REFRESH,VTODO,ATTACH,NONE,ZERO -REFRESH,VTODO,CATEGORIES,NONE,ZERO -REFRESH,VTODO,CLASS,NONE,ZERO -REFRESH,VTODO,COMMENT,NONE,ZERO -REFRESH,VTODO,CONTACT,NONE,ZERO -REFRESH,VTODO,CREATED,NONE,ZERO -REFRESH,VTODO,DESCRIPTION,NONE,ZERO -REFRESH,VTODO,DTSTART,NONE,ZERO -REFRESH,VTODO,DUE,NONE,ZERO -REFRESH,VTODO,DURATION,NONE,ZERO -REFRESH,VTODO,EXDATE,NONE,ZERO -REFRESH,VTODO,EXRULE,NONE,ZERO -REFRESH,VTODO,GEO,NONE,ZERO -REFRESH,VTODO,LASTMODIFIED,NONE,ZERO -REFRESH,VTODO,LOCATION,NONE,ZERO -REFRESH,VTODO,ORGANIZER,NONE,ZERO -REFRESH,VTODO,PERCENTCOMPLETE,NONE,ZERO -REFRESH,VTODO,PRIORITY,NONE,ZERO -REFRESH,VTODO,RDATE,NONE,ZERO -REFRESH,VTODO,RELATEDTO,NONE,ZERO -REFRESH,VTODO,REQUESTSTATUS,NONE,ZERO -REFRESH,VTODO,RESOURCES,NONE,ZERO -REFRESH,VTODO,RRULE,NONE,ZERO -REFRESH,VTODO,SEQUENCE,NONE,ZERO -REFRESH,VTODO,STATUS,NONE,ZERO -REFRESH,VTODO,URL,NONE,ZERO -REFRESH,VTODO,NONE,X,ZEROPLUS -REFRESH,VTODO,NONE,VALARM,ZERO -REFRESH,VTODO,NONE,VEVENT,ZERO -REFRESH,VTODO,NONE,VFREEBUSY,ZERO -REFRESH,VTODO,NONE,VTIMEZONE,ZERO -COUNTER,VTODO,NONE,NONE,ONE -COUNTER,VTODO,ATTENDEE,NONE,ONEPLUS -COUNTER,VTODO,DTSTAMP,NONE,ONE -COUNTER,VTODO,ORGANIZER,NONE,ONE -COUNTER,VTODO,PRIORITY,NONE,ONE -COUNTER,VTODO,SUMMARY,NONE,ONE -COUNTER,VTODO,UID,NONE,ONE -COUNTER,VTODO,ATTACH,NONE,ZEROPLUS -COUNTER,VTODO,CATEGORIES,NONE,ZEROORONE -COUNTER,VTODO,CLASS,NONE,ZEROORONE -COUNTER,VTODO,COMMENT,NONE,ZEROORONE -COUNTER,VTODO,CONTACT,NONE,ZEROPLUS -COUNTER,VTODO,CREATED,NONE,ZEROORONE -COUNTER,VTODO,DESCRIPTION,NONE,ZEROORONE -COUNTER,VTODO,DTSTART,NONE,ZEROORONE -COUNTER,VTODO,DUE,NONE,ZEROORONE -COUNTER,VTODO,DURATION,NONE,ZEROORONE -COUNTER,VTODO,EXDATE,NONE,ZEROPLUS -COUNTER,VTODO,EXRULE,NONE,ZEROPLUS -COUNTER,VTODO,GEO,NONE,ZEROORONE -COUNTER,VTODO,LASTMODIFIED,NONE,ZEROORONE -COUNTER,VTODO,LOCATION,NONE,ZEROORONE -COUNTER,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -COUNTER,VTODO,RDATE,NONE,ZEROPLUS -COUNTER,VTODO,RECURRENCEID,NONE,ZEROORONE -COUNTER,VTODO,RELATEDTO,NONE,ZEROPLUS -COUNTER,VTODO,REQUESTSTATUS,NONE,ZEROPLUS -COUNTER,VTODO,RESOURCES,NONE,ZEROORONE -COUNTER,VTODO,RRULE,NONE,ZEROORONE -COUNTER,VTODO,SEQUENCE,NONE,ZEROORONE -COUNTER,VTODO,STATUS,NONE,ZEROORONE -COUNTER,VTODO,URL,NONE,ZEROORONE -COUNTER,VTODO,X,NONE,ZEROPLUS -COUNTER,VTODO,NONE,VALARM,ZEROPLUS -COUNTER,VTODO,NONE,VTIMEZONE,ZEROORONE -COUNTER,VTODO,NONE,X,ZEROPLUS -COUNTER,VTODO,NONE,VEVENT,ZERO -COUNTER,VTODO,NONE,VFREEBUSY,ZERO -DECLINECOUNTER,VTODO,NONE,NONE,ONE -DECLINECOUNTER,VTODO,ATTENDEE,NONE,ONEPLUS -DECLINECOUNTER,VTODO,DTSTAMP,NONE,ONE -DECLINECOUNTER,VTODO,ORGANIZER,NONE,ONE -DECLINECOUNTER,VTODO,SEQUENCE,NONE,ONE -DECLINECOUNTER,VTODO,UID,NONE,ONE -DECLINECOUNTER,VTODO,ATTACH,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,CATEGORIES,NONE,ZEROORONE -DECLINECOUNTER,VTODO,CLASS,NONE,ZEROORONE -DECLINECOUNTER,VTODO,COMMENT,NONE,ZEROORONE -DECLINECOUNTER,VTODO,CONTACT,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,CREATED,NONE,ZEROORONE -DECLINECOUNTER,VTODO,DESCRIPTION,NONE,ZEROORONE -DECLINECOUNTER,VTODO,DTSTART,NONE,ZEROORONE -DECLINECOUNTER,VTODO,DUE,NONE,ZEROORONE -DECLINECOUNTER,VTODO,DURATION,NONE,ZEROORONE -DECLINECOUNTER,VTODO,EXDATE,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,EXRULE,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,GEO,NONE,ZEROORONE -DECLINECOUNTER,VTODO,LASTMODIFIED,NONE,ZEROORONE -DECLINECOUNTER,VTODO,LOCATION,NONE,ZEROORONE -DECLINECOUNTER,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -DECLINECOUNTER,VTODO,PRIORITY,NONE,ZEROORONE -DECLINECOUNTER,VTODO,RDATE,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,RECURRENCEID,NONE,ZEROORONE -DECLINECOUNTER,VTODO,RELATEDTO,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,REQUESTSTATUS,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,RESOURCES,NONE,ZEROORONE -DECLINECOUNTER,VTODO,RRULE,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,STATUS,NONE,ZEROORONE -DECLINECOUNTER,VTODO,URL,NONE,ZEROORONE -DECLINECOUNTER,VTODO,X,NONE,ZEROPLUS -DECLINECOUNTER,VTODO,NONE,VTIMEZONE,ZEROPLUS -DECLINECOUNTER,VTODO,NONE,X,ZEROPLUS -DECLINECOUNTER,VTODO,NONE,VALARM,ZERO -DECLINECOUNTER,VTODO,NONE,VEVENT,ZERO -DECLINECOUNTER,VTODO,NONE,VFREEBUSY,ZERO -PUBLISH,VJOURNAL,NONE,NONE,ONEPLUS -PUBLISH,VJOURNAL,DESCRIPTION,NONE,ONE -PUBLISH,VJOURNAL,DTSTAMP,NONE,ONE -PUBLISH,VJOURNAL,DTSTART,NONE,ONE -PUBLISH,VJOURNAL,ORGANIZER,NONE,ONE -PUBLISH,VJOURNAL,UID,NONE,ONE -PUBLISH,VJOURNAL,ATTACH,NONE,ZEROPLUS -PUBLISH,VJOURNAL,CATEGORIES,NONE,ZEROORONE -PUBLISH,VJOURNAL,CLASS,NONE,ZEROORONE -PUBLISH,VJOURNAL,COMMENT,NONE,ZEROORONE -PUBLISH,VJOURNAL,CONTACT,NONE,ZEROPLUS -PUBLISH,VJOURNAL,CREATED,NONE,ZEROORONE -PUBLISH,VJOURNAL,EXDATE,NONE,ZEROPLUS -PUBLISH,VJOURNAL,EXRULE,NONE,ZEROPLUS -PUBLISH,VJOURNAL,LASTMODIFIED,NONE,ZEROORONE -PUBLISH,VJOURNAL,RDATE,NONE,ZEROPLUS -PUBLISH,VJOURNAL,RECURRENCEID,NONE,ZEROORONE -PUBLISH,VJOURNAL,RELATEDTO,NONE,ZEROPLUS -PUBLISH,VJOURNAL,RRULE,NONE,ZEROPLUS -PUBLISH,VJOURNAL,SEQUENCE,NONE,ZEROORONE -PUBLISH,VJOURNAL,STATUS,NONE,ZEROORONE -PUBLISH,VJOURNAL,SUMMARY,NONE,ZEROORONE -PUBLISH,VJOURNAL,URL,NONE,ZEROORONE -PUBLISH,VJOURNAL,X,NONE,ZEROPLUS -PUBLISH,VJOURNAL,ATTENDEE,NONE,ZERO -PUBLISH,VJOURNAL,NONE,VALARM,ZEROPLUS -PUBLISH,VJOURNAL,NONE,VTIMEZONE,ZEROPLUS -PUBLISH,VJOURNAL,NONE,X,ZEROPLUS -PUBLISH,VJOURNAL,NONE,VEVENT,ZERO -PUBLISH,VJOURNAL,NONE,VFREEBUSY,ZERO -PUBLISH,VJOURNAL,NONE,VTODO,ZERO -ADD,VJOURNAL,NONE,NONE,ONE -ADD,VJOURNAL,DESCRIPTION,NONE,ONE -ADD,VJOURNAL,DTSTAMP,NONE,ONE -ADD,VJOURNAL,DTSTART,NONE,ONE -ADD,VJOURNAL,ORGANIZER,NONE,ONE -ADD,VJOURNAL,SEQUENCE,NONE,ONE -ADD,VJOURNAL,UID,NONE,ONE -ADD,VJOURNAL,ATTACH,NONE,ZEROPLUS -ADD,VJOURNAL,CATEGORIES,NONE,ZEROORONE -ADD,VJOURNAL,CLASS,NONE,ZEROORONE -ADD,VJOURNAL,COMMENT,NONE,ZEROORONE -ADD,VJOURNAL,CONTACT,NONE,ZEROPLUS -ADD,VJOURNAL,CREATED,NONE,ZEROORONE -ADD,VJOURNAL,EXDATE,NONE,ZEROPLUS -ADD,VJOURNAL,EXRULE,NONE,ZEROPLUS -ADD,VJOURNAL,LASTMODIFIED,NONE,ZEROORONE -ADD,VJOURNAL,RDATE,NONE,ZEROPLUS -ADD,VJOURNAL,RELATEDTO,NONE,ZEROPLUS -ADD,VJOURNAL,RRULE,NONE,ZEROPLUS -ADD,VJOURNAL,STATUS,NONE,ZEROORONE -ADD,VJOURNAL,SUMMARY,NONE,ZEROORONE -ADD,VJOURNAL,URL,NONE,ZEROORONE -ADD,VJOURNAL,X,NONE,ZEROPLUS -ADD,VJOURNAL,ATTENDEE,NONE,ZERO -ADD,VJOURNAL,RECURRENCEID,NONE,ZERO -ADD,VJOURNAL,NONE,VALARM,ZEROPLUS -ADD,VJOURNAL,NONE,VTIMEZONE,ZEROORONE -ADD,VJOURNAL,NONE,X,ZEROPLUS -ADD,VJOURNAL,NONE,VEVENT,ZERO -ADD,VJOURNAL,NONE,VFREEBUSY,ZERO -ADD,VJOURNAL,NONE,VTODO,ZERO -CANCEL,VJOURNAL,NONE,NONE,ONEPLUS -CANCEL,VJOURNAL,DTSTAMP,NONE,ONE -CANCEL,VJOURNAL,ORGANIZER,NONE,ONE -CANCEL,VJOURNAL,SEQUENCE,NONE,ONE -CANCEL,VJOURNAL,UID,NONE,ONE -CANCEL,VJOURNAL,ATTACH,NONE,ZEROPLUS -CANCEL,VJOURNAL,ATTENDEE,NONE,ZEROPLUS -CANCEL,VJOURNAL,CATEGORIES,NONE,ZEROORONE -CANCEL,VJOURNAL,CLASS,NONE,ZEROORONE -CANCEL,VJOURNAL,COMMENT,NONE,ZEROORONE -CANCEL,VJOURNAL,CONTACT,NONE,ZEROPLUS -CANCEL,VJOURNAL,CREATED,NONE,ZEROORONE -CANCEL,VJOURNAL,DESCRIPTION,NONE,ZEROORONE -CANCEL,VJOURNAL,DTSTART,NONE,ZEROORONE -CANCEL,VJOURNAL,EXDATE,NONE,ZEROPLUS -CANCEL,VJOURNAL,EXRULE,NONE,ZEROPLUS -CANCEL,VJOURNAL,LASTMODIFIED,NONE,ZEROORONE -CANCEL,VJOURNAL,RDATE,NONE,ZEROPLUS -CANCEL,VJOURNAL,RECURRENCEID,NONE,ZEROORONE -CANCEL,VJOURNAL,RELATEDTO,NONE,ZEROPLUS -CANCEL,VJOURNAL,RRULE,NONE,ZEROPLUS -CANCEL,VJOURNAL,STATUS,NONE,ZEROORONE -CANCEL,VJOURNAL,SUMMARY,NONE,ZEROORONE -CANCEL,VJOURNAL,URL,NONE,ZEROORONE -CANCEL,VJOURNAL,X,NONE,ZEROPLUS -CANCEL,VJOURNAL,REQUESTSTATUS,NONE,ZERO -CANCEL,VJOURNAL,NONE,VTIMEZONE,ZEROPLUS -CANCEL,VJOURNAL,NONE,X,ZEROPLUS -CANCEL,VJOURNAL,NONE,VALARM,ZERO -CANCEL,VJOURNAL,NONE,VEVENT,ZERO -CANCEL,VJOURNAL,NONE,VFREEBUSY,ZERO -CANCEL,VJOURNAL,NONE,VTODO,ZERO -NONE,VCALENDAR,ACTION,NONE,ZERO -NONE,VCALENDAR,ATTACH,NONE,ZERO -NONE,VCALENDAR,ATTENDEE,NONE,ZERO -NONE,VCALENDAR,CALSCALE,NONE,ZEROORONE -NONE,VCALENDAR,CATEGORIES,NONE,ZERO -NONE,VCALENDAR,CLASS,NONE,ZERO -NONE,VCALENDAR,COMMENT,NONE,ZERO -NONE,VCALENDAR,COMPLETED,NONE,ZERO -NONE,VCALENDAR,CONTACT,NONE,ZERO -NONE,VCALENDAR,CREATED,NONE,ZERO -NONE,VCALENDAR,DESCRIPTION,NONE,ZERO -NONE,VCALENDAR,DTEND,NONE,ZERO -NONE,VCALENDAR,DTSTAMP,NONE,ZERO -NONE,VCALENDAR,DTSTART,NONE,ZERO -NONE,VCALENDAR,DUE,NONE,ZERO -NONE,VCALENDAR,DURATION,NONE,ZERO -NONE,VCALENDAR,EXDATE,NONE,ZERO -NONE,VCALENDAR,EXRULE,NONE,ZERO -NONE,VCALENDAR,FREEBUSY,NONE,ZERO -NONE,VCALENDAR,GEO,NONE,ZERO -NONE,VCALENDAR,LASTMODIFIED,NONE,ZERO -NONE,VCALENDAR,LOCATION,NONE,ZERO -NONE,VCALENDAR,METHOD,NONE,ZEROORONE -NONE,VCALENDAR,ORGANIZER,NONE,ZERO -NONE,VCALENDAR,PERCENTCOMPLETE,NONE,ZERO -NONE,VCALENDAR,PRIORITY,NONE,ZERO -NONE,VCALENDAR,PRODID,NONE,ONE -NONE,VCALENDAR,RDATE,NONE,ZERO -NONE,VCALENDAR,RECURRENCEID,NONE,ZERO -NONE,VCALENDAR,RELATEDTO,NONE,ZERO -NONE,VCALENDAR,REPEAT,NONE,ZERO -NONE,VCALENDAR,REQUESTSTATUS,NONE,ZERO -NONE,VCALENDAR,RESOURCES,NONE,ZERO -NONE,VCALENDAR,RRULE,NONE,ZERO -NONE,VCALENDAR,SEQUENCE,NONE,ZERO -NONE,VCALENDAR,STATUS,NONE,ZERO -NONE,VCALENDAR,SUMMARY,NONE,ZERO -NONE,VCALENDAR,TRANSP,NONE,ZERO -NONE,VCALENDAR,TRIGGER,NONE,ZERO -NONE,VCALENDAR,TZID,NONE,ZERO -NONE,VCALENDAR,TZNAME,NONE,ZERO -NONE,VCALENDAR,TZOFFSETFROM,NONE,ZERO -NONE,VCALENDAR,TZOFFSETTO,NONE,ZERO -NONE,VCALENDAR,TZURL,NONE,ZERO -NONE,VCALENDAR,UID,NONE,ZERO -NONE,VCALENDAR,URL,NONE,ZERO -NONE,VCALENDAR,VERSION,NONE,ONE -NONE,VCALENDAR,X,NONE,ZEROPLUS -NONE,VEVENT,ACTION,NONE,ZERO -NONE,VEVENT,ATTACH,NONE,ZEROPLUS -NONE,VEVENT,ATTENDEE,NONE,ZEROPLUS -NONE,VEVENT,CALSCALE,NONE,ZERO -NONE,VEVENT,CATEGORIES,NONE,ZEROPLUS -NONE,VEVENT,CLASS,NONE,ZEROORONE -NONE,VEVENT,COMMENT,NONE,ZEROPLUS -NONE,VEVENT,COMPLETED,NONE,ZERO -NONE,VEVENT,CONTACT,NONE,ZEROPLUS -NONE,VEVENT,CREATED,NONE,ZEROORONE -NONE,VEVENT,DESCRIPTION,NONE,ZEROORONE -NONE,VEVENT,DTEND,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -NONE,VEVENT,DTSTAMP,NONE,ZEROORONE -NONE,VEVENT,DTSTART,NONE,ZEROORONE -NONE,VEVENT,DUE,NONE,ZERO -NONE,VEVENT,DURATION,NONE,ONEEXCLUSIVE, icalrestriction_check_exclusive -NONE,VEVENT,EXDATE,NONE,ZEROPLUS -NONE,VEVENT,EXRULE,NONE,ZEROPLUS -NONE,VEVENT,FREEBUSY,NONE,ZERO -NONE,VEVENT,GEO,NONE,ZEROORONE -NONE,VEVENT,LASTMODIFIED,NONE,ZEROORONE -NONE,VEVENT,LOCATION,NONE,ZEROORONE -NONE,VEVENT,METHOD,NONE,ZERO -NONE,VEVENT,ORGANIZER,NONE,ZEROORONE -NONE,VEVENT,PERCENTCOMPLETE,NONE,ZERO -NONE,VEVENT,PRIORITY,NONE,ZEROORONE -NONE,VEVENT,PRODID,NONE,ZERO -NONE,VEVENT,RDATE,NONE,ZEROPLUS -NONE,VEVENT,RECURRENCEID,NONE,ZEROORONE -NONE,VEVENT,RELATEDTO,NONE,ZEROPLUS -NONE,VEVENT,REPEAT,NONE,ZERO -NONE,VEVENT,REQUESTSTATUS,NONE,ZEROPLUS -NONE,VEVENT,RESOURCES,NONE,ZEROPLUS -NONE,VEVENT,RRULE,NONE,ZEROPLUS -NONE,VEVENT,SEQUENCE,NONE,ZEROORONE -NONE,VEVENT,STATUS,NONE,ZEROORONE -NONE,VEVENT,SUMMARY,NONE,ZEROORONE -NONE,VEVENT,TRANSP,NONE,ZEROORONE -NONE,VEVENT,TRIGGER,NONE,ZERO -NONE,VEVENT,TZID,NONE,ZERO -NONE,VEVENT,TZNAME,NONE,ZERO -NONE,VEVENT,TZOFFSETFROM,NONE,ZERO -NONE,VEVENT,TZOFFSETTO,NONE,ZERO -NONE,VEVENT,TZURL,NONE,ZERO -NONE,VEVENT,UID,NONE,ZEROORONE -NONE,VEVENT,URL,NONE,ZEROORONE -NONE,VEVENT,VERSION,NONE,ZERO -NONE,VEVENT,X,NONE,ZEROPLUS -NONE,VTODO,ACTION,NONE,ZERO -NONE,VTODO,ATTACH,NONE,ZEROPLUS -NONE,VTODO,ATTENDEE,NONE,ZEROPLUS -NONE,VTODO,CALSCALE,NONE,ZERO -NONE,VTODO,CATEGORIES,NONE,ZEROPLUS -NONE,VTODO,CLASS,NONE,ZEROORONE -NONE,VTODO,COMMENT,NONE,ZEROPLUS -NONE,VTODO,COMPLETED,NONE,ZEROORONE -NONE,VTODO,CONTACT,NONE,ZEROPLUS -NONE,VTODO,CREATED,NONE,ZEROORONE -NONE,VTODO,DESCRIPTION,NONE,ZEROORONE -NONE,VTODO,DTEND,NONE,ZERO -NONE,VTODO,DTSTAMP,NONE,ZEROORONE -NONE,VTODO,DTSTART,NONE,ZEROORONE -NONE,VTODO,DUE,NONE,ONEEXCLUSIVE -NONE,VTODO,DURATION,NONE,ONEEXCLUSIVE -NONE,VTODO,EXDATE,NONE,ZEROPLUS -NONE,VTODO,EXRULE,NONE,ZEROPLUS -NONE,VTODO,FREEBUSY,NONE,ZERO -NONE,VTODO,GEO,NONE,ZEROORONE -NONE,VTODO,LASTMODIFIED,NONE,ZEROORONE -NONE,VTODO,LOCATION,NONE,ZEROORONE -NONE,VTODO,METHOD,NONE,ZERO -NONE,VTODO,ORGANIZER,NONE,ZEROORONE -NONE,VTODO,PERCENTCOMPLETE,NONE,ZEROORONE -NONE,VTODO,PRIORITY,NONE,ZEROORONE -NONE,VTODO,PRODID,NONE,ZERO -NONE,VTODO,RDATE,NONE,ZEROPLUS -NONE,VTODO,RECURRENCEID,NONE,ZEROORONE -NONE,VTODO,RELATEDTO,NONE,ZEROPLUS -NONE,VTODO,REPEAT,NONE,ZERO -NONE,VTODO,REQUESTSTATUS,NONE,ZEROPLUS -NONE,VTODO,RESOURCES,NONE,ZEROPLUS -NONE,VTODO,RRULE,NONE,ZEROPLUS -NONE,VTODO,SEQUENCE,NONE,ZEROORONE -NONE,VTODO,STATUS,NONE,ZEROORONE -NONE,VTODO,SUMMARY,NONE,ZEROORONE -NONE,VTODO,TRANSP,NONE,ZERO -NONE,VTODO,TRIGGER,NONE,ZERO -NONE,VTODO,TZID,NONE,ZERO -NONE,VTODO,TZNAME,NONE,ZERO -NONE,VTODO,TZOFFSETFROM,NONE,ZERO -NONE,VTODO,TZOFFSETTO,NONE,ZERO -NONE,VTODO,TZURL,NONE,ZERO -NONE,VTODO,UID,NONE,ZEROORONE -NONE,VTODO,URL,NONE,ZEROORONE -NONE,VTODO,VERSION,NONE,ZERO -NONE,VTODO,X,NONE,ZEROPLUS -NONE,VJOURNAL,ACTION,NONE,ZERO -NONE,VJOURNAL,ATTACH,NONE,ZEROPLUS -NONE,VJOURNAL,ATTENDEE,NONE,ZEROPLUS -NONE,VJOURNAL,CALSCALE,NONE,ZERO -NONE,VJOURNAL,CATEGORIES,NONE,ZEROPLUS -NONE,VJOURNAL,CLASS,NONE,ZEROORONE -NONE,VJOURNAL,COMMENT,NONE,ZEROPLUS -NONE,VJOURNAL,COMPLETED,NONE,ZERO -NONE,VJOURNAL,CONTACT,NONE,ZEROPLUS -NONE,VJOURNAL,CREATED,NONE,ZEROORONE -NONE,VJOURNAL,DESCRIPTION,NONE,ZEROORONE -NONE,VJOURNAL,DTEND,NONE,ZERO -NONE,VJOURNAL,DTSTAMP,NONE,ZEROORONE -NONE,VJOURNAL,DTSTART,NONE,ZEROORONE -NONE,VJOURNAL,DUE,NONE,ONEEXCLUSIVE -NONE,VJOURNAL,DURATION,NONE,ONEEXCLUSIVE -NONE,VJOURNAL,EXDATE,NONE,ZEROPLUS -NONE,VJOURNAL,EXRULE,NONE,ZEROPLUS -NONE,VJOURNAL,FREEBUSY,NONE,ZERO -NONE,VJOURNAL,GEO,NONE,ZERO -NONE,VJOURNAL,LASTMODIFIED,NONE,ZEROORONE -NONE,VJOURNAL,LOCATION,NONE,ZERO -NONE,VJOURNAL,METHOD,NONE,ZERO -NONE,VJOURNAL,ORGANIZER,NONE,ZEROORONE -NONE,VJOURNAL,PERCENTCOMPLETE,NONE,ZERO -NONE,VJOURNAL,PRIORITY,NONE,ZERO -NONE,VJOURNAL,PRODID,NONE,ZERO -NONE,VJOURNAL,RDATE,NONE,ZEROPLUS -NONE,VJOURNAL,RECURRENCEID,NONE,ZEROORONE -NONE,VJOURNAL,RELATEDTO,NONE,ZEROPLUS -NONE,VJOURNAL,REPEAT,NONE,ZERO -NONE,VJOURNAL,REQUESTSTATUS,NONE,ZEROPLUS -NONE,VJOURNAL,RESOURCES,NONE,ZERO -NONE,VJOURNAL,RRULE,NONE,ZEROPLUS -NONE,VJOURNAL,SEQUENCE,NONE,ZEROORONE -NONE,VJOURNAL,STATUS,NONE,ZEROORONE -NONE,VJOURNAL,SUMMARY,NONE,ZEROORONE -NONE,VJOURNAL,TRANSP,NONE,ZERO -NONE,VJOURNAL,TRIGGER,NONE,ZERO -NONE,VJOURNAL,TZID,NONE,ZERO -NONE,VJOURNAL,TZNAME,NONE,ZERO -NONE,VJOURNAL,TZOFFSETFROM,NONE,ZERO -NONE,VJOURNAL,TZOFFSETTO,NONE,ZERO -NONE,VJOURNAL,TZURL,NONE,ZERO -NONE,VJOURNAL,UID,NONE,ZEROORONE -NONE,VJOURNAL,URL,NONE,ZEROORONE -NONE,VJOURNAL,VERSION,NONE,ZERO -NONE,VJOURNAL,X,NONE,ZEROPLUS -NONE,VFREEBUSY,ACTION,NONE,ZERO -NONE,VFREEBUSY,ATTACH,NONE,ZERO -NONE,VFREEBUSY,ATTENDEE,NONE,ZEROPLUS -NONE,VFREEBUSY,CALSCALE,NONE,ZERO -NONE,VFREEBUSY,CATEGORIES,NONE,ZERO -NONE,VFREEBUSY,CLASS,NONE,ZERO -NONE,VFREEBUSY,COMMENT,NONE,ZEROPLUS -NONE,VFREEBUSY,COMPLETED,NONE,ZERO -NONE,VFREEBUSY,CONTACT,NONE,ZEROORONE -NONE,VFREEBUSY,CREATED,NONE,ZERO -NONE,VFREEBUSY,DESCRIPTION,NONE,ZERO -NONE,VFREEBUSY,DTEND,NONE,ZEROORONE -NONE,VFREEBUSY,DTSTAMP,NONE,ZERO -NONE,VFREEBUSY,DTSTART,NONE,ZEROORONE -NONE,VFREEBUSY,DUE,NONE,ZERO -NONE,VFREEBUSY,DURATION,NONE,ZEROORONE -NONE,VFREEBUSY,EXDATE,NONE,ZERO -NONE,VFREEBUSY,EXRULE,NONE,ZERO -NONE,VFREEBUSY,FREEBUSY,NONE,ZEROPLUS -NONE,VFREEBUSY,GEO,NONE,ZERO -NONE,VFREEBUSY,LASTMODIFIED,NONE,ZERO -NONE,VFREEBUSY,LOCATION,NONE,ZERO -NONE,VFREEBUSY,METHOD,NONE,ZERO -NONE,VFREEBUSY,ORGANIZER,NONE,ZEROORONE -NONE,VFREEBUSY,PERCENTCOMPLETE,NONE,ZERO -NONE,VFREEBUSY,PRIORITY,NONE,ZERO -NONE,VFREEBUSY,PRODID,NONE,ZERO -NONE,VFREEBUSY,RDATE,NONE,ZERO -NONE,VFREEBUSY,RECURRENCEID,NONE,ZERO -NONE,VFREEBUSY,RELATEDTO,NONE,ZERO -NONE,VFREEBUSY,REPEAT,NONE,ZERO -NONE,VFREEBUSY,REQUESTSTATUS,NONE,ZEROPLUS -NONE,VFREEBUSY,RESOURCES,NONE,ZERO -NONE,VFREEBUSY,RRULE,NONE,ZERO -NONE,VFREEBUSY,SEQUENCE,NONE,ZERO -NONE,VFREEBUSY,STATUS,NONE,ZERO -NONE,VFREEBUSY,SUMMARY,NONE,ZERO -NONE,VFREEBUSY,TRANSP,NONE,ZERO -NONE,VFREEBUSY,TRIGGER,NONE,ZERO -NONE,VFREEBUSY,TZID,NONE,ZERO -NONE,VFREEBUSY,TZNAME,NONE,ZERO -NONE,VFREEBUSY,TZOFFSETFROM,NONE,ZERO -NONE,VFREEBUSY,TZOFFSETTO,NONE,ZERO -NONE,VFREEBUSY,TZURL,NONE,ZERO -NONE,VFREEBUSY,UID,NONE,ZEROORONE -NONE,VFREEBUSY,URL,NONE,ZEROORONE -NONE,VFREEBUSY,VERSION,NONE,ZERO -NONE,VFREEBUSY,X,NONE,ZEROPLUS -NONE,VTIMEZONE,ACTION,NONE,ZERO -NONE,VTIMEZONE,ATTACH,NONE,ZERO -NONE,VTIMEZONE,ATTENDEE,NONE,ZERO -NONE,VTIMEZONE,CALSCALE,NONE,ZERO -NONE,VTIMEZONE,CATEGORIES,NONE,ZERO -NONE,VTIMEZONE,CLASS,NONE,ZERO -NONE,VTIMEZONE,COMMENT,NONE,ZERO -NONE,VTIMEZONE,COMPLETED,NONE,ZERO -NONE,VTIMEZONE,CONTACT,NONE,ZERO -NONE,VTIMEZONE,CREATED,NONE,ZERO -NONE,VTIMEZONE,DESCRIPTION,NONE,ZERO -NONE,VTIMEZONE,DTEND,NONE,ZERO -NONE,VTIMEZONE,DTSTAMP,NONE,ZERO -NONE,VTIMEZONE,DTSTART,NONE,ZERO -NONE,VTIMEZONE,DUE,NONE,ZERO -NONE,VTIMEZONE,DURATION,NONE,ZERO -NONE,VTIMEZONE,EXDATE,NONE,ZERO -NONE,VTIMEZONE,EXRULE,NONE,ZERO -NONE,VTIMEZONE,FREEBUSY,NONE,ZERO -NONE,VTIMEZONE,GEO,NONE,ZERO -NONE,VTIMEZONE,LASTMODIFIED,NONE,ZEROORONE -NONE,VTIMEZONE,LOCATION,NONE,ZERO -NONE,VTIMEZONE,METHOD,NONE,ZERO -NONE,VTIMEZONE,ORGANIZER,NONE,ZERO -NONE,VTIMEZONE,PERCENTCOMPLETE,NONE,ZERO -NONE,VTIMEZONE,PRIORITY,NONE,ZERO -NONE,VTIMEZONE,PRODID,NONE,ZERO -NONE,VTIMEZONE,RDATE,NONE,ZERO -NONE,VTIMEZONE,RECURRENCEID,NONE,ZERO -NONE,VTIMEZONE,RELATEDTO,NONE,ZERO -NONE,VTIMEZONE,REPEAT,NONE,ZERO -NONE,VTIMEZONE,REQUESTSTATUS,NONE,ZERO -NONE,VTIMEZONE,RESOURCES,NONE,ZERO -NONE,VTIMEZONE,RRULE,NONE,ZERO -NONE,VTIMEZONE,SEQUENCE,NONE,ZERO -NONE,VTIMEZONE,STATUS,NONE,ZERO -NONE,VTIMEZONE,SUMMARY,NONE,ZERO -NONE,VTIMEZONE,TRANSP,NONE,ZERO -NONE,VTIMEZONE,TRIGGER,NONE,ZERO -NONE,VTIMEZONE,TZID,NONE,ONE -NONE,VTIMEZONE,TZNAME,NONE,ZERO -NONE,VTIMEZONE,TZOFFSETFROM,NONE,ZERO -NONE,VTIMEZONE,TZOFFSETTO,NONE,ZERO -NONE,VTIMEZONE,TZURL,NONE,ZEROPLUS -NONE,VTIMEZONE,UID,NONE,ZERO -NONE,VTIMEZONE,URL,NONE,ZERO -NONE,VTIMEZONE,VERSION,NONE,ZERO -NONE,VTIMEZONE,X,NONE,ZEROORONE -NONE,XSTANDARD,ACTION,NONE,ZERO -NONE,XSTANDARD,ATTACH,NONE,ZERO -NONE,XSTANDARD,ATTENDEE,NONE,ZERO -NONE,XSTANDARD,CALSCALE,NONE,ZERO -NONE,XSTANDARD,CATEGORIES,NONE,ZERO -NONE,XSTANDARD,CLASS,NONE,ZERO -NONE,XSTANDARD,COMMENT,NONE,ZEROPLUS -NONE,XSTANDARD,COMPLETED,NONE,ZERO -NONE,XSTANDARD,CONTACT,NONE,ZERO -NONE,XSTANDARD,CREATED,NONE,ZERO -NONE,XSTANDARD,DESCRIPTION,NONE,ZERO -NONE,XSTANDARD,DTEND,NONE,ZERO -NONE,XSTANDARD,DTSTAMP,NONE,ZERO -NONE,XSTANDARD,DTSTART,NONE,ONE -NONE,XSTANDARD,DUE,NONE,ZERO -NONE,XSTANDARD,DURATION,NONE,ZERO -NONE,XSTANDARD,EXDATE,NONE,ZERO -NONE,XSTANDARD,EXRULE,NONE,ZERO -NONE,XSTANDARD,FREEBUSY,NONE,ZERO -NONE,XSTANDARD,GEO,NONE,ZERO -NONE,XSTANDARD,LASTMODIFIED,NONE,ZERO -NONE,XSTANDARD,LOCATION,NONE,ZERO -NONE,XSTANDARD,METHOD,NONE,ZERO -NONE,XSTANDARD,ORGANIZER,NONE,ZERO -NONE,XSTANDARD,PERCENTCOMPLETE,NONE,ZERO -NONE,XSTANDARD,PRIORITY,NONE,ZERO -NONE,XSTANDARD,PRODID,NONE,ZERO -NONE,XSTANDARD,RDATE,NONE,ZEROPLUS -NONE,XSTANDARD,RECURRENCEID,NONE,ZERO -NONE,XSTANDARD,RELATEDTO,NONE,ZERO -NONE,XSTANDARD,REPEAT,NONE,ZERO -NONE,XSTANDARD,REQUESTSTATUS,NONE,ZERO -NONE,XSTANDARD,RESOURCES,NONE,ZERO -NONE,XSTANDARD,RRULE,NONE,ZEROPLUS -NONE,XSTANDARD,SEQUENCE,NONE,ZERO -NONE,XSTANDARD,STATUS,NONE,ZERO -NONE,XSTANDARD,SUMMARY,NONE,ZERO -NONE,XSTANDARD,TRANSP,NONE,ZERO -NONE,XSTANDARD,TRIGGER,NONE,ZERO -NONE,XSTANDARD,TZID,NONE,ZERO -NONE,XSTANDARD,TZNAME,NONE,ZEROPLUS -NONE,XSTANDARD,TZOFFSETFROM,NONE,ONE -NONE,XSTANDARD,TZOFFSETTO,NONE,ONE -NONE,XSTANDARD,TZURL,NONE,ZERO -NONE,XSTANDARD,UID,NONE,ZERO -NONE,XSTANDARD,URL,NONE,ZERO -NONE,XSTANDARD,VERSION,NONE,ZERO -NONE,XSTANDARD,X,NONE,ZEROPLUS -NONE,XDAYLIGHT,ACTION,NONE,ZERO -NONE,XDAYLIGHT,ATTACH,NONE,ZERO -NONE,XDAYLIGHT,ATTENDEE,NONE,ZERO -NONE,XDAYLIGHT,CALSCALE,NONE,ZERO -NONE,XDAYLIGHT,CATEGORIES,NONE,ZERO -NONE,XDAYLIGHT,CLASS,NONE,ZERO -NONE,XDAYLIGHT,COMMENT,NONE,ZEROPLUS -NONE,XDAYLIGHT,COMPLETED,NONE,ZERO -NONE,XDAYLIGHT,CONTACT,NONE,ZERO -NONE,XDAYLIGHT,CREATED,NONE,ZERO -NONE,XDAYLIGHT,DESCRIPTION,NONE,ZERO -NONE,XDAYLIGHT,DTEND,NONE,ZERO -NONE,XDAYLIGHT,DTSTAMP,NONE,ZERO -NONE,XDAYLIGHT,DTSTART,NONE,ONE -NONE,XDAYLIGHT,DUE,NONE,ZERO -NONE,XDAYLIGHT,DURATION,NONE,ZERO -NONE,XDAYLIGHT,EXDATE,NONE,ZERO -NONE,XDAYLIGHT,EXRULE,NONE,ZERO -NONE,XDAYLIGHT,FREEBUSY,NONE,ZERO -NONE,XDAYLIGHT,GEO,NONE,ZERO -NONE,XDAYLIGHT,LASTMODIFIED,NONE,ZERO -NONE,XDAYLIGHT,LOCATION,NONE,ZERO -NONE,XDAYLIGHT,METHOD,NONE,ZERO -NONE,XDAYLIGHT,ORGANIZER,NONE,ZERO -NONE,XDAYLIGHT,PERCENTCOMPLETE,NONE,ZERO -NONE,XDAYLIGHT,PRIORITY,NONE,ZERO -NONE,XDAYLIGHT,PRODID,NONE,ZERO -NONE,XDAYLIGHT,RDATE,NONE,ZEROPLUS -NONE,XDAYLIGHT,RECURRENCEID,NONE,ZERO -NONE,XDAYLIGHT,RELATEDTO,NONE,ZERO -NONE,XDAYLIGHT,REPEAT,NONE,ZERO -NONE,XDAYLIGHT,REQUESTSTATUS,NONE,ZERO -NONE,XDAYLIGHT,RESOURCES,NONE,ZERO -NONE,XDAYLIGHT,RRULE,NONE,ZEROPLUS -NONE,XDAYLIGHT,SEQUENCE,NONE,ZERO -NONE,XDAYLIGHT,STATUS,NONE,ZERO -NONE,XDAYLIGHT,SUMMARY,NONE,ZERO -NONE,XDAYLIGHT,TRANSP,NONE,ZERO -NONE,XDAYLIGHT,TRIGGER,NONE,ZERO -NONE,XDAYLIGHT,TZID,NONE,ZERO -NONE,XDAYLIGHT,TZNAME,NONE,ZEROPLUS -NONE,XDAYLIGHT,TZOFFSETFROM,NONE,ONE -NONE,XDAYLIGHT,TZOFFSETTO,NONE,ONE -NONE,XDAYLIGHT,TZURL,NONE,ZERO -NONE,XDAYLIGHT,UID,NONE,ZERO -NONE,XDAYLIGHT,URL,NONE,ZERO -NONE,XDAYLIGHT,VERSION,NONE,ZERO -NONE,XDAYLIGHT,X,NONE,ZEROPLUS -NONE,XAUDIOALARM,ACTION,NONE,ONE -NONE,XAUDIOALARM,ATTACH,NONE,ZEROORONE -NONE,XAUDIOALARM,ATTENDEE,NONE,ZERO -NONE,XAUDIOALARM,CALSCALE,NONE,ZERO -NONE,XAUDIOALARM,CATEGORIES,NONE,ZERO -NONE,XAUDIOALARM,CLASS,NONE,ZERO -NONE,XAUDIOALARM,COMMENT,NONE,ZERO -NONE,XAUDIOALARM,COMPLETED,NONE,ZERO -NONE,XAUDIOALARM,CONTACT,NONE,ZERO -NONE,XAUDIOALARM,CREATED,NONE,ZERO -NONE,XAUDIOALARM,DESCRIPTION,NONE,ZERO -NONE,XAUDIOALARM,DTEND,NONE,ZERO -NONE,XAUDIOALARM,DTSTAMP,NONE,ZERO -NONE,XAUDIOALARM,DTSTART,NONE,ZERO -NONE,XAUDIOALARM,DUE,NONE,ZERO -NONE,XAUDIOALARM,DURATION,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XAUDIOALARM,REPEAT,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XAUDIOALARM,EXDATE,NONE,ZERO -NONE,XAUDIOALARM,EXRULE,NONE,ZERO -NONE,XAUDIOALARM,FREEBUSY,NONE,ZERO -NONE,XAUDIOALARM,GEO,NONE,ZERO -NONE,XAUDIOALARM,LASTMODIFIED,NONE,ZERO -NONE,XAUDIOALARM,LOCATION,NONE,ZERO -NONE,XAUDIOALARM,METHOD,NONE,ZERO -NONE,XAUDIOALARM,ORGANIZER,NONE,ZERO -NONE,XAUDIOALARM,PERCENTCOMPLETE,NONE,ZERO -NONE,XAUDIOALARM,PRIORITY,NONE,ZERO -NONE,XAUDIOALARM,PRODID,NONE,ZERO -NONE,XAUDIOALARM,RDATE,NONE,ZERO -NONE,XAUDIOALARM,RECURRENCEID,NONE,ZERO -NONE,XAUDIOALARM,RELATEDTO,NONE,ZERO -NONE,XAUDIOALARM,REQUESTSTATUS,NONE,ZERO -NONE,XAUDIOALARM,RESOURCES,NONE,ZERO -NONE,XAUDIOALARM,RRULE,NONE,ZERO -NONE,XAUDIOALARM,SEQUENCE,NONE,ZERO -NONE,XAUDIOALARM,STATUS,NONE,ZERO -NONE,XAUDIOALARM,SUMMARY,NONE,ZERO -NONE,XAUDIOALARM,TRANSP,NONE,ZERO -NONE,XAUDIOALARM,TRIGGER,NONE,ONE -NONE,XAUDIOALARM,TZID,NONE,ZERO -NONE,XAUDIOALARM,TZNAME,NONE,ZERO -NONE,XAUDIOALARM,TZOFFSETFROM,NONE,ZERO -NONE,XAUDIOALARM,TZOFFSETTO,NONE,ZERO -NONE,XAUDIOALARM,TZURL,NONE,ZERO -NONE,XAUDIOALARM,UID,NONE,ZERO -NONE,XAUDIOALARM,URL,NONE,ZERO -NONE,XAUDIOALARM,VERSION,NONE,ZERO -NONE,XAUDIOALARM,X,NONE,ZEROPLUS -NONE,XDISPLAYALARM,ACTION,NONE,ONE -NONE,XDISPLAYALARM,ATTACH,NONE,ZERO -NONE,XDISPLAYALARM,ATTENDEE,NONE,ZERO -NONE,XDISPLAYALARM,CALSCALE,NONE,ZERO -NONE,XDISPLAYALARM,CATEGORIES,NONE,ZERO -NONE,XDISPLAYALARM,CLASS,NONE,ZERO -NONE,XDISPLAYALARM,COMMENT,NONE,ZERO -NONE,XDISPLAYALARM,COMPLETED,NONE,ZERO -NONE,XDISPLAYALARM,CONTACT,NONE,ZERO -NONE,XDISPLAYALARM,CREATED,NONE,ZERO -NONE,XDISPLAYALARM,DESCRIPTION,NONE,ONE -NONE,XDISPLAYALARM,DTEND,NONE,ZERO -NONE,XDISPLAYALARM,DTSTAMP,NONE,ZERO -NONE,XDISPLAYALARM,DTSTART,NONE,ZERO -NONE,XDISPLAYALARM,DUE,NONE,ZERO -NONE,XDISPLAYALARM,DURATION,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XDISPLAYALARM,REPEAT,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XDISPLAYALARM,EXDATE,NONE,ZERO -NONE,XDISPLAYALARM,EXRULE,NONE,ZERO -NONE,XDISPLAYALARM,FREEBUSY,NONE,ZERO -NONE,XDISPLAYALARM,GEO,NONE,ZERO -NONE,XDISPLAYALARM,LASTMODIFIED,NONE,ZERO -NONE,XDISPLAYALARM,LOCATION,NONE,ZERO -NONE,XDISPLAYALARM,METHOD,NONE,ZERO -NONE,XDISPLAYALARM,ORGANIZER,NONE,ZERO -NONE,XDISPLAYALARM,PERCENTCOMPLETE,NONE,ZERO -NONE,XDISPLAYALARM,PRIORITY,NONE,ZERO -NONE,XDISPLAYALARM,PRODID,NONE,ZERO -NONE,XDISPLAYALARM,RDATE,NONE,ZERO -NONE,XDISPLAYALARM,RECURRENCEID,NONE,ZERO -NONE,XDISPLAYALARM,RELATEDTO,NONE,ZERO -NONE,XDISPLAYALARM,REQUESTSTATUS,NONE,ZERO -NONE,XDISPLAYALARM,RESOURCES,NONE,ZERO -NONE,XDISPLAYALARM,RRULE,NONE,ZERO -NONE,XDISPLAYALARM,SEQUENCE,NONE,ZERO -NONE,XDISPLAYALARM,STATUS,NONE,ZERO -NONE,XDISPLAYALARM,SUMMARY,NONE,ZERO -NONE,XDISPLAYALARM,TRANSP,NONE,ZERO -NONE,XDISPLAYALARM,TRIGGER,NONE,ONE -NONE,XDISPLAYALARM,TZID,NONE,ZERO -NONE,XDISPLAYALARM,TZNAME,NONE,ZERO -NONE,XDISPLAYALARM,TZOFFSETFROM,NONE,ZERO -NONE,XDISPLAYALARM,TZOFFSETTO,NONE,ZERO -NONE,XDISPLAYALARM,TZURL,NONE,ZERO -NONE,XDISPLAYALARM,UID,NONE,ZERO -NONE,XDISPLAYALARM,URL,NONE,ZERO -NONE,XDISPLAYALARM,VERSION,NONE,ZERO -NONE,XDISPLAYALARM,X,NONE,ZEROPLUS -NONE,XEMAILALARM,ACTION,NONE,ONE -NONE,XEMAILALARM,ATTACH,NONE,ZEROPLUS -NONE,XEMAILALARM,ATTENDEE,NONE,ONEPLUS -NONE,XEMAILALARM,CALSCALE,NONE,ZERO -NONE,XEMAILALARM,CATEGORIES,NONE,ZERO -NONE,XEMAILALARM,CLASS,NONE,ZERO -NONE,XEMAILALARM,COMMENT,NONE,ZERO -NONE,XEMAILALARM,COMPLETED,NONE,ZERO -NONE,XEMAILALARM,CONTACT,NONE,ZERO -NONE,XEMAILALARM,CREATED,NONE,ZERO -NONE,XEMAILALARM,DESCRIPTION,NONE,ONE -NONE,XEMAILALARM,DTEND,NONE,ZERO -NONE,XEMAILALARM,DTSTAMP,NONE,ZERO -NONE,XEMAILALARM,DTSTART,NONE,ZERO -NONE,XEMAILALARM,DUE,NONE,ZERO -NONE,XEMAILALARM,DURATION,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XEMAILALARM,REPEAT,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XEMAILALARM,EXDATE,NONE,ZERO -NONE,XEMAILALARM,EXRULE,NONE,ZERO -NONE,XEMAILALARM,FREEBUSY,NONE,ZERO -NONE,XEMAILALARM,GEO,NONE,ZERO -NONE,XEMAILALARM,LASTMODIFIED,NONE,ZERO -NONE,XEMAILALARM,LOCATION,NONE,ZERO -NONE,XEMAILALARM,METHOD,NONE,ZERO -NONE,XEMAILALARM,ORGANIZER,NONE,ZERO -NONE,XEMAILALARM,PERCENTCOMPLETE,NONE,ZERO -NONE,XEMAILALARM,PRIORITY,NONE,ZERO -NONE,XEMAILALARM,PRODID,NONE,ZERO -NONE,XEMAILALARM,RDATE,NONE,ZERO -NONE,XEMAILALARM,RECURRENCEID,NONE,ZERO -NONE,XEMAILALARM,RELATEDTO,NONE,ZERO -NONE,XEMAILALARM,REQUESTSTATUS,NONE,ZERO -NONE,XEMAILALARM,RESOURCES,NONE,ZERO -NONE,XEMAILALARM,RRULE,NONE,ZERO -NONE,XEMAILALARM,SEQUENCE,NONE,ZERO -NONE,XEMAILALARM,STATUS,NONE,ZERO -NONE,XEMAILALARM,SUMMARY,NONE,ONE -NONE,XEMAILALARM,TRANSP,NONE,ZERO -NONE,XEMAILALARM,TRIGGER,NONE,ONE -NONE,XEMAILALARM,TZID,NONE,ZERO -NONE,XEMAILALARM,TZNAME,NONE,ZERO -NONE,XEMAILALARM,TZOFFSETFROM,NONE,ZERO -NONE,XEMAILALARM,TZOFFSETTO,NONE,ZERO -NONE,XEMAILALARM,TZURL,NONE,ZERO -NONE,XEMAILALARM,UID,NONE,ZERO -NONE,XEMAILALARM,URL,NONE,ZERO -NONE,XEMAILALARM,VERSION,NONE,ZERO -NONE,XEMAILALARM,X,NONE,ZEROPLUS -NONE,XPROCEDUREALARM,ACTION,NONE,ONE -NONE,XPROCEDUREALARM,ATTACH,NONE,ZEROORONE -NONE,XPROCEDUREALARM,ATTENDEE,NONE,ZERO -NONE,XPROCEDUREALARM,CALSCALE,NONE,ZERO -NONE,XPROCEDUREALARM,CATEGORIES,NONE,ZERO -NONE,XPROCEDUREALARM,CLASS,NONE,ZERO -NONE,XPROCEDUREALARM,COMMENT,NONE,ZERO -NONE,XPROCEDUREALARM,COMPLETED,NONE,ZERO -NONE,XPROCEDUREALARM,CONTACT,NONE,ZERO -NONE,XPROCEDUREALARM,CREATED,NONE,ZERO -NONE,XPROCEDUREALARM,DESCRIPTION,NONE,ZEROORONE -NONE,XPROCEDUREALARM,DTEND,NONE,ZERO -NONE,XPROCEDUREALARM,DTSTAMP,NONE,ZERO -NONE,XPROCEDUREALARM,DTSTART,NONE,ZERO -NONE,XPROCEDUREALARM,DUE,NONE,ZERO -NONE,XPROCEDUREALARM,DURATION,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XPROCEDUREALARM,REPEAT,NONE,ONEMUTUAL,icalrestriction_check_mutual -NONE,XPROCEDUREALARM,EXDATE,NONE,ZERO -NONE,XPROCEDUREALARM,EXRULE,NONE,ZERO -NONE,XPROCEDUREALARM,FREEBUSY,NONE,ZERO -NONE,XPROCEDUREALARM,GEO,NONE,ZERO -NONE,XPROCEDUREALARM,LASTMODIFIED,NONE,ZERO -NONE,XPROCEDUREALARM,LOCATION,NONE,ZERO -NONE,XPROCEDUREALARM,METHOD,NONE,ZERO -NONE,XPROCEDUREALARM,ORGANIZER,NONE,ZERO -NONE,XPROCEDUREALARM,PERCENTCOMPLETE,NONE,ZERO -NONE,XPROCEDUREALARM,PRIORITY,NONE,ZERO -NONE,XPROCEDUREALARM,PRODID,NONE,ZERO -NONE,XPROCEDUREALARM,RDATE,NONE,ZERO -NONE,XPROCEDUREALARM,RECURRENCEID,NONE,ZERO -NONE,XPROCEDUREALARM,RELATEDTO,NONE,ZERO -NONE,XPROCEDUREALARM,REQUESTSTATUS,NONE,ZERO -NONE,XPROCEDUREALARM,RESOURCES,NONE,ZERO -NONE,XPROCEDUREALARM,RRULE,NONE,ZERO -NONE,XPROCEDUREALARM,SEQUENCE,NONE,ZERO -NONE,XPROCEDUREALARM,STATUS,NONE,ZERO -NONE,XPROCEDUREALARM,SUMMARY,NONE,ZERO -NONE,XPROCEDUREALARM,TRANSP,NONE,ZERO -NONE,XPROCEDUREALARM,TRIGGER,NONE,ONE -NONE,XPROCEDUREALARM,TZID,NONE,ZERO -NONE,XPROCEDUREALARM,TZNAME,NONE,ZERO -NONE,XPROCEDUREALARM,TZOFFSETFROM,NONE,ZERO -NONE,XPROCEDUREALARM,TZOFFSETTO,NONE,ZERO -NONE,XPROCEDUREALARM,TZURL,NONE,ZERO -NONE,XPROCEDUREALARM,UID,NONE,ZERO -NONE,XPROCEDUREALARM,URL,NONE,ZERO -NONE,XPROCEDUREALARM,VERSION,NONE,ZERO -NONE,XPROCEDUREALARM,X,NONE,ZEROPLUS diff --git a/libical/design-data/status-new.txt b/libical/design-data/status-new.txt deleted file mode 100644 index 9e7bbf83a7..0000000000 --- a/libical/design-data/status-new.txt +++ /dev/null @@ -1,56 +0,0 @@ -2.0 STATOK Operation was successfully performed. -2.0.1 STARTSENDATA Start ICAL input; end with . -2.0.11 OKDATAFOLLOWS The request was processed successfully. Reply data follows on the next line and terminates with . -2.0.2 REPLYPENDING A timeout has occurred. The server is still working on the reply. Use CONTINUE to continue waiting for the reply or ABORT to terminate the command. -2.0.3 ABORTED The command currently underway was successsfully aborted. -2.0.4 WILLATTEMPT The specified Calendar is not here but an attempt will be made to deliver the request or reply to the Calendar anyway. -2.0.5 TRUSTEDWILLQUEUE The request or reply will be queued and delivered to the target calendar when its iRIP server contacts this server and issues the SWITCH command. -2.0.6 WILLATTEMPT The specified Calendar is not here but an attempt will be made to deliver the request or reply to the Calendar anyway. -2.0.7 QUEUED The message has been queued for delivery. -2.0.8 QUEUEEMPTY There are no more queued messages. -2.1 FALLBACK Success. Fallback taken on one or more property values. -2.2 NOCOMMANDINPROGRESS An ABORT or CONTINUE was received when no command was in progress -2.2 IGPROP Success. Invalid property ignored. -2.3 IGPARAM Success. invalid property parameter ignored. -2.4 IGXPROP Success. Unknown non-standard property ignored. -2.5 IGXPARAM Success. Unknown non standard property value ignored. -2.6 IGCOMP Success. Invalid calendar component ignored. -2.7 FORWARD Success. Request forwarded to Calendar User. -2.8 ONEEVENT Success. Repeating event ignored. Scheduled as a single component. -2.9 TRUNC Success. Truncated end date time to date boundary. -2.10 ONETODO Success. Repeating VTODO ignored. Scheduled as a single VTODO. -2.11 TRUNCRRULE Success. Unbounded RRULE clipped at some finite number of instances -3.0 INVPROPNAME Invalid property name. -3.1 INVPROPVAL Invalid property value. -3.2 INVPARAM Invalid property parameter. -3.3 INVPARAMVAL Invalid property parameter value. -3.4 INVCOMP Invalid calendar component sequence. -3.5 INVTIME Invalid date or time. -3.6 INVRULE Invalid rule. -3.7 INVCU Invalid Calendar User. -3.8 NOAUTH No authority. -3.9 BADVERSION Unsupported version. -3.10 TOOBIG Request entity too large. -3.11 MISSREQCOMP Required component or property missing. -3.12 UNKCOMP Unknown component or property found. -3.13 BADCOMP Unsupported component or property found -3.14 NOCAP Unsupported capability. -4.0 BUSY Event conflict. Date/time is busy. -5.0 MAYBE Request MAY supported. -5.1 UNAVAIL Service unavailable. -5.2 NOSERVICE Invalid calendar service. -5.3 NOSCHED No scheduling support for user. -6.1 AUTHENTICATEFAILURE Unsupported authentication mechanism, credentials rejected -6.2 AUTHENTICATIONABORTED Sender aborted authentication, authentication exchange cancelled -8.0 GENERALFAILURE A failure has occurred in the Receiver that prevents the operation from succeeding. -8.1 SERVERTOOBUSY The iRIP Receiver is too busy. -8.2 ICALOBJECTTOOBIG Object has exceeded the server's size limit. -8.3 DATETOOLARGE A DATETIME value was too far in the future to be represented on this Calendar. -8.4 DATETOOSMALL A DATETIME value was too far in the past to be represented on this Calendar. -9.0 INVALIDIRIPCOMMAND An unrecongnized command was received. -9.1 UNEXPECTEDCOMMAND The command is not allowed for the server's current state. -10.1 REFERRAL Accompanied by an alternate address. -10.2 SERVERSHUTDOWN The server is shutting down. -10.3 SERVERSTOPPING FLOOD 2 -10.4 EXCEEDEDQUOTAS The operation would cause a resource to exceed the allocated quota -10.5 QUEUEDTOOLONG The ITIP message has been queued too long. Delivery has been aborted. diff --git a/libical/design-data/status.foo b/libical/design-data/status.foo deleted file mode 100644 index a2591bd26a..0000000000 --- a/libical/design-data/status.foo +++ /dev/null @@ -1,104 +0,0 @@ -2.0 STATOK Operation was successfully performed. - -2.0.1 START-SENDATA Start ICAL input; end with - . - -2.0.11 OK-DATAFOLLOWS The request was processed - successfully. Reply data follows on - the next line and terminates with - . - -2.0.2 REPLY-PENDING A timeout has occurred. The server is - still working on the reply. Use - CONTINUE to continue waiting for the - reply or ABORT to terminate the - command. - -2.0.3 ABORTED In response to the client issuing an - ABORT command, this reply code - indicates that any command currently - underway was successsfully aborted. - -2.0.4 WILL-ATTEMPT The specified Calendar is not here - but an attempt will be made to deliver - the request or reply to the Calendar - anyway. There is a trust relationship - between this iRIP server and the - iRIP server for the target calendar. - -2.0.5 TRUSTED-WILL-QUEUE The specified Calendar cannot be - contacted directly and a trust - relationship exists between this - server and the server on which the - Calendar exists. The request or reply - will be queued and delivered to the - target calendar when its iRIP server - contacts this server and issues the - SWITCH command. - -2.0.6 WILL-ATTEMPT The specified Calendar is not here - but an attempt will be made to deliver - the request or reply to the Calendar - anyway. There is not a trust - relationship between the iRIP server - and the iRIP server for the target - calendar. - -2.0.7 QUEUED The message has been queued for - delivery. - -2.0.8 QUEUE-EMPTY There are no more queued messages. - -2.2 NO COMMAND IN PROGRESS An ABORT or CONTINUE was received when - no command was in progress - -6.1 AUTHENTICATE FAILURE Unsupported authentication mechanism, - credentials rejected - -6.2 AUTHENTICATION ABORTED Sender aborted authentication, - authentication exchange cancelled - -8.0 GENERAL FAILURE A failure has occurred in the Receiver - that prevents the operation from - succeeding. - -8.1 SERVER TOO BUSY Sent when a session cannot be - established because the iRIP - Receiver is too busy. - -8.2 ICAL OBJECT TOO BIG Used to signal that an ICAL object has - exceeded the server's size limit. - -8.3 DATE TOO LARGE A DATETIME value was too far in the - future to be represented on this - Calendar. - -8.4 DATE TOO SMALL A DATETIME value was too far in the - past to be represented on this - Calendar. - -9.0 INVALID iRIP COMMAND An unrecongnized command was received. - -9.1 UNEXPECTED COMMAND A command was issued in a manner - inconsistent with the state diagram. - For example, issuing the SENDATA - command without having specified any - RECIPIENTs will cause this error. -10.1 REFERRAL Accompanied by an alternate address. - The RECIPIENT specified should be - contacted at the given alternate - address. The referral address MUST - follow the reply code. - -10.2 SERVER SHUT DOWN The server is shutting down. - -10.3 SERVER STOPPING FLOOD 2 - - -10.4 EXCEEDED QUOTAS The operation has not be performed - because it would cause the resources - (memory, disk, CPU, etc) to exceed the - allocated quota - -10.5 QUEUED TOO LONG The ITIP message has been queued too - long. Delivery has been aborted. \ No newline at end of file diff --git a/libical/design-data/status.txt b/libical/design-data/status.txt deleted file mode 100644 index d3f2f1864d..0000000000 --- a/libical/design-data/status.txt +++ /dev/null @@ -1,32 +0,0 @@ -2.0 Success. -2.1 Success but fallback taken on one or more property values. -2.2 Success, invalid property ignored. -2.3 Success, invalid property parameter ignored. -2.4 Success, unknown non-standard property ignored. -2.5 Success, unknown non-standard property value ignored. -2.6 Success, invalid calendar component ignored. -2.7 Success, request forwarded to Calendar User. -2.8 Success, repeating event ignored. Scheduled as a single component. -2.9 Success, truncated end date time to date boundary. -2.10 Success, repeating VTODO ignored. Scheduled as a single VTODO. -2.11 Success, unbounded RRULE clipped at some finite number of instances -3.0 Invalid property name. -3.1 Invalid property value. -3.2 Invalid property parameter. -3.3 Invalid property parameter value. -3.4 Invalid calendar component sequence. -3.5 Invalid date or time. -3.6 Invalid rule. -3.7 Invalid Calendar User. -3.8 No authority. -3.9 Unsupported version. -3.10 Request entity too large. -3.11 Required component or property missing. -3.12 Unknown component or property found -3.13 Unsupported component or property found -3.14 Unsupported capability -4.0 Event conflict. Date/time is busy. -5.0 Request MAY supported. -5.1 Service unavailable. -5.2 Invalid calendar service. -5.3 No scheduling support for user. diff --git a/libical/design-data/value-c-types.txt b/libical/design-data/value-c-types.txt deleted file mode 100644 index 0bc8c9a7a0..0000000000 --- a/libical/design-data/value-c-types.txt +++ /dev/null @@ -1,21 +0,0 @@ -ATTACH struct icalattachtype # Non-std -BINARY char* -BOOLEAN int -CAL-ADDRESS char* -DATE struct icaltimetype -DATE-TIME struct icaltimetype -DATE-TIME-DATE struct icaltimetype # Non-std -DATE-TIME-PERIOD struct icalperiodtype # Non-std -DURATION struct icaldurationtype -FLOAT float -GEO struct icalgeotype # Non-std -INTEGER int -METHOD icalproperty_method # Non-std -PERIOD struct icalperiodtype -RECUR struct icalrecurrencetype -TEXT char* -TIME struct icaltimetype -TRIGGER union icaltriggertype # Non-std -URI char* -UTC-OFFSET int -QUERY char* diff --git a/libical/design-data/value-mem-semantics.txt b/libical/design-data/value-mem-semantics.txt deleted file mode 100644 index 5948e244f6..0000000000 --- a/libical/design-data/value-mem-semantics.txt +++ /dev/null @@ -1,19 +0,0 @@ -ATTACH struct icalattachtype -BINARY char* -BOOLEAN int -CAL-ADDRESS char* -DATE time_t -DATE-TIME time_t -DATE-TIME-DATE time_t -DATE-TIME-PERIOD struct icalperiodtype -DURATION struct icaldurationtype -FLOAT float -GEO struct icalgeotype -INTEGER int -PERIOD struct icalperiodtype -RECUR struct icalrecurrencetype -TEXT char* -TIME time_t -TRIGGER struct icaltriggertimetype -URI char* -UTC-OFFSET int diff --git a/libical/doc/UsingLibical.lyx b/libical/doc/UsingLibical.lyx deleted file mode 100644 index 20eaffd288..0000000000 --- a/libical/doc/UsingLibical.lyx +++ /dev/null @@ -1,719 +0,0 @@ -#This file was created by Mon Feb 7 20:19:42 2000 -#LyX 1.0 (C) 1995-1999 Matthias Ettrich and the LyX Team -\lyxformat 2.15 -\textclass linuxdoc -\language default -\inputencoding default -\fontscheme default -\graphics default -\paperfontsize default -\spacing single -\papersize Default -\paperpackage a4 -\use_geometry 0 -\use_amsmath 0 -\paperorientation portrait -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\defskip medskip -\quotes_language english -\quotes_times 2 -\papercolumns 1 -\papersides 1 -\paperpagestyle default - -\layout Title - -Using Libical -\layout Author - -Eric Busboom (eric@softwarestudio.org) -\layout Date - -January 2000 -\layout Section - -Introduction -\layout Standard - -Libical is an Open Source implementation of the iCalendar protocols and - protocol data units. - The iCalendar specification describes how calendar clients can communicate - with calendar servers for users can store their calendar data and arrange - meetings with other users. - -\layout Standard - -Libical implements the following specifications and protocols -\layout Standard -\added_space_top 0.3cm \added_space_bottom 0.3cm \align center \LyXTable -multicol5 -5 2 0 0 -1 -1 -1 -1 -1 1 0 0 -1 1 0 0 -1 1 0 0 -1 1 0 0 -1 1 0 0 -8 1 0 "" "" -8 1 1 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" - -iCal Core -\newline -2445 -\newline -iTIP -\newline -2446 -\newline -iMIP -\newline -2447 -\newline -iRIP -\newline -draft -\newline -CAP -\newline -draft -\layout Standard - -(The current version, 0.14, does not implement iRip or CAP. - ) -\layout Standard - -This documentation assumes that you are familiar with the iCalendar standards - RFC2445 and RFC2446. -\layout Subsection - -The libical project -\layout Standard - -This code is under active development. - If you would like to contribute to the project, you can contact me, Eric - Busboom, at eric@softwarestudio.org. - The project has a webpage at -\layout Quote - -http://softwarestudio.org/libical/index.html -\layout Standard - -and a mailing list that you can join by sending the following mail: -\layout Code - -To: minimalist@softwarestudio.org -\layout Code - -Subject: subscribe libical -\layout Subsection - -License -\layout Standard - -The code and datafiles in this distribution are licensed under the Mozilla - Public License. - See http://www.mozilla.org/NPL/MPL-1.0.html for a copy of the license. - Alternately, you may use libical under the terms of the GNU Library General - Public License. - See http://www.fsf.org/copyleft/lesser.html for a copy of the LGPL. -\layout Standard - -This dual license ensures that the library can be incorporated into both - proprietary code and GPL'd programs, and will benefit from improvements - made by programmers in both realms. - I will only accept changes into my version of the library if they are similarly - dual-licensed. -\layout Subsection - -Purpose & Goals -\layout Subsection - -Document version -\layout Standard - -$Id: UsingLibical.lyx,v 1.1 2000/02/17 18:02:36 alves Exp $ -\layout Section - -Building the Library -\layout Section - -Structure -\layout Standard - -The iCal calendar model is based on four types of objects: components, propertie -s, values and parameters. - -\layout Standard - -Properties are the fundamental unit of information in iCal, and they work - a bit like a hash entry, with a constant key and a variable value. - Properties may also have modifiers, called parameters. - In the iCal content line -\layout Code - -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -\layout Standard - -The property name is -\begin_inset Quotes eld -\end_inset - -ORGANIZER, -\begin_inset Quotes erd -\end_inset - - the value of the property is -\begin_inset Quotes eld -\end_inset - -mrbig@host.com -\begin_inset Quotes erd -\end_inset - - and the -\begin_inset Quotes eld -\end_inset - -ROLE -\begin_inset Quotes erd -\end_inset - - parameter specifies that Mr Big is the chair of the meetings associated - with this property. - -\layout Standard - -Components are groups of properties that represent the core objects of a - calendar system, such as events or timezones. - -\layout Standard - -The central goal of libical is to parse iTIP data into an internal representatio -n of Components, Properties, Parameters an Values, and to allow the user - to manipulate the data in various ways -\layout Subsection - -Components -\layout Subsection - -Properties -\layout Subsection - -Values -\layout Subsection - -Parameters -\layout Subsection - -Enumerations -\layout Subsection - -Types -\layout Subsection - -The Parser -\layout Subsection - -Restrictions -\layout Subsection - -Memory Management -\layout Section - -Differences From RFCs -\layout Standard - -Libical has been designed to follow the standards as closely as possible, - so that the key objects in the standards are also keey objects in the library. - However, there are a few areas where the specifications are (arguably) - irregular, and following them exactly would result in an unfriendly interface. - These deviations make libical easier to use by maintaining a self-similar - interface. - -\layout Subsection - -Pseudo Components -\layout Standard - -Libical defines components for groups of properties that look and act like - components, but are not defined as components in the specification. - XDAYLIGHT and XSTANDARD are notable examples. - These pseudo components group properties within the VTIMEZONE components. - XDAYLIGHT starts with -\begin_inset Quotes eld -\end_inset - -BEGIN:DAYLIGHT -\begin_inset Quotes erd -\end_inset - - and ends with -\begin_inset Quotes eld -\end_inset - -END:DAYLIGHT, just like other components, but is not defined as a component - in RFC2445. - ( See RFC2445, page 61 ) In Libical, it is a component. - -\layout Standard - -There are also pseudo components that are conceptually derived classess - of VALARM. - RFC2446 defines what properties may be included in each component, and - for VALARM, the set of properties it may have depends on the value of the - ACTION property. - -\layout Standard - -For instance, if a VALARM component has an ACTION property with the value - of -\begin_inset Quotes eld -\end_inset - -AUDIO, -\begin_inset Quotes erd -\end_inset - - the component must also have an -\begin_inset Quotes eld -\end_inset - -ATTACH -\begin_inset Quotes erd -\end_inset - - property. - However, if the ACTION value is -\begin_inset Quotes eld -\end_inset - -DISPLAY, -\begin_inset Quotes erd -\end_inset - - the component must have a DESCRIPTION property. - -\layout Standard - -To handle these various, complex restrictions, libical has pseudo components - for each type of alarm: XAUDIOALARM, XDISPLAYALARM, XEMAILALARM and XPROCEDUREA -LARM. - -\layout Subsection - -Combined Values -\layout Standard - -Many values can take more than one type. - TRIGGER, for instance, can have a value type of with DURATION or of DATE-TIME. - These multiple types make it difficult to create routines to return the - value associated with a property. - -\layout Standard - -It is natural to have interfaces that would return the value of a property, - but it is cumbersone for a single routine to return multiple types. - So, in libical, properties that can have multiple types are given a single - type that is the union of their RFC2445 types. - For instance, in libical, the value of the TRIGGER property resolves to - -\noun on -struct icaltriggertype -\noun default -. - This type is a union of a DURATION and a DATE-TIME. - -\layout Subsection - -Multi-Valued Properties -\layout Standard - -Some properties, such as CATEGORIES have only one value type, but each CATEGORIE -S property can have multiple value instances. - This also results in a cumbersome interface -- CATEGORIES accessors would - have to return a list while all other accessors returned a single value. - In libical, all properties have a single value, and multi-valued properties - are broken down into multiple single valued properties during parsing. - That is, an input line like, -\layout Code - -CATEGORIES: work, home -\layout Standard - -becomes in libical's internal representation -\layout Code - -CATEGORIES: work -\layout Code - -CATEGORIES: home -\layout Standard - -Oddly, RFC2445 allows some multi-valued properties ( like FREEBUSY ) to - exist as both a multi-values property and as multiple single value properties, - while others ( like CATEGORIES ) can only exist as single multi-valued - properties. - This makes the internal representation for CATEGORIES illegal. - However when you convert a component to a string, the library will collect - all of the CATEGORIES properties into one. - -\layout Section - -Implementation Limitations -\layout Section - -Using libical -\layout Subsection - -Creating Components -\layout Standard - -There are three ways to create components in Libical: creating individual - objects and assembling them, building entire objects in massive vaargs - calls, and parsing a text file containing iCalendar data. - -\layout Subsubsection - -Constructor Interfaces -\layout Standard - -Using constructor interfaces, you create each of the objects seperately - and them assemble them in to components: -\layout Code - -event = icalcomponent_new(ICAL_VEVENT_COMPONENT); -\layout Code - -icalcomponent_add_property(event, icalproperty_new_dtstamp(atime) ); -\layout Code - -icalcomponent_add_property(event,icalproperty_new_uid(strdup("guid-1.host1.com")) - ); -\layout Code - -property=icalproperty_new_organizer(strdup("mrbig@host.com")); -\layout Code - -icalproperty_add_parameter(property,icalparameter_new_role(ICAL_ROLE_CHAIR) - ); -\layout Code - -icalcomponent_add_property(event,property); -\layout Subsubsection - -vaargs Constructors -\layout Subsubsection - -Parsing Text Files -\layout Subsection - -Accessing Components -\layout Subsubsection - -Finding Components -\layout Subsubsection - -Removing Components -\layout Standard - -Removing an element from a list while iterating through the list can cause - problems, since you will probably be removing the element that the internal - iterator points to. - This will result in the iteration loop terminating immediately after removing - the element. - To avoid the problem, you will need to step the iterator ahead of the element - you are going to remove, like this: -\layout Code - -for(c = icalcomponent_get_first_component(parent_comp,ICAL_ANY_COMPONENT); - -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -c != 0; -\layout Code - - -\protected_separator - -\protected_separator - -\protected_separator - -\protected_separator -c = next -\layout Code - -{ -\layout Code - - -\protected_separator - -\protected_separator - next = icalcomponent_get_next_component(parent_comp,ICAL_ANY_COMPONENT); -\layout Code - - -\protected_separator - -\protected_separator - icalcomponent_remove_component(parent_comp,c); -\layout Code - -} -\layout Subsubsection - -Finding Properties -\layout Subsubsection - -Removing Properties -\layout Subsubsection - -Getting Values -\layout Subsubsection - -Setting Values -\layout Subsubsection - -Getting Parameters -\layout Subsubsection - -Setting Parameters -\layout Subsubsection - -Removing Parameters -\layout Subsubsection - -Checking Component Validity -\layout Subsection - -Storing Objects -\layout Standard - -The libical distribution inclues a seperate library, libicalss, that allows - you to store iCal component data to disk in a variety of ways. - This library is documented seperately. - -\layout Subsection - -Memory Management -\layout Standard - -Libical relies heavily on dynamic allocation for both the core objects and - for the strings used to hold values. - Some of this memory the library caller owns and must free, and some of - the memory is managed by the library. - Here is a summary of the memory rules. - -\layout Description - -1) If the function name has "new" in it, the caller gets control of the - memory. - ( such as icalcomponent_new(), or icalproperty_new_clone() ) -\layout Description - -2) If you got the memory from a routine with new in it, you must call the - corresponding *_free routine to free the memory. - ( Use icalcomponent_free() to free objects created with icalcomponent_new()) - -\layout Description - -3) If the function name has "add" in it, the caller is transfering control - of the memory to the routine. - ( icalproperty_add_parameter() ) -\layout Description - -4) If the function name has "remove" in it, the caller passes in a pointer - to an object and after the call returns, the caller owns the object. - So, before you call icalcomponent_remove_property(comp,foo), you do not - own "foo" and after the call returns, you do. - -\layout Description - -5) If the routine returns a string, libical owns the memory and will put - it on a ring buffer to reclaim later. - You'd better strdup() it if you want to keep it, and you don't have to - delete it. - -\layout Subsection - -Error Handling -\layout Standard - -icalerror_errno. - Return values. - #defines. - icalerror_stop_here -\layout Subsubsection - -Return values -\layout Subsubsection - -icalerrno -\layout Subsubsection - -Component errors -\layout Subsection - -Naming Standard -\layout Standard - -Structures that you access with the -\begin_inset Quotes eld -\end_inset - -struct -\begin_inset Quotes erd -\end_inset - - keyword, such as -\begin_inset Quotes eld -\end_inset - -struct icaltimetype -\begin_inset Quotes erd -\end_inset - - are things that you are allowed to see inside and poke at. - -\layout Standard - -Structures that you access though a typedef, such as -\begin_inset Quotes eld -\end_inset - -icalcomponent -\begin_inset Quotes erd -\end_inset - - are things where all of the data is hidden. - -\layout Standard - -Component names that start with -\begin_inset Quotes eld -\end_inset - -V -\begin_inset Quotes erd -\end_inset - - are part of RFC 2445 or another iCal standard. - Component names that start with -\begin_inset Quotes eld -\end_inset - -X -\begin_inset Quotes erd -\end_inset - - are also part of the spec, but they are not actually components in the - spec. - However, they look and act like components, so they are components in libical. - Names that start with -\begin_inset Quotes eld -\end_inset - -XLIC -\begin_inset Quotes erd -\end_inset - - or -\begin_inset Quotes eld -\end_inset - -X-LIC -\begin_inset Quotes erd -\end_inset - - are not part of any iCal spec. - They are used internally by libical. - -\layout Standard - -Enums that identify a component, property, value or parameter end with -\begin_inset Quotes eld -\end_inset - -_COMPONENT, -\begin_inset Quotes erd -\end_inset - - -\begin_inset Quotes eld -\end_inset - -_PROPERTY, -\begin_inset Quotes erd -\end_inset - - -\begin_inset Quotes eld -\end_inset - -_VALUE, -\begin_inset Quotes erd -\end_inset - - or -\begin_inset Quotes eld -\end_inset - -_PAAMETER -\begin_inset Quotes erd -\end_inset - -s -\layout Standard - -Enums that identify a parameter value have the name of the parameter as - the second word. - For instance: ICAL_ROLE_REQPARTICIPANT or ICAL_PARTSTAT_ACCEPTED. -\layout Standard - -The enums for the parts of a recurarance rule and request statuses are irregular. - -\layout Section - -Useful Recipies -\layout Standard - -Iteration -\layout Standard - -Copying components. - Remember that you must clone or remove an object before putting in on anothr - list. - -\layout Standard - -Finding compliance errors -\layout Section - -Performance -\layout Standard - -Checking restrictions is computationally expensive -\layout Section - -Hacks and Bugs -\the_end diff --git a/libical/doc/UsingLibical.sgml b/libical/doc/UsingLibical.sgml deleted file mode 100644 index d967bd860c..0000000000 --- a/libical/doc/UsingLibical.sgml +++ /dev/null @@ -1,318 +0,0 @@ - - - -
- -Using Libical - - -Eric Busboom (eric@softwarestudio.org) - - -January 2000 - - -Introduction -

-Libical is an Open Source implementation of the iCalendar protocols and - protocol data units. The iCalendar specification describes how calendar clients - can communicate with calendar servers for users can store their calendar data - and arrange meetings with other users. -

-

-Libical implements the following specifications and protocols -

-

-iCal Core -2445 -iTIP -2446 -iMIP -2447 -iRIP -draft -CAP -draft -

-

-(The current version, 0.14, does not implement iRip or CAP. ) -

-

-This code is under active development. If you would like to contribute - to the project, you can contact me, Eric Busboom, at eric@softwarestudio.org. - The project has a webpage at -

-

- -http://softwarestudio.org/libical/index.html - -

-and a mailing list that you can join by sending the following mail: -

-

- ------------- -To: minimalist@softwarestudio.org -Subject: subscribe libical ------------- - -

-$Id: UsingLibical.lyx,v 1.3 2000/01/06 06:20:06 eric Exp eric $ -

- -License -

-The code and datafiles in this distribution are licensed under the Mozilla - Public License. See http://www.mozilla.org/NPL/MPL-1.0.html for a copy of the - license. Alternately, you may use libical under the terms of the GNU Library - General Public License. See http://www.fsf.org/copyleft/lesser.html for a copy - of the LGPL. -

-

-This dual license ensures that the library can be incorporated into both - proprietary code and GPL'd programs, and will benefit from improvements made - by programmers in both realms. I will only accept changes into my version of - the library if they are similarly dual-licensed. -

- -Purpose & Goals - -Building the Library - -Structure -

-The iCal calendar model is based on four types of objects: components, - properties, values and parameters. -

-

-Components are the fundamental grouping of calendar information -

-

-Properties are the fundamental unit of information. Each property is composed - of a type, a value and collection of parameters. -

- -Components -

-Components are named clusters of properties -

- -Properties - -Values - -Parameters - -Storage - -Cluster - -Store - -Calendar - -Other bits -

-Restrictions -

-

-Types -

- -Differences From RFCs -

-Although libical has been design to follow the standards as closely as - possible, there are a few areas where the specifications are irregular, and - following them exactly would result in an unfriendly interface. -

- -Pseudo Components -

-Libical defines pseudo components for groups of properties that look and - act like components, but are not defined as components in the specification. - XDAYLIGHT and XSTANDARD are notable examples. These pseudo components group - properties within the VTIMEZONE components. XDAYLIGHT starts with "BEGIN:DAYLIGHT" - and ends with "END:DAYLIGHT, just like other components, but is not defined - as a component in RFC2445. ( See RFC2445, page 61 ) In Libical, it is a component. - -

-

-There are also pseudo componentsthat are conceptually derived classess - of VALARM. RFC2446 defines what properties may be included in each component, - and for VALARM, the set of properties it may have depends on the value of the - ACTION property. -

-

-For instance, if a VALARM component has an ACTION property with the value - of "AUDIO," the component must also have an "ATTACH" property. However, if the - ACTION value is "DISPLAY," the component must have a DESCRIPTION property. -

-

-To handle these various, complex restrictions, libical has pseudo components - for each type of alarm: XAUDIOALARM, XDISPLAYALARM, XEMAILALARM and XPROCEDUREALARM. - -

- -Combined Values -

-Many values can take more than one type. TRIGGER, for instance, can have - a value type of with DURATION or of DATE-TIME. It is natural to have interfaces - that would return the value of a property, but it is cumbersone for a single - routine to return multiple types. So, in libical, properties that can have - multiple types are given a single type that is the union of their RFC2445 types. - In libical, the value of the TRIGGER property resolves to -

-

-struct icaltriggertype -

-

-This type is a union of a DURATION and a DATE-TIME. -

- -Multi-Valued Properties -

-Some properties, such as CATEGORIES, have a single value type, but may - have multiple values in a single instance. This also results in a cumbersome - interface -- CATEGORIES accessors would have to return a list which all other - accessors returned a single value. In libical, all properties have a single - value, and multi-valued properties are broken down into multiple single valued - properties during parsing. The is, -

-

- -CATEGORIES: work, home - -

-becomes in libical's internal representation -

-

- -CATEGORIES: work -CATEGORIES: home - -

-Oddly, RFC2445 allows some multi-valued properties ( like FREEBUSY ) to - exist as both a multi-values property and as multiple single value properties, - while others ( like CATEGORIES ) can only exist as single multi-valued properties. - This makes the internal representation for CATEGORIES illegal. However when - you convert a component to a string, the library will collect all of the CATEGORIES - properties into one. -

- -Implementation Limitations - -Using libical - -Creating Components - -Constructor interfaces - -vaargs Constructors - -Parsing Text Files - -Accessing Components - -Finding Components - -Removing Components -

-Removing an element from a list while iterating through the list can cause - problems, since you will probably be removing the element that the internal - iterator points to. This will result in the iteration loop terminating immediately - after removing the element. To avoid the problem, you will need to step the - iterator ahead of the element you are going to remove, like this: -

-

- -for(c = icalcomponent_get_first_component(s); - c != 0; - c = next) -{ - next = icalcomponent_get_next_component(s); - icalcomponent_remove_component(s,c); -} - -

-Finding Properties - -Removing Properties - -Getting Values - -Setting Values - -Getting Parameters - -Setting Parameters - -Removing Parameters - -Storing Objects -

-When you store a component to the database with icalstore_add_component, - you give the library takes the memory, so the caller does not own the component - anymore. If you want to keep ownership, use clone to make a copy. ( See "Memory - Management" and "Naming Starndard for more about routines with "add" in the name. - ) -

- -Memory Management -

-Here are the memory rules for the C library: -

-

- - -1)If the function name has "new" in it, the caller gets - control of the memory. ( such as icalcomponent_new(), or icalproperty_new_clone() - ) - -2)If you got the memory from a routine with new in it, you must - call the corresponding *_free routine to free the memory. ( Use icalcomponent_free() - to free objects created with icalcomponent_new()) - -3)If the function name has "add" in it, the caller is - transfering control of the memory to the routine. ( icalproperty_add_parameter() - ) - -4)If the function name has "remove" in it, the caller - passes in a pointer to an object and after the call returns, the caller owns - the object. So, before you call icalcomponent_remove_property(comp,foo), you - do not own "foo" and after the call returns, you do. - -5)If the routine returns a string, libical owns the memory and will - put it on a ring buffer to reclaim later. You'd better strdup it if you want - to keep it, and you don't have to delete it. - -

-Error Handling - -Return values - -icalerrno - -Component errors - -Naming Standard -

-Structures that you access with the "struct" keyword, such as "struct icaltimetype" - are things that you are allowed to see inside and poke at. -

-

-Structures that you access though a typedef, such as "icalcomponent" are - things where all of the data is hidden. -

-

-Component names that start with "V" are part of RFC 2445 or another iCal - standard. Component names that start with "X" are also part of the spec, but - they are not actually components in the spec. However, they look and act like - components, so they are components in libical. Names that start with "XLIC" or - "X-LIC" are not part of any iCal spec. They are used internally by libical. -

- -Hacks and Bugs - - -
diff --git a/libical/doc/UsingLibical.txt b/libical/doc/UsingLibical.txt deleted file mode 100644 index f80ea31121..0000000000 --- a/libical/doc/UsingLibical.txt +++ /dev/null @@ -1,302 +0,0 @@ - - -Using Libical - -Eric Busboom (eric@softwarestudio.org) - -January 2000 - -1 Introduction - -Libical is an Open Source implementation of the iCalendar protocols -and protocol data units. The iCalendar specification describes how -calendar clients can communicate with calendar servers for users can -store their calendar data and arrange meetings with other users. - -Libical implements the following specifications and protocols - -+----------+-------+ -|iCal Core | 2445 | -+----------+-------+ -+----------+-------+ -| iTIP | 2446 | -+----------+-------+ -+----------+-------+ -| iMIP | 2447 | -+----------+-------+ -+----------+-------+ -| iRIP | draft | -+----------+-------+ -+----------+-------+ -| CAP | draft | -+----------+-------+ - - -(The current version, 0.14, does not implement iRip or CAP. ) - -This documentation assumes that you are familiar with the iCalendar -standards RFC2445 and RFC2446. - -1.1 The libical project - -This code is under active development. If you would like to contribute -to the project, you can contact me, Eric Busboom, at eric@softwarestudio.org. -The project has a webpage at - -http://softwarestudio.org/libical/index.html - -and a mailing list that you can join by sending the following mail: - ------------- - -To: minimalist@softwarestudio.org - -Subject: subscribe libical - ------------- - -1.2 License - -The code and datafiles in this distribution are licensed under the -Mozilla Public License. See http://www.mozilla.org/NPL/MPL-1.0.html -for a copy of the license. Alternately, you may use libical under -the terms of the GNU Library General Public License. See http://www.fsf.org/copyleft/lesser.html -for a copy of the LGPL. - -This dual license ensures that the library can be incorporated into -both proprietary code and GPL'd programs, and will benefit from improvements -made by programmers in both realms. I will only accept changes into -my version of the library if they are similarly dual-licensed. - -1.3 Purpose & Goals - -1.4 Document version - -$Id$ - -2 Building the Library - -3 Structure - -The iCal calendar model is based on four types of objects: components, -properties, values and parameters. - -Properties are the fundamental unit of information in iCal, and they -work a bit like a hash entry, with a constant key and a variable value. -Properties may also have modifiers, called parameters. In the iCal -content line - -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com - -The property name is ``ORGANIZER,'' the value of the property is ``mrbig@host.com'' -and the ``ROLE'' parameter specifies that Mr Big is the chair of the -meetings associated with this property. - -Components are groups of properties that represent the core objects -of a calendar system, such as events or timezones. - -The central goal of libical is to parse iTIP data into an internal -representation of Components, Properties, Parameters an Values, and -to allow the user to manipulate the data in various ways - -3.1 Components - -3.2 Properties - -3.3 Values - -3.4 Parameters - -3.5 Enumerations - -3.6 Types - -3.7 The Parser - -3.8 Restrictions - -3.9 Memory Management - -4 Differences From RFCs - -Libical has been designed to follow the standards as closely as possible, -so that the key objects in the standards are also keey objects in -the library. However, there are a few areas where the specifications -are (arguably) irregular, and following them exactly would result -in an unfriendly interface. These deviations make libical easier to -use by maintaining a self-similar interface. - -4.1 Pseudo Components - -Libical defines components for groups of properties that look and act -like components, but are not defined as components in the specification. -XDAYLIGHT and XSTANDARD are notable examples. These pseudo components -group properties within the VTIMEZONE components. XDAYLIGHT starts -with ``BEGIN:DAYLIGHT'' and ends with ``END:DAYLIGHT, just like other -components, but is not defined as a component in RFC2445. ( See RFC2445, -page 61 ) In Libical, it is a component. - -There are also pseudo components that are conceptually derived classess -of VALARM. RFC2446 defines what properties may be included in each -component, and for VALARM, the set of properties it may have depends -on the value of the ACTION property. - -For instance, if a VALARM component has an ACTION property with the -value of ``AUDIO,'' the component must also have an ``ATTACH'' property. -However, if the ACTION value is ``DISPLAY,'' the component must have -a DESCRIPTION property. - -To handle these various, complex restrictions, libical has pseudo components -for each type of alarm: XAUDIOALARM, XDISPLAYALARM, XEMAILALARM and -XPROCEDUREALARM. - -4.2 Combined Values - -Many values can take more than one type. TRIGGER, for instance, can -have a value type of with DURATION or of DATE-TIME. These multiple -types make it difficult to create routines to return the value associated -with a property. - -It is natural to have interfaces that would return the value of a property, -but it is cumbersone for a single routine to return multiple types. -So, in libical, properties that can have multiple types are given -a single type that is the union of their RFC2445 types. For instance, -in libical, the value of the TRIGGER property resolves to struct icaltriggertype. -This type is a union of a DURATION and a DATE-TIME. - -4.3 Multi-Valued Properties - -Some properties, such as CATEGORIES have only one value type, but each -CATEGORIES property can have multiple value instances. This also results -in a cumbersome interface -- CATEGORIES accessors would have to return -a list while all other accessors returned a single value. In libical, -all properties have a single value, and multi-valued properties are -broken down into multiple single valued properties during parsing. -That is, an input line like, - -CATEGORIES: work, home - -becomes in libical's internal representation - -CATEGORIES: work - -CATEGORIES: home - -Oddly, RFC2445 allows some multi-valued properties ( like FREEBUSY -) to exist as both a multi-values property and as multiple single -value properties, while others ( like CATEGORIES ) can only exist -as single multi-valued properties. This makes the internal representation -for CATEGORIES illegal. However when you convert a component to a -string, the library will collect all of the CATEGORIES properties -into one. - -5 Implementation Limitations - -6 Using libical - -6.1 Creating Components - -6.1.1 Constructor Interfaces - -6.1.2 vaargs Constructors - -6.1.3 Parsing Text Files - -6.2 Accessing Components - -6.2.1 Finding Components - -6.2.2 Removing Components - -Removing an element from a list while iterating through the list can -cause problems, since you will probably be removing the element that -the internal iterator points to. This will result in the iteration -loop terminating immediately after removing the element. To avoid -the problem, you will need to step the iterator ahead of the element -you are going to remove, like this: - -for(c = icalcomponent_get_first_component(s); - - c != 0; - - c = next) - -{ - - next = icalcomponent_get_next_component(s); - - icalcomponent_remove_component(s,c); - -} - -6.2.3 Finding Properties - -6.2.4 Removing Properties - -6.2.5 Getting Values - -6.2.6 Setting Values - -6.2.7 Getting Parameters - -6.2.8 Setting Parameters - -6.2.9 Removing Parameters - -6.2.10 Checking Component Validity - -6.3 Storing Objects - -The libical distribution inclues a seperate library, libicalss, that -allows you to store iCal component data to disk in a variety of ways. -This library is documented seperately. - -6.4 Memory Management - -Here are the memory rules for the library: - -1) If the function name has "new" in it, the caller gets control - of the memory. ( such as icalcomponent_new(), or icalproperty_new_clone() - ) - -2) If you got the memory from a routine with new in it, you must - call the corresponding *_free routine to free the memory. ( Use - icalcomponent_free() to free objects created with icalcomponent_new()) - -3) If the function name has "add" in it, the caller is transfering - control of the memory to the routine. ( icalproperty_add_parameter() ) - -4) If the function name has "remove" in it, the caller passes in - a pointer to an object and after the call returns, the caller owns - the object. So, before you call icalcomponent_remove_property(comp,foo), - you do not own "foo" and after the call returns, you do. - -5) If the routine returns a string, libical owns the memory and will - put it on a ring buffer to reclaim later. You'd better strdup it - if you want to keep it, and you don't have to delete it. - -6.5 Error Handling - -6.5.1 Return values - -6.5.2 icalerrno - -6.5.3 Component errors - -6.6 Naming Standard - -Structures that you access with the ``struct'' keyword, such as ``struct -icaltimetype'' are things that you are allowed to see inside and poke -at. - -Structures that you access though a typedef, such as ``icalcomponent'' -are things where all of the data is hidden. - -Component names that start with ``V'' are part of RFC 2445 or another -iCal standard. Component names that start with ``X'' are also part -of the spec, but they are not actually components in the spec. However, -they look and act like components, so they are components in libical. -Names that start with ``XLIC'' or ``X-LIC'' are not part of any iCal -spec. They are used internally by libical. - -7 Hacks and Bugs diff --git a/libical/install-sh b/libical/install-sh deleted file mode 100755 index 0ff4b6a08e..0000000000 --- a/libical/install-sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh - -# -# install - install a program, script, or datafile -# This comes from X11R5; it is not part of GNU. -# -# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" - -instcmd="$mvprog" -chmodcmd="" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -fi - -if [ x"$dst" = x ] -then - echo "install: no destination specified" - exit 1 -fi - - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - -if [ -d $dst ] -then - dst="$dst"/`basename $src` -fi - -# Make a temp file name in the proper directory. - -dstdir=`dirname $dst` -dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - -$doit $instcmd $src $dsttmp - -# and set any options; do chmod last to preserve setuid bits - -if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi -if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi -if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi -if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi - -# Now rename the file to the real destination. - -$doit $rmcmd $dst -$doit $mvcmd $dsttmp $dst - - -exit 0 diff --git a/libical/scripts/mkderivedcomponents.pl b/libical/scripts/mkderivedcomponents.pl deleted file mode 100755 index 3599a8d465..0000000000 --- a/libical/scripts/mkderivedcomponents.pl +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/local/bin/perl - -use Getopt::Std; -getopts('chsp'); - - -# ARG 0 is components.txt -open(PV,"$ARGV[0]") || die "Can't open components file $ARGV[0]:$!"; - -my @components; - -while (){ - - chop; - - push(@components,$_); - -} - -close PV; - -if ($opt_c or $opt_h){ - -print < /* for va_arg functions */ - -EOM - -} - -if ($opt_p){ - -print <1,RANGE=>1,RSVP=>1,XLICERRORTYPE=>1,XLICCOMPARETYPE=>1); - -# Usually, open param-c-types.txt -open(F,"$ARGV[0]") || die "Can't open C parameter types file $ARGV[0]:$!"; - -# Write the file inline by copying everything before a demarcation -# line, and putting the generated data after the demarcation - -if ($opt_i) { - - open(IN,$opt_i) || die "Can't open input file $opt_i"; - - while(){ - - if (/Do not edit/){ - last; - } - - print; - - } - - print "/* Everything below this line is machine generated. Do not edit. */\n"; - -} - - - -if (($opt_c or $opt_h) and !$opt_i) { - -print <){ - - chop; - my ($param,$type) = split(/\s{2,}/,$_); - - my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$param)); - - my $lc = lc($ucf); - my $uc = uc($lc); - - my $lctype = lc($type); - - - my $charorenum; - my $set_code; - my $pointer_check; - my $new_pointer_check; - - $new_pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");" if $type=~/char/; - - - if ($type=~/char/ ) { - - $charorenum = " icalerror_check_arg_rz( (param!=0), \"param\");\n return ((struct icalparameter_impl*)param)->string;"; - - $pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");"; - - $set_code = "((struct icalparameter_impl*)param)->string = strdup(v);" - - } else { - - $xrange =" if ( ((struct icalparameter_impl*)param)->string != 0){\n return ICAL_${uc}_XNAME;\n }\n" if !exists $no_xname{$uc}; - - $charorenum=<data.v_${lc}; -EOM - - $pointer_check = "icalerror_check_arg( (v!=0),\"v\");"; - - $set_code = "((struct icalparameter_impl*)param)->data.v_${lc} = v;"; - - $print_code = "switch (impl->data.v_${lc}) {\ncase ICAL_${uc}_: {\n}\ncase ICAL_${uc}_XNAME: /* Fall Through */\n}\n"; - - } - - - - if ($opt_c) { - - print <[0] = \$p; - - if (\$value) { - \$self->set(\$value); - } - - - return \$self; -} - -sub get -{ - my \$self = shift; - my \$impl = \$self->_impl(); - - return ICal::icalparameter_as_ical_string(\$impl); - -} - -sub set -{ - - my \$self = shift; - my \$v = shift; - - my \$impl = \$self->_impl(); - - ICal::icalparameter_set_${lc}(\$impl,\$v) unless !\$v; -} - -EOM - -} - -} - -if ($opt_h){ - -print <){ - - chop; - my @v = split(/\s+/,$_); - - my $prop = shift @v; - my $value = shift @v; - my $comment = join(" ",@v); - - $propmap{$prop} = $value; -} - -close PV; - -# ARG 1 is value-c-types.txt -open(F,"$ARGV[1]") || die "Can't open C parameter types file $ARGV[1 ]:$!"; - -while (){ - - chop; - my @v = split(/\t+/,$_); - - my $value = shift @v; - my $type = shift @v; - my $comment = join(" ",@v); - - $valuemap{$value} = $type; - -} - -close F; - -# Write the file inline by copying everything before a demarcation -# line, and putting the generated data after the demarcation - -if ($opt_i) { - - open(IN,$opt_i) || die "Can't open input file $opt_i"; - - while(){ - - if (/Do not edit/){ - last; - } - - print; - - } - - print "/* Everything below this line is machine generated. Do not edit. */\n"; - -} - - -if ( ($opt_h or $opt_s) and !$opt_i ){ - -print <_add_elements(\\\@_); - - return bless \$self, \$package; -} - -sub set_value -{ - my \$self = shift; - my \$v = shift; - - my \$impl = \$self->_impl(); - - - if ( ref \$v && Net::ICal::icalvalue_isa_value(\$v->_impl())){ - Net::ICal::icalproperty_set_value(\$impl,\$v->_impl); - } else { - my \$value = Net::ICal::icalvalue_new_from_string(\$Net::ICal::ICAL_${ucvalue}_VALUE,\$v); - die if !\$impl; - Net::ICal::icalproperty_set_value(\$impl,\$value) unless !\$value; - } - -} - -sub get_value -{ - my \$self = shift; - my \$impl = \$self->_impl(); - - if (defined \$impl){ - my \$value = Net::ICal::icalproperty_get_value(\$impl); - return "" if !\$value; - return Net::ICal::icalvalue_as_ical_string(\$value); - } else { - return ""; - } -} - -EOM - -} elsif ($opt_m) { # Generate a map - -print "\'${uc}\' => \'Net::ICal::Property::${ucf},\'\n"; - -} - -} # This brace terminates the main loop - - - -# Add things to the end of the output. - -if ($opt_p) -{ - print "1;\n"; -} - -if ($opt_h){ - -print < generate c code file -# h-> generate header file -# s -> generate switch statement - -# Open with value-c-types.txt - - -open(F,"$ARGV[0]") || die "Can't open values data file $ARGV[0]:$!"; - - -# Write the file inline by copying everything before a demarcation -# line, and putting the generated data after the demarcation - -if ($opt_i) { - - open(IN,$opt_i) || die "Can't open input file $opt_i"; - - while(){ - - if (/Do not edit/){ - last; - } - - print; - - } - - print "/* Everything below this line is machine generated. Do not edit. */\n"; - -} - - -if (($opt_c || $opt_h) and !$opt_i) { -print < 'int', - CALADDRESS=>'string', - DATE=>'time', - DATETIME=>'time', - DATETIMEDATE=>'time', - DATETIMEPERIOD=>'period', - DURATION=>'duration', - INTEGER=>'int', - TEXT=>'string', - URI=>'string', - UTCOFFSET=>'int', - QUERY=>'string', - BINARY=>'string' - ); - -while() -{ - - chop; - my @v = split(/\t+/,$_); - - my $value = shift @v; - my $type = shift @v; - my $comment = join(" ",@v); - - my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$value)); - - my $lc = lc($ucf); - my $uc = uc($lc); - - my $pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");\n" if $type =~ /\*/; - my $pointer_check_rv = "icalerror_check_arg_rv( (v!=0),\"v\");\n" if $type =~ /\*/; - - my $assign; - - if ($type =~ /char/){ - $assign = "strdup(v);\n\n if (impl->data.v_string == 0){\n errno = ENOMEM;\n }\n"; - } else { - $assign = "v;"; - } - - my $union_data; - - if (exists $union_map{$uc} ){ - $union_data=$union_map{$uc}; - } else { - $union_data = $lc; - } - - if ($opt_c) { -print <data.v_${union_data} = $assign -} - -$type -icalvalue_get_${lc}(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_${uc}_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_${union_data}; -} - -EOM - -} elsif($opt_h) { - - print <data.v_${union_data} - - str = strdup(temp); - - return str; -} - -EOM - -} -} elsif ($opt_p) { # Generate perl code - -print <[0] = \$p; - - return \$self; -} - -sub set -{ - my \$self = shift; - my \$v = shift; - - my \$impl = \$self->_impl(); - - if (\$v) { - my \$new_value = ICal::icalvalue_new_from_string(\$ICal::ICAL_${uc}_VALUE,\$v); - if (\$new_value){ - ICal::icalvalue_free(\$self->[0]); - \$self->[0] = \$new_value; - } - - } - -} - -sub get -{ - my \$self = shift; - my \$impl = \$self->[0]; - - if (defined \$impl){ - - return ICal::icalvalue_as_ical_string(\$impl); - - } -} - -EOM -} - - - -} - -if ($opt_p) -{ - print "1;\n"; -} - - -if ($opt_h){ - -print < - - -# usually open params-in-prop.txt -open(F,"$ARGV[0]") || die "Can't open restriction file $ARGV[0]:$!"; - -print <) -{ - chop; - - # split line by whitespace - my @v = split(/\s+/,$_); - # property is first item on line - my $prop = shift @v; - my $prop_name = $prop; - if (substr($prop,0,1) eq "X") { $prop = "X"; } - $prop = join("",split(/-/,$prop)); - -print < - -# usually open restrictions.csv -open(F,"$ARGV[0]") || die "Can't open restriction file $ARGV[0]:$!"; - -print <) -{ - chop; - - # split line at commas - my ($method,$component,$property,$subcomponent,$restriction)=split(/\,/,$_); - - # - #put in code to generate comments here! - # - if ($method ne $last_method) - { - $need_header = 1; - $last_method = $method; - } - if ($component ne $last_component) - { - $need_header = 1; - $last_component = $component; - } - - if ($need_header) - { - print "\n\t/* METHOD: ${method}, COMPONENT: ${component} */\n"; - $need_header = 0; - } - - foreach $item ($component,$property,$subcomponent,$restriction) - { - # handle special cases. - if ($item eq "NONE") - { $item = "NO"; } - else { if (substr($item,0,1) eq "X") - { $item = "X"; }} - - # strip out dashes - $item = join("",split(/-/,$item)); - } - # strip leading V from component names - $component =~ s/^(V?)(\w+?)((SAVINGS)?)((TIME)?)$/$2/; - $subcomponent =~ s/^V(\w+)/$1/; - - print "\t\{ICAL_METHOD_${method},ICAL_${component}_COMPONENT,"; - print "ICAL_${property}_PROPERTY,ICAL_${subcomponent}_COMPONENT,"; - print "ICAL_RESTRICTION_${restriction}\},\n"; - -} - -print <){ - - if (/Do not edit/){ - last; - } - - print; - - } - - print "/* Everything below this line is machine generated. Do not edit. */\n"; - - - close IN; -} - -print "icalrestriction_property_record icalrestriction_property_records[] = {\n"; - -while() -{ - - chop; - - s/\#.*$//; - - my($method,$targetcomp,$prop,$subcomp,$restr,$sub) = split(/,/,$_); - - next if !$method; - - if(!$sub) { - $sub = "0"; - } - - if($prop ne "NONE"){ - print(" \{ICAL_METHOD_${method},ICAL_${targetcomp}_COMPONENT,ICAL_${prop}_PROPERTY,ICAL_RESTRICTION_${restr},$sub\},\n"); - } - -} - - -print " {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE}\n"; - -print "};\n"; - -print "icalrestriction_component_record icalrestriction_component_records[] = {\n"; - - -close(F); -open(F,"$ARGV[0]") || die "Can't open restriction data file $ARGV[0]:$!"; - -while() -{ - - chop; - - s/\#.*$//; - - my($method,$targetcomp,$prop,$subcomp,$restr) = split(/,/,$_); - - next if !$method; - - - if($subcomp ne "NONE"){ - print(" \{ICAL_METHOD_${method},ICAL_${targetcomp}_COMPONENT,ICAL_${subcomp}_COMPONENT,ICAL_RESTRICTION_${restr}\},\n"); - } - -} - -print " {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE}\n"; -print "};\n"; diff --git a/libical/src/.cvsignore b/libical/src/.cvsignore deleted file mode 100644 index c038ed7864..0000000000 --- a/libical/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in \ No newline at end of file diff --git a/libical/src/Makefile.am b/libical/src/Makefile.am deleted file mode 100644 index ef64080346..0000000000 --- a/libical/src/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = libical libicalss diff --git a/libical/src/libical/.cvsignore b/libical/src/libical/.cvsignore deleted file mode 100644 index 76c7941bb2..0000000000 --- a/libical/src/libical/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -.deps -icalitip.c -Makefile.in -*.lo -*.la -.libs diff --git a/libical/src/libical/.gdb_history b/libical/src/libical/.gdb_history deleted file mode 100644 index 55362e9165..0000000000 --- a/libical/src/libical/.gdb_history +++ /dev/null @@ -1,457 +0,0 @@ -run -ptype E -graph display E -quit -run -print E -graph display E -up -print p -graph display p -ptype p -info line 'p' -graph display p -print parameter_iterator -break icalproperty.c:182 -run -next -print p -graph display p -quit -run -up -graph display p -print parameter_iterator -graph display p -print *(p) -quit -show directories -run -run -y -list usecases.c -list test_parameters -info line 'main' -info line 'test_parameters' -info line 'icalproperty_vanew_comment' -ptype icalproperty_add_parameters -info line 'icalproperty_add_parameters' -run -up -info line 'icalproperty_vanew_comment' -info line 'icalproperty_add_parameters' -break icalproperty.c:51 -run -step -next -nexti -info line 'icalproperty_vanew_comment' -info line 'icalproperty_add_parameters' -break icalproperty.c:53 -run -next -graph display vp -break icalparameter_isa_parameter -cont -run -step -next -quit -run -break icalcomponent_get_first_property -break icalcomponent_get_next_property -break icalcomponent_new -run -next -step -next -step -next -graph display impl -up -down -next -graph display *(impl) -next -cont -next -graph display c -next -graph display *(prop) -next -step -quit -run -up -graph display p -down -print E -up -print *(prop) -graph display *(prop) -down -up -print prop -print param -down -up -print p -up -break usecases.c:522 -run -step -next -up -run -step -next -step -next -quit -run -up -quit -info line 'test_memory' -break b1 -break usecases.c:558 -run -graph display *(f) -graph display *(p) -next -run -next -step -next -print pos -print *(pos) -graph display string -graph display *(pos) -next -set variable *pos = 0x8053520 -next -step -next -print buf_size -print *(buf_size) -print *(string) -ptype string -next -run -print f -graph display f -graph display p -next -step -next -run -next -graph display bufsize -next -quit -graph display test_memory -info line 'test_memory' -break usecases.c:560 -run -graph display f -next -graph display p -print p -f -print strlen(S1) -next -print p - f -print strlen(S1) + strlen(S2) -next -break usecases.c:572 -run -cont -step -graph display *(pos) -next -step -quit -info line 'test_memory' -break usecases.c:560 -set args -run -next -graph display f -graph display p -next -graph display bufsize -run -next -set args -run -quit -info line 'test_memory' -break usecases.c:560 -graph display f -graph display p -run -graph display f -graph display p -graph display bufsize -next -down -up -quit -run -where -frame 2 -break icalmemory.c:79 -run -next -run -graph display buffer_ring -run -ont(box, font) = font(box, font); -_fontfix(box) = fontfix(box); -ont(box, font) = font(box, font); -#pragma override font -font(box, font) = _fontfix(_font(box, string(font))); -ont(box, font) = font(box, font); -ist -list -print buffer_ring[buffer_pos] -break icalmemory.c:77 -run -cont -quit -run -up -break icalmemory.c:77 -break icalmemory.c:78 -run -graph display buffer_ring -next -cont -quit -run -up -break icalmemory.c:77 -run -break icalmemory.c:78 -cont -graph display buffer_ring[buffer_pos] -quit -break usecases.c:560 -run -step -break icalmemory.c:129 -disable 2 -next -info line 'icalmemory_resize_buffer' -break icalmemory.c:79 -cont -run -cont -next -run -cont -graph display buffer_ring[buffer_pos] -graph display buffer_ring -break icalmemory.c:78 -run -graph display buffer_pos -cont -run -cont -quit -info line 'test_memory' -info line 'icalmemory_append_string' -break icalmemory.c:78 -break icalmemory.c:79 -run -graph display buffer_ring -graph display buffer_ring[buffer_pos] -graph display buffer_pos -cont -next -free( buffer_ring[2] -free( buffer_ring[2] ) -call free(buffer_ring[2] ) -call free(buffer_ring[1] ) -free(buffer_ring[1]) -run -cont -set variable buffer_pos = 2 -next -run -cont -run -cont -run -cont -next -quit -info line 'test_memory' -info line 'icalmemory_append_string' -break icalmemory.c:78 -break icalmemory.c:79 -run -graph display buffer_ring -graph display buffer_pos -graph display buffer_ring[buffer_pos] -cont -run -cont -set variable buffer_pos = 2 -next -cont -next -cont -run -next -run -quit -info line 'test_memory' -info line 'icalmemory_append_string' -break icalmemory.c:76 -break icalmemory.c:77 -run -graph display buffer_ring -graph display buffer_pos -graph display buffer_ring[buffer_pos] -cont -next -cont -next -cont -run -cont -next -cont -run -cont -next -graph display rtrn -next -run -next -cont -next -run -step -run -next -quit -run -up -print pos -graph display string -run -up -break usecases.c:572 -run -print bufsize -step -next -step -quit -run -up -graph display buf_size -graph display *(buf_size) -break icalmemory.c:136 -run -next -run -graph display *(new_buf) -quit -run -up -down -break icalmemory.c:136 -run -graph display *(new_buf) -quit -run -up -break icalmemory.c:136 -run -print *(new_buf) -next -print *buf_size -print *bu -print *buf -next -print new_buf -quit -run -up -break icalmemory.c:136 -run -print *(new_buf) -graph display *(new_buf) -graph display new_pos -graph display *(buf) -next -graph display new_buf -run -next -run -graph display *(pos) -next -quit -info line 'test_memory' -info line 'icalmemory_append_string' -break icalmemory.c:136 -run -graph display *(buf_size) -next -quit -info line 'test_memory' -break usecases.c:570 -run -step -next -delete 1 -until usecases.c:572 -step -next -graph display *(buf_size) -next -graph display *(pos) -graph display *(buf) -graph display *(new_buf) -graph display new_buf -next -graph display string -print *pos - *buf -run -break icalmemory.c:136 -run -next -set variable *pos = 0x8054993 -next -run -next -set variable *pos = 0x8054980 -set variable *pos = 0x8054700 -next -run -next -down -up -down -quit -run < ../../test-data/1.1 -up -break icalproperty.c:165 -run -next -run -info line 'icalvalue_as_ical_string' -break icalvalue.c:424 -cont -next -print value -next -run -up -cont -up -print *(prop) -graph display *(icalproperty_impl*)prop -quit - diff --git a/libical/src/libical/.gdbinit b/libical/src/libical/.gdbinit deleted file mode 100644 index 19de9b8209..0000000000 --- a/libical/src/libical/.gdbinit +++ /dev/null @@ -1,3 +0,0 @@ -directory /home/eric/proj/FreeAssociation/libical/src/pvl/ -path /home/eric/proj/FreeAssociation/libical/src/pvl/ - diff --git a/libical/src/libical/Makefile.am b/libical/src/libical/Makefile.am deleted file mode 100644 index 0457e65247..0000000000 --- a/libical/src/libical/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ - -noinst_LTLIBRARIES = libical.la - -libical_la_SOURCES = \ - filelock.c \ - filelock.h \ - ical.h \ - icalcomponent.c \ - icalcomponent.h \ - icalenums.c \ - icalenums.h \ - icalerror.c \ - icalerror.h \ - icalirip.h \ - icalitip.l \ - icalmemory.c \ - icalmemory.h \ - icalparameter.c \ - icalparameter.h \ - icalparser.c \ - icalparser.h \ - icalproperty.c \ - icalproperty.h \ - icalrestriction.c \ - icalrestriction.h \ - icaltypes.c \ - icaltypes.h \ - icalvalue.c \ - icalvalue.h \ - icalvcal.h \ - locking.c \ - pvl.c \ - pvl.h \ - icalitip.y \ - icalitip.tab.c - -EXTRA_DIST = .gdbinit base64.c - -YFLAGS=-picalparser_yy -LFLAGS=-Picalparser_yy -olex.yy.c diff --git a/libical/src/libical/base64.c b/libical/src/libical/base64.c deleted file mode 100644 index 5925f977ac..0000000000 --- a/libical/src/libical/base64.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - - Encode or decode file as MIME base64 (RFC 1341) - - by John Walker - http://www.fourmilab.ch/ - - This program is in the public domain. - -*/ - -#define REVDATE "11th August 1997" - -#include -#include -#include -#include - -#define TRUE 1 -#define FALSE 0 - -#define LINELEN 72 /* Encoded line length (max 76) */ - -typedef unsigned char byte; /* Byte type */ - -static FILE *fi = stdin; /* Input file */ -static FILE *fo = stdout; /* Output file */ -static byte iobuf[256]; /* I/O buffer */ -static int iolen = 0; /* Bytes left in I/O buffer */ -static int iocp = 256; /* Character removal pointer */ -static int ateof = FALSE; /* EOF encountered */ -static byte dtable[256]; /* Encode / decode table */ -static int linelength = 0; /* Length of encoded output line */ -static char eol[] = "\r\n"; /* End of line sequence */ -static int errcheck = TRUE; /* Check decode input for errors ? */ - -/* INBUF -- Fill input buffer with data */ - -static int inbuf(void) -{ - int l; - - if (ateof) { - return FALSE; - } - l = fread(iobuf, 1, 256, fi); /* Read input buffer */ - if (l <= 0) { - if (ferror(fi)) { - exit(1); - } - ateof = TRUE; - return FALSE; - } - iolen = l; - iocp = 0; - return TRUE; -} - -/* INCHAR -- Return next character from input */ - -static int inchar(void) -{ - if (iocp >= iolen) { - if (!inbuf()) { - return EOF; - } - } - - return iobuf[iocp++]; -} - -/* OCHAR -- Output an encoded character, inserting line breaks - where required. */ - -static void ochar(int c) -{ - if (linelength >= LINELEN) { - if (fputs(eol, fo) == EOF) { - exit(1); - } - linelength = 0; - } - if (putc(((byte) c), fo) == EOF) { - exit(1); - } - linelength++; -} - -/* ENCODE -- Encode binary file into base64. */ - -static void encode(void) -{ - int i, hiteof = FALSE; - - /* Fill dtable with character encodings. */ - - for (i = 0; i < 26; i++) { - dtable[i] = 'A' + i; - dtable[26 + i] = 'a' + i; - } - for (i = 0; i < 10; i++) { - dtable[52 + i] = '0' + i; - } - dtable[62] = '+'; - dtable[63] = '/'; - - while (!hiteof) { - byte igroup[3], ogroup[4]; - int c, n; - - igroup[0] = igroup[1] = igroup[2] = 0; - for (n = 0; n < 3; n++) { - c = inchar(); - if (c == EOF) { - hiteof = TRUE; - break; - } - igroup[n] = (byte) c; - } - if (n > 0) { - ogroup[0] = dtable[igroup[0] >> 2]; - ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)]; - ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)]; - ogroup[3] = dtable[igroup[2] & 0x3F]; - - /* Replace characters in output stream with "=" pad - characters if fewer than three characters were - read from the end of the input stream. */ - - if (n < 3) { - ogroup[3] = '='; - if (n < 2) { - ogroup[2] = '='; - } - } - for (i = 0; i < 4; i++) { - ochar(ogroup[i]); - } - } - } - if (fputs(eol, fo) == EOF) { - exit(1); - } -} - -/* INSIG -- Return next significant input */ - -static int insig(void) -{ - int c; - - /*CONSTANTCONDITION*/ - while (TRUE) { - c = inchar(); - if (c == EOF || (c > ' ')) { - return c; - } - } - /*NOTREACHED*/ -} - -/* DECODE -- Decode base64. */ - -static void decode(void) -{ - int i; - - for (i = 0; i < 255; i++) { - dtable[i] = 0x80; - } - for (i = 'A'; i <= 'Z'; i++) { - dtable[i] = 0 + (i - 'A'); - } - for (i = 'a'; i <= 'z'; i++) { - dtable[i] = 26 + (i - 'a'); - } - for (i = '0'; i <= '9'; i++) { - dtable[i] = 52 + (i - '0'); - } - dtable['+'] = 62; - dtable['/'] = 63; - dtable['='] = 0; - - /*CONSTANTCONDITION*/ - while (TRUE) { - byte a[4], b[4], o[3]; - - for (i = 0; i < 4; i++) { - int c = insig(); - - if (c == EOF) { - if (errcheck && (i > 0)) { - fprintf(stderr, "Input file incomplete.\n"); - exit(1); - } - return; - } - if (dtable[c] & 0x80) { - if (errcheck) { - fprintf(stderr, "Illegal character '%c' in input file.\n", c); - exit(1); - } - /* Ignoring errors: discard invalid character. */ - i--; - continue; - } - a[i] = (byte) c; - b[i] = (byte) dtable[c]; - } - o[0] = (b[0] << 2) | (b[1] >> 4); - o[1] = (b[1] << 4) | (b[2] >> 2); - o[2] = (b[2] << 6) | b[3]; - i = a[2] == '=' ? 1 : (a[3] == '=' ? 2 : 3); - if (fwrite(o, i, 1, fo) == EOF) { - exit(1); - } - if (i < 3) { - return; - } - } -} - -/* USAGE -- Print how-to-call information. */ - -static void usage(char *pname) -{ - fprintf(stderr, "%s -- Encode/decode file as base64. Call:\n", pname); - fprintf(stderr, - " %s [-e[ncode] / -d[ecode]] [-n] [infile] [outfile]\n", pname); - fprintf(stderr, "\n"); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -D Decode base64 encoded file\n"); - fprintf(stderr, " -E Encode file into base64\n"); - fprintf(stderr, " -N Ignore errors when decoding\n"); - fprintf(stderr, " -U Print this message\n"); - fprintf(stderr, "\n"); - fprintf(stderr, "by John Walker\n"); - fprintf(stderr, " WWW: http://www.fourmilab.ch/\n"); -} - -/* Main program */ - -int main(int argc, char *argv[]) -{ - int i, f = 0, decoding = FALSE; - char *cp, opt; - - for (i = 1; i < argc; i++) { - cp = argv[i]; - if (*cp == '-') { - opt = *(++cp); - if (islower(opt)) { - opt = toupper(opt); - } - switch (opt) { - - case 'D': /* -D Decode */ - decoding = TRUE; - break; - - case 'E': /* -E Encode */ - decoding = FALSE; - break; - - case 'N': /* -N Suppress error checking */ - errcheck = FALSE; - break; - - case 'U': /* -U Print how-to-call information */ - case '?': - usage(argv[0]); - return 0; - } - } else { - switch (f) { - - /** Warning! On systems which distinguish text mode and - binary I/O (MS-DOS, Macintosh, etc.) the modes in these - open statements will have to be made conditional based - upon whether an encode or decode is being done, which - will have to be specified earlier. But it's worse: if - input or output is from standard input or output, the - mode will have to be changed on the fly, which is - generally system and compiler dependent. 'Twasn't me - who couldn't conform to Unix CR/LF convention, so - don't ask me to write the code to work around - Apple and Microsoft's incompatible standards. **/ - - case 0: - if (strcmp(cp, "-") != 0) { - if ((fi = fopen(cp, "r")) == NULL) { - fprintf(stderr, "Cannot open input file %s\n", cp); - return 2; - } - } - f++; - break; - - case 1: - if (strcmp(cp, "-") != 0) { - if ((fo = fopen(cp, "w")) == NULL) { - fprintf(stderr, "Cannot open output file %s\n", cp); - return 2; - } - } - f++; - break; - - default: - fprintf(stderr, "Too many file names specified.\n"); - usage(argv[0]); - return 2; - } - } - } - - if (decoding) { - decode(); - } else { - encode(); - } - return 0; -} diff --git a/libical/src/libical/filelock.c b/libical/src/libical/filelock.c deleted file mode 100644 index 0376bc2bec..0000000000 --- a/libical/src/libical/filelock.c +++ /dev/null @@ -1,143 +0,0 @@ - -/* - I Stole this from: - http://www.cis.temple.edu/~ingargio/old/cis307s96/readings/rwlockexample.html - - CIS 307: An example using Read/Write File Locks - [fcntl.h], [fcntl.c], [fcntlmain.c] - -In Stevens "Advanced Programming in the Unix Environment" we see ways to use -the Unix service fcntl to lock portions of a file for reading and writing in -the manner stated in the Reader and Writer problem [any number of readers at -a time, but writers must operate alone]. Here we have three files that adapt -and use the code from Stevens: - -*fcntl.h: Specification of the locking functions. -*fcntl.c: Implementation of the locking functions. -*fcntlmain.c: Driver that does a simple test of the locking functions. - -WARNING: A file lock request which is blocked can be interrupted by a -signal. In this case the lock operation returns EINTR. Thus we may think we -got a lock when we really don't. A solution is to block signals when -locking. Another solution is to test the value returned by the lock -operation and relock if the value is EINTR. Another solution, which we adopt -here, is to do nothing about it. - -/* fcntl.c -- Defines mutexes in terms of read/write locks on files. - * (code is mostly from Stevens: Advanced Programming in the - * Unix environment. See from page 367 on. - * filerwlock, filerwlockCreate, filerwlockDelete, - * filerwreadlock, filerwlongreadlock, filerwlongunlock, - * filerwlockUnlock - */ - -#include -#include -#include -#include - -int lock_reg(int, int, int, off_t, int, off_t); - -#define read_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLK, F_RDLCK, offset, whence, len) - -#define readw_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLKW, F_RDLCK, offset, whence, len) - -#define write_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLK, F_WRLCK, offset, whence, len) - -#define writew_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLKW, F_WRLCK, offset, whence, len) - -#define un_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLK, F_UNLCK, offset, whence, len) - -pid_t lock_test(int, int , off_t , int , off_t ); - -#define is_readlock(fd, offset, whence, len) \ - lock_test(fd, F_RDLCK, offset, whence, len) - -#define is_writelock(fd, offset, whence, len) \ - lock_test(fd, F_WRLCK, offset, whence, len) - -int lock_reg(int fd, int cmd, int type, off_t offset, int whence, off_t len) -{ - struct flock lock; - lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */ - lock.l_start = offset; /* byte offset relative to l_whence */ - lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ - lock.l_len = len; /* #bytes (0 means to EOF) */ - return (fcntl(fd, cmd, &lock)); -} - -pid_t lock_test(int fd, int type, off_t offset, int whence, off_t len) -{ - struct flock lock; - lock.l_type = type; /* F_RDLCK or F_WRLCK */ - lock.l_start = offset; /* byte offset relative to l_whence */ - lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ - lock.l_len = len; /* #bytes (0 means to EOF) */ - if (fcntl(fd,F_GETLK,&lock) < 0){ - perror("fcntl"); exit(1);} - if (lock.l_type == F_UNLCK) - return (0); /* false, region is not locked by another process */ - return (lock.l_pid); /* true, return pid of lock owner */ -} - -typedef struct { - int fd; - int n;} filerwlock; - -/* Create N read/write locks and returns the id of this cluster of locks. */ -filerwlock * filerwlockCreate(char *filename, int n) { - filerwlock *fl = (filerwlock *)malloc(sizeof(filerwlock)); - if (((fl->fd) = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IWUSR)) < 0) { - perror("open"); - exit(1);} - fl->n = n; - return fl; - } - -/* Delete the cluster of read/write locks associated with fl. */ -int filerwlockDelete(filerwlock *fl) { - if (close(fl->fd) < 0) { - perror("close"); - exit(1);} - return free(fl); - } - -/* Given the read/write lock cluster fl, lock its ith element */ -int filerwreadlock(filerwlock *fl, int i) { - if ((i < 0) | (i >= fl->n)) { - printf("filerwlockLock needs i in range 0 .. %d\n", (fl->n)-1); - exit(0);} - readw_lock(fl->fd, i, SEEK_SET, 1); - } - -int filerwwritelock(filerwlock *fl, int i) { - if ((i < 0) | (i >= fl->n)) { - printf("filerwlockLock needs i in range 0 .. %d\n", (fl->n)-1); - exit(0);} - writew_lock(fl->fd, i, SEEK_SET, 1); - } - -/* Given the lock cluster fl, unlock its ith element */ -int filerwunlock(filerwlock *fl, int i){ - - if ((i < 0) | (i >= fl->n)) { - printf("filerwlockUnlock needs i in range 0 .. %d\n", (fl->n)-1); - exit(0);} - un_lock(fl->fd, i, SEEK_SET, 1); - } - -/* Given the lock cluster fl, it read locks all its elements */ -int filerwlongreadlock(filerwlock *fl) { - readw_lock(fl->fd, 0, SEEK_SET, fl->n); -} - -/* Given the lock cluster fl, it unlocks all its elements */ -int filerwlongunlock(filerwlock *fl) { - un_lock(fl->fd, 0, SEEK_SET, fl->n); -} - diff --git a/libical/src/libical/filelock.h b/libical/src/libical/filelock.h deleted file mode 100644 index dbe0715cc6..0000000000 --- a/libical/src/libical/filelock.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - I Stole this from: - http://www.cis.temple.edu/~ingargio/old/cis307s96/readings/rwlockexample.html - - CIS 307: An example using Read/Write File Locks - [fcntl.h], [fcntl.c], [fcntlmain.c] - -In Stevens "Advanced Programming in the Unix Environment" we see ways to use -the Unix service fcntl to lock portions of a file for reading and writing in -the manner stated in the Reader and Writer problem [any number of readers at -a time, but writers must operate alone]. Here we have three files that adapt -and use the code from Stevens: - -*fcntl.h: Specification of the locking functions. -*fcntl.c: Implementation of the locking functions. -*fcntlmain.c: Driver that does a simple test of the locking functions. - -WARNING: A file lock request which is blocked can be interrupted by a -signal. In this case the lock operation returns EINTR. Thus we may think we -got a lock when we really don't. A solution is to block signals when -locking. Another solution is to test the value returned by the lock -operation and relock if the value is EINTR. Another solution, which we adopt -here, is to do nothing about it. - -fcntl.h - -*/ - -/* fcntl.h -- Defines mutexes in terms of read/write locks on files. - * filerwlock, filerwlockCreate, filerwlockDelete, - * filerwreadlock, filerwlockUnlock - */ - -typedef struct { - int fd; - int n; -} filerwlock; - -/* Create N read/write locks and returns the id of this cluster of locks. */ -filerwlock * filerwlockCreate(char *filename, int n); - -/* Delete the cluster of read/write locks associated with fl. */ -int filerwlockDelete(filerwlock *fl); - -/* Given the read/write lock cluster fl, lock its ith element */ -int filerwreadlock(filerwlock *fl, int i); - -int filerwwritelock(filerwlock *fl, int i); - -/* Given the lock cluster fl, unlock its ith element */ -int filerwunlock(filerwlock *fl, int i); - -/* Given the lock cluster fl, it read locks all its elements */ -int filerwlongreadlock(filerwlock *fl); - -/* Given the lock cluster fl, it unlocks all its elements */ -int filerwlongunlock(filerwlock *fl); diff --git a/libical/src/libical/foo b/libical/src/libical/foo deleted file mode 100644 index f46fdc7814..0000000000 --- a/libical/src/libical/foo +++ /dev/null @@ -1,1578 +0,0 @@ -/* - ====================================================================== - File: icalrestriction.c - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - -#include "icalenums.h" -#include "icalrestriction.h" - -/* Define the structs for the restrictions. these data are filled out -in machine generated code below */ - -typedef struct icalrestriction_property_record { - icalproperty_method method; - icalcomponent_kind component; - icalproperty_kind property; - icalrestriction_kind restriction; -} icalrestriction_property_record; - - -typedef struct icalrestriction_component_record { - icalproperty_method method; - icalcomponent_kind component; - icalcomponent_kind subcomponent; - icalrestriction_kind restriction; -} icalrestriction_component_record; - -icalrestriction_component_record icalrestriction_component_records[]; -icalrestriction_property_record icalrestriction_property_records[]; - -/* The each row gives the result of comparing a restriction against a - count. The columns in each row represent 0,1,2+. '-1' indicates - 'invalid, 'don't care' or 'needs more analysis' */ - -char compare_map[ICAL_RESTRICTION_UNKNOWN+1][3] = { - { 1, 1, 1},/*ICAL_RESTRICTION_NONE*/ - { 1, 0, 0},/*ICAL_RESTRICTION_ZERO*/ - { 0, 1, 0},/*ICAL_RESTRICTION_ONE*/ - { 1, 1, 1},/*ICAL_RESTRICTION_ZEROPLUS*/ - { 0, 1, 1},/*ICAL_RESTRICTION_ONEPLUS*/ - { 1, 1, 0},/*ICAL_RESTRICTION_ZEROORONE*/ - { 1, 1, 0},/*ICAL_RESTRICTION_ONEEXCLUSIVE*/ - { 1, 1, 0},/*ICAL_RESTRICTION_ONEMUTUAL*/ - { 1, 1, 1} /*ICAL_RESTRICTION_UNKNOWN*/ -}; - -char restr_string_map[ICAL_RESTRICTION_UNKNOWN+1][60] = { - "unknown number",/*ICAL_RESTRICTION_NONE*/ - "0",/*ICAL_RESTRICTION_ZERO*/ - "1",/*ICAL_RESTRICTION_ONE*/ - "zero or more",/*ICAL_RESTRICTION_ZEROPLUS*/ - "one or more" ,/*ICAL_RESTRICTION_ONEPLUS*/ - "zero or more",/*ICAL_RESTRICTION_ZEROORONE*/ - "zero or one, exclusive with another property",/*ICAL_RESTRICTION_ONEEXCLUSIVE*/ - "zero or one, mutual with another property",/*ICAL_RESTRICTION_ONEMUTUAL*/ - "unknown number" /*ICAL_RESTRICTION_UNKNOWN*/ -}; - - -int -icalrestriction_compare(icalrestriction_kind restr, int count){ - - if ( restr < ICAL_RESTRICTION_NONE || restr > ICAL_RESTRICTION_UNKNOWN - || count < 0){ - return -1; - } - - if (count > 2) { - count = 2; - } - - return compare_map[restr][count]; - -} - -int icalrestriction_check_component(icalproperty_method method, - icalcomponent* comp) -{ - icalproperty_kind kind; - icalcomponent_kind comp_kind; - icalrestriction_kind restr; - int count; - int compare; - int valid = 1; - - comp_kind = icalcomponent_isa(comp); - - /* Check all of the properties in this component */ - - for(kind = ICAL_ANY_PROPERTY+1; kind != ICAL_NO_PROPERTY; kind++){ - count = icalcomponent_count_properties(comp, kind); - - restr = icalrestriction_get_property_restriction(method, - comp_kind, - kind); - - - if(restr == ICAL_RESTRICTION_ONEEXCLUSIVE ) { - /* HACK. Treat this as a 0/1 restriction */ - restr = ICAL_RESTRICTION_ZEROORONE; - compare = icalrestriction_compare(restr,count); - } else if (restr == ICAL_RESTRICTION_ONEMUTUAL ) { - /* HACK. Treat this as a 0/1 restriction */ - restr = ICAL_RESTRICTION_ZEROORONE; - compare = icalrestriction_compare(restr,count); - } else { - compare = icalrestriction_compare(restr,count); - } - - assert(compare != -1); - - - if (compare == 0){ - char temp[1024]; - - sprintf(temp, "Failed iTIP restrictions for property %s. Expected %s instances of the property and got %d", - icalenum_property_kind_to_string(kind), - restr_string_map[restr], count); - - icalcomponent_add_property - (comp, - icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP), - 0)); - } - - - valid = valid && compare; - } - - - - return valid; - - -} - -int icalrestriction_check(icalcomponent* outer_comp) -{ - icalcomponent_kind comp_kind; - icalproperty_method method; - icalcomponent* inner_comp; - icalproperty *method_prop; - int valid; - - icalerror_check_arg_rz( (outer_comp!=0), "outer comp"); - - - /* Get the Method value from the outer component */ - - comp_kind = icalcomponent_isa(outer_comp); - - if (comp_kind != ICAL_VCALENDAR_COMPONENT){ - icalerror_set_errno(ICAL_BADARG_ERROR); - return 0; - } - - method_prop = icalcomponent_get_first_property(outer_comp, - ICAL_METHOD_PROPERTY); - - if (method_prop == 0){ - method = ICAL_METHOD_NONE; - } else { - method = icalproperty_get_method(method_prop); - } - - - /* Check the VCALENDAR wrapper */ - valid = icalrestriction_check_component(ICAL_METHOD_NONE,outer_comp); - - - /* Now check the inner components */ - - for(inner_comp= icalcomponent_get_first_component(outer_comp, - ICAL_ANY_COMPONENT); - inner_comp != 0; - inner_comp= icalcomponent_get_next_component(outer_comp, - ICAL_ANY_COMPONENT)){ - - valid = valid && icalrestriction_check_component(method,inner_comp); - - } - - - return valid; - -} - -icalrestriction_kind -icalrestriction_get_property_restriction(icalproperty_method method, - icalcomponent_kind component, - icalproperty_kind property) -{ - int i; - - for(i = 0; - icalrestriction_property_records[i].restriction != ICAL_RESTRICTION_NONE; - i++){ - - if (method == icalrestriction_property_records[i].method && - component == icalrestriction_property_records[i].component && - property == icalrestriction_property_records[i].property ){ - return icalrestriction_property_records[i].restriction; - } - } - - return ICAL_RESTRICTION_UNKNOWN; -} - -icalrestriction_kind -icalrestriction_get_component_restriction(icalproperty_method method, - icalcomponent_kind component, - icalcomponent_kind subcomponent) -{ - - int i; - - for(i = 0; - icalrestriction_component_records[i].restriction != ICAL_RESTRICTION_NONE; - i++){ - - if (method == icalrestriction_component_records[i].method && - component == icalrestriction_component_records[i].component && - subcomponent == icalrestriction_component_records[i].subcomponent ){ - return icalrestriction_component_records[i].restriction; - } - } - - return ICAL_RESTRICTION_UNKNOWN; -} - -/* Everything below this line is machine generated. Do not edit. */ -icalrestriction_property_record icalrestriction_property_records[] = { - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_check_exclusive}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_check_exclusive}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_check_exclusive}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_check_exclusive}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE, icalrestriction_check_exclusive}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_check_mutual}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE} -}; -icalrestriction_component_record icalrestriction_component_records[] = { - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE} -}; diff --git a/libical/src/libical/ical.h b/libical/src/libical/ical.h deleted file mode 100644 index cd5ca31dd5..0000000000 --- a/libical/src/libical/ical.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: ical.h - CREATOR: eric 20 March 1999 - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is ical.h - -======================================================================*/ - -#ifndef ICAL_H -#define ICAL_H - -#include "icalenums.h" -#include "icalvalue.h" -#include "icalparameter.h" -#include "icalproperty.h" -#include "icalcomponent.h" -#include "icaltypes.h" -#include "icalparser.h" -#include "icalmemory.h" -#include "icalerror.h" -#include "icalrestriction.h" - - -#endif /* !ICAL_H */ - - - diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c deleted file mode 100644 index a1a2535e7a..0000000000 --- a/libical/src/libical/icalcomponent.c +++ /dev/null @@ -1,700 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalcomponent.c - CREATOR: eric 28 April 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalcomponent.c - -======================================================================*/ - -#include "ical.h" -#include "pvl.h" /* "Pointer-to-void list" */ -#include /* for malloc */ -#include /* for va_list, etc */ -#include -#include "icalerror.h" -#include -#include /* for fprintf */ -#include "icalmemory.h" -#include "icalenums.h" - - -/* icalproperty functions that only components get to use */ -void icalproperty_set_parent(icalproperty* property, - icalcomponent* component); - -icalcomponent* icalproperty_get_parent(icalproperty* property); - - - -struct icalcomponent_impl -{ - char id[5]; - icalcomponent_kind kind; - char* x_name; - pvl_list properties; - pvl_elem property_iterator; - pvl_list components; - pvl_elem component_iterator; - icalcomponent* parent; -}; - -void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args) -{ - void* vp; - - while((vp = va_arg(args, void*)) != 0) { - - assert (icalcomponent_isa_component(vp) != 0 || - icalproperty_isa_property(vp) != 0 ) ; - - if (icalcomponent_isa_component(vp) != 0 ){ - - icalcomponent_add_component((icalcomponent*)impl, - (icalcomponent*)vp); - - } else if (icalproperty_isa_property(vp) != 0 ){ - - icalcomponent_add_property((icalcomponent*)impl, - (icalproperty*)vp); - } - } -} - -icalcomponent* -icalcomponent_new_impl (icalcomponent_kind kind) -{ - struct icalcomponent_impl* comp; - - if ( ( comp = (struct icalcomponent_impl*) - malloc(sizeof(struct icalcomponent_impl))) == 0) { - errno = ENOMEM; - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - - strcpy(comp->id,"comp"); - - comp->kind = kind; - comp->properties = pvl_newlist(); - comp->property_iterator = 0; - comp->components = pvl_newlist(); - comp->component_iterator = 0; - comp->x_name = 0; - comp->parent = 0; - - return comp; -} - -icalcomponent* -icalcomponent_new (icalcomponent_kind kind) -{ - return (icalcomponent*)icalcomponent_new_impl(kind); -} - -icalcomponent* -icalcomponent_vanew (icalcomponent_kind kind, ...) -{ - va_list args; - - struct icalcomponent_impl *impl = icalcomponent_new_impl(kind); - - if (impl == 0){ - return 0; - } - - va_start(args,kind); - icalcomponent_add_children(impl, args); - va_end(args); - - return (icalcomponent*) impl; -} - -icalcomponent* icalcomponent_new_from_string(char* str) -{ - icalcomponent_kind kind; - - icalerror_check_arg_rz( (str!=0), "str"); - - kind = icalenum_string_to_component_kind(str); - - if (kind == ICAL_NO_COMPONENT){ - return 0; - } - - return icalcomponent_new(kind); -} - -icalcomponent* icalcomponent_new_clone(icalcomponent* component) -{ - struct icalcomponent_impl *old = (struct icalcomponent_impl*)component; - struct icalcomponent_impl *new; - icalproperty *p; - icalcomponent *c; - - icalerror_check_arg_rv( (component!=0), "component"); - - new = icalcomponent_new_impl(old->kind); - - if (new == 0){ - return 0; - } - - - for(p = icalcomponent_get_first_property(old,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(old,ICAL_ANY_PROPERTY)){ - - icalcomponent_add_property(new,icalproperty_new_clone(p)); - } - - - for(c = icalcomponent_get_first_component(old,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(old,ICAL_ANY_COMPONENT)){ - - icalcomponent_add_component(new,icalcomponent_new_clone(c)); - } - - return new; - -} - - -void -icalcomponent_free (icalcomponent* component) -{ - icalproperty* prop; - icalcomponent* comp; - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - - icalerror_check_arg_rv( (component!=0), "component"); - -#ifdef ICAL_FREE_ON_LIST_IS_ERROR - icalerror_assert( (c->parent ==0),"Tried to free a component that is still attached to a parent component"); -#else - if(c->parent != 0){ - return; - } -#endif - - if(component != 0 ){ - - while( (prop=pvl_pop(c->properties)) != 0){ - assert(prop != 0); - icalproperty_set_parent(prop,0); - icalproperty_free(prop); - } - - pvl_free(c->properties); - - while( (comp=pvl_data(pvl_head(c->components))) != 0){ - assert(comp!=0); - icalcomponent_remove_component(component,comp); - icalcomponent_free(comp); - } - - pvl_free(c->components); - - if (c->x_name != 0) { - free(c->x_name); - } - - c->kind = ICAL_NO_COMPONENT; - c->properties = 0; - c->property_iterator = 0; - c->components = 0; - c->component_iterator = 0; - c->x_name = 0; - c->id[0] = 'X'; - - free(c); - } -} - -char* -icalcomponent_as_ical_string (icalcomponent* component) -{ - char* buf, *out_buf; - char* tmp_buf; - size_t buf_size = 1024; - char* buf_ptr = 0; - - icalcomponent *c; - icalproperty *p; - icalcomponent_kind kind = icalcomponent_isa(component); - - char* kind_string; - - buf = icalmemory_new_buffer(buf_size); - buf_ptr = buf; - - icalerror_check_arg_rz( (component!=0), "component"); - icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT"); - - kind_string = icalenum_component_kind_to_string(kind); - - icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component"); - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:"); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n"); - - - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY)){ - - tmp_buf = icalproperty_as_ical_string(p); - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); - } - - - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ - - tmp_buf = icalcomponent_as_ical_string(c); - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf); - - } - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:"); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, - icalenum_component_kind_to_string(kind)); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n"); - - out_buf = icalmemory_tmp_copy(buf); - free(buf); - - return out_buf; -} - - -int -icalcomponent_is_valid (icalcomponent* component) -{ - struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component; - - - if ( (strcmp(impl->id,"comp") == 0) && - impl->kind != ICAL_NO_COMPONENT){ - return 1; - } else { - return 0; - } - -} - - -icalcomponent_kind -icalcomponent_isa (icalcomponent* component) -{ - struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component; - icalerror_check_arg_rz( (component!=0), "component"); - - if(component != 0) - { - return impl->kind; - } - - return ICAL_NO_COMPONENT; -} - - -int -icalcomponent_isa_component (void* component) -{ - struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component; - - icalerror_check_arg_rz( (component!=0), "component"); - - if (strcmp(impl->id,"comp") == 0) { - return 1; - } else { - return 0; - } - -} - -int icalcomponent_property_sorter(void *a, void *b) -{ - icalproperty_kind kinda, kindb; - char *ksa, *ksb; - - kinda = icalproperty_isa((icalproperty*)a); - kindb = icalproperty_isa((icalproperty*)b); - - ksa = icalenum_property_kind_to_string(kinda); - ksb = icalenum_property_kind_to_string(kindb); - - return strcmp(ksa,ksb); -} - - -void -icalcomponent_add_property (icalcomponent* component, icalproperty* property) -{ - struct icalcomponent_impl *impl; - - icalerror_check_arg_rv( (component!=0), "component"); - icalerror_check_arg_rv( (property!=0), "property"); - - impl = (struct icalcomponent_impl*)component; - - icalerror_assert( (!icalproperty_get_parent(property)),"The property has already been added to a component. Remove the property with icalcomponent_remove_property before calling icalcomponent_add_property"); - - icalproperty_set_parent(property,component); - -#ifdef ICAL_INSERT_ORDERED - pvl_insert_ordered(impl->properties, - icalcomponent_property_sorter,property); -#else - pvl_push(impl->properties,property); -#endif - -} - - -void -icalcomponent_remove_property (icalcomponent* component, icalproperty* property) -{ - struct icalcomponent_impl *impl; - pvl_elem itr, next_itr; - struct icalproperty_impl *pimpl; - - icalerror_check_arg_rv( (component!=0), "component"); - icalerror_check_arg_rv( (property!=0), "property"); - - impl = (struct icalcomponent_impl*)component; - - pimpl = (struct icalproperty_impl*)property; - - icalerror_assert( (icalproperty_get_parent(property)),"The property is not a member of a component"); - - - for( itr = pvl_head(impl->properties); - itr != 0; - itr = next_itr) - { - next_itr = pvl_next(itr); - - if( pvl_data(itr) == (void*)property ){ - - if (impl->property_iterator == itr){ - impl->property_iterator = pvl_next(itr); - } - - pvl_remove( impl->properties, itr); - icalproperty_set_parent(property,0); - } - } -} - -int -icalcomponent_count_properties (icalcomponent* component, icalproperty_kind kind) -{ - int count=0; - icalproperty *p; - icalerror_check_arg_rz( (component!=0), "component"); - - for(p = icalcomponent_get_first_property(component,kind); - p != 0; - p = icalcomponent_get_next_property(component,kind)){ - - count++; - } - - - return count; - -} - -icalproperty* icalcomponent_get_current_property (icalcomponent* component) -{ - - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - icalerror_check_arg_rz( (component!=0),"component"); - - if ((c->property_iterator==0)){ - return 0; - } - - return (icalproperty*) pvl_data(c->property_iterator); - -} - -icalproperty* -icalcomponent_get_first_property (icalcomponent* component, icalproperty_kind kind) -{ - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - icalerror_check_arg_rz( (component!=0),"component"); - - for( c->property_iterator = pvl_head(c->properties); - c->property_iterator != 0; - c->property_iterator = pvl_next(c->property_iterator)) { - - icalproperty *p = (icalproperty*) pvl_data(c->property_iterator); - - if (icalproperty_isa(p) == kind || kind == ICAL_ANY_PROPERTY) { - - return p; - } - } - return 0; -} - -icalproperty* -icalcomponent_get_next_property (icalcomponent* component, icalproperty_kind kind) -{ - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - icalerror_check_arg_rz( (component!=0),"component"); - - if (c->property_iterator == 0){ - return 0; - } - - for( c->property_iterator = pvl_next(c->property_iterator); - c->property_iterator != 0; - c->property_iterator = pvl_next(c->property_iterator)) { - - icalproperty *p = (icalproperty*) pvl_data(c->property_iterator); - - if (icalproperty_isa(p) == kind || kind == ICAL_ANY_PROPERTY) { - - return p; - } - } - - return 0; -} - - -icalproperty** -icalcomponent_get_properties (icalcomponent* component, icalproperty_kind kind); - - -void -icalcomponent_add_component (icalcomponent* parent, icalcomponent* child) -{ - struct icalcomponent_impl *impl, *cimpl; - - icalerror_check_arg_rv( (parent!=0), "parent"); - icalerror_check_arg_rv( (child!=0), "child"); - - impl = (struct icalcomponent_impl*)parent; - cimpl = (struct icalcomponent_impl*)child; - - icalerror_assert( (cimpl->parent ==0),"The child component has already been added to a parent component. Remove the component with icalcomponent_remove_componenet before calling icalcomponent_add_component"); - - cimpl->parent = parent; - - pvl_push(impl->components,child); -} - - -void -icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child) -{ - struct icalcomponent_impl *impl,*cimpl; - pvl_elem itr, next_itr; - - icalerror_check_arg_rv( (parent!=0), "parent"); - icalerror_check_arg_rv( (child!=0), "child"); - - impl = (struct icalcomponent_impl*)parent; - cimpl = (struct icalcomponent_impl*)child; - - for( itr = pvl_head(impl->components); - itr != 0; - itr = next_itr) - { - next_itr = pvl_next(itr); - - if( pvl_data(itr) == (void*)child ){ - - if (impl->component_iterator == itr){ - /* impl->component_iterator = pvl_next(itr);*/ - } - pvl_remove( impl->components, itr); - cimpl->parent = 0; - } - } -} - - -int -icalcomponent_count_components (icalcomponent* component, icalcomponent_kind kind) -{ - int count=0; - icalcomponent *c; - icalerror_check_arg_rz( (component!=0), "component"); - - for(c = icalcomponent_get_first_component(component,kind); - c != 0; - c = icalcomponent_get_next_component(component,kind)){ - - count++; - } - - - return count; -} - -icalcomponent* -icalcomponent_get_current_component(icalcomponent* component) -{ - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - - icalerror_check_arg_rz( (component!=0),"component"); - - if (c->component_iterator == 0){ - return 0; - } - - return (icalcomponent*) pvl_data(c->component_iterator); -} - -icalcomponent* -icalcomponent_get_first_component (icalcomponent* component, - icalcomponent_kind kind) -{ - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - - icalerror_check_arg_rz( (component!=0),"component"); - - for( c->component_iterator = pvl_head(c->components); - c->component_iterator != 0; - c->component_iterator = pvl_next(c->component_iterator)) { - - icalcomponent *p = (icalcomponent*) pvl_data(c->component_iterator); - - if (icalcomponent_isa(p) == kind || kind == ICAL_ANY_COMPONENT) { - - return p; - } - } - - return 0; -} - - -icalcomponent* -icalcomponent_get_next_component (icalcomponent* component, icalcomponent_kind kind) -{ - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - - icalerror_check_arg_rz( (component!=0),"component"); - - if (c->component_iterator == 0){ - return 0; - } - - for( c->component_iterator = pvl_next(c->component_iterator); - c->component_iterator != 0; - c->component_iterator = pvl_next(c->component_iterator)) { - - icalcomponent *p = (icalcomponent*) pvl_data(c->component_iterator); - - if (icalcomponent_isa(p) == kind || kind == ICAL_ANY_COMPONENT) { - - return p; - } - } - - return 0; -} - - -icalproperty** -icalcomponent_get_component (icalcomponent* component, icalproperty_kind kind); - - -int icalcomponent_count_errors(icalcomponent* component) -{ - int errors = 0; - icalproperty *p; - icalcomponent *c; - - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY)){ - - if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) - { - errors++; - } - } - - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ - - errors += icalcomponent_count_errors(c); - - } - - return errors; -} - - -void icalcomponent_strip_errors(icalcomponent* component) -{ - icalproperty *p, *next_p; - icalcomponent *c; - - for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY); - p != 0; - p = next_p){ - - next_p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY); - - if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY) - { - icalcomponent_remove_property(component,p); - } - } - - for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){ - - icalcomponent_strip_errors(c); - } - -} - -icalcomponent* icalcomponent_get_parent(icalcomponent* component) -{ - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - - return c->parent; -} - -void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent) -{ - struct icalcomponent_impl *c = (struct icalcomponent_impl*)component; - - c->parent = parent; -} - - diff --git a/libical/src/libical/icalcomponent.h b/libical/src/libical/icalcomponent.h deleted file mode 100644 index 9e0e9f5a9f..0000000000 --- a/libical/src/libical/icalcomponent.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalcomponent.h - CREATOR: eric 20 March 1999 - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalcomponent.h - -======================================================================*/ - -#ifndef ICALCOMPONENT_H -#define ICALCOMPONENT_H - -#include "icalproperty.h" -#include "icalvalue.h" -#include "icalenums.h" /* defines icalcomponent_kind */ - -typedef void icalcomponent; - -icalcomponent* icalcomponent_new(icalcomponent_kind kind); -icalcomponent* icalcomponent_new_clone(icalcomponent* component); -icalcomponent* icalcomponent_new_from_string(char* str); -icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...); -void icalcomponent_free(icalcomponent* component); - -char* icalcomponent_as_ical_string(icalcomponent* component); - -int icalcomponent_is_valid(icalcomponent* component); - -icalcomponent_kind icalcomponent_isa(icalcomponent* component); - -int icalcomponent_isa_component (void* component); - -/* - * Working with properties - */ - -void icalcomponent_add_property(icalcomponent* component, - icalproperty* property); - -void icalcomponent_remove_property(icalcomponent* component, - icalproperty* property); - -int icalcomponent_count_properties(icalcomponent* component, - icalproperty_kind kind); - -/* Iterate through the properties */ -icalproperty* icalcomponent_get_current_property(icalcomponent* component); - -icalproperty* icalcomponent_get_first_property(icalcomponent* component, - icalproperty_kind kind); -icalproperty* icalcomponent_get_next_property(icalcomponent* component, - icalproperty_kind kind); - -/* Return a null-terminated array of icalproperties*/ - -icalproperty** icalcomponent_get_properties(icalcomponent* component, - icalproperty_kind kind); - - -/* - * Working with components - */ - - -void icalcomponent_add_component(icalcomponent* parent, - icalcomponent* child); - -void icalcomponent_remove_component(icalcomponent* parent, - icalcomponent* child); - -int icalcomponent_count_components(icalcomponent* component, - icalcomponent_kind kind); - -/* Iterate through components */ -icalcomponent* icalcomponent_get_current_component (icalcomponent* component); - -icalcomponent* icalcomponent_get_first_component(icalcomponent* component, - icalcomponent_kind kind); -icalcomponent* icalcomponent_get_next_component(icalcomponent* component, - icalcomponent_kind kind); - -/* Return a null-terminated array of icalproperties*/ -icalproperty** icalcomponent_get_component(icalcomponent* component, - icalproperty_kind kind); - -/* Working with embedded error properties */ - -int icalcomponent_count_errors(icalcomponent* component); -void icalcomponent_strip_errors(icalcomponent* component); - - -/* Internal operations. You don't see these... */ -icalcomponent* icalcomponent_get_parent(icalcomponent* component); -void icalcomponent_set_parent(icalcomponent* component, - icalcomponent* parent); - -#endif /* !ICALCOMPONENT_H */ - - - diff --git a/libical/src/libical/icalenums.c b/libical/src/libical/icalenums.c deleted file mode 100644 index 70931d03d0..0000000000 --- a/libical/src/libical/icalenums.c +++ /dev/null @@ -1,547 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalenum.c - CREATOR: eric 29 April 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalenum.c - - ======================================================================*/ - -#include "icalenums.h" - -struct icalproperty_kind_map { - icalproperty_kind kind; - char name[20]; -}; - -static struct icalproperty_kind_map property_map[] = -{ - { ICAL_ACTION_PROPERTY, "ACTION"}, - { ICAL_ATTACH_PROPERTY, "ATTACH"}, - { ICAL_ATTENDEE_PROPERTY, "ATTENDEE"}, - { ICAL_CALSCALE_PROPERTY, "CALSCALE"}, - { ICAL_CATEGORIES_PROPERTY, "CATEGORIES"}, - { ICAL_CLASS_PROPERTY, "CLASS"}, - { ICAL_COMMENT_PROPERTY, "COMMENT"}, - { ICAL_COMPLETED_PROPERTY, "COMPLETED"}, - { ICAL_CONTACT_PROPERTY, "CONTACT"}, - { ICAL_CREATED_PROPERTY, "CREATED"}, - { ICAL_DESCRIPTION_PROPERTY, "DESCRIPTION"}, - { ICAL_DTEND_PROPERTY, "DTEND"}, - { ICAL_DTSTAMP_PROPERTY, "DTSTAMP"}, - { ICAL_DTSTART_PROPERTY, "DTSTART"}, - { ICAL_DUE_PROPERTY, "DUE"}, - { ICAL_DURATION_PROPERTY, "DURATION"}, - { ICAL_EXDATE_PROPERTY, "EXDATE"}, - { ICAL_EXRULE_PROPERTY, "EXRULE"}, - { ICAL_FREEBUSY_PROPERTY, "FREEBUSY"}, - { ICAL_GEO_PROPERTY, "GEO"}, - { ICAL_LASTMODIFIED_PROPERTY, "LAST-MODIFIED"}, - { ICAL_LOCATION_PROPERTY, "LOCATION"}, - { ICAL_METHOD_PROPERTY, "METHOD"}, - { ICAL_ORGANIZER_PROPERTY, "ORGANIZER"}, - { ICAL_PERCENTCOMPLETE_PROPERTY, "PERCENT-COMPLETE"}, - { ICAL_PRIORITY_PROPERTY, "PRIORITY"}, - { ICAL_PRODID_PROPERTY, "PRODID"}, - { ICAL_RDATE_PROPERTY, "RDATE"}, - { ICAL_RECURRENCEID_PROPERTY, "RECURRENCE-ID"}, - { ICAL_RELATEDTO_PROPERTY, "RELATED-TO"}, - { ICAL_REPEAT_PROPERTY, "REPEAT"}, - { ICAL_REQUESTSTATUS_PROPERTY, "REQUEST-STATUS"}, - { ICAL_RESOURCES_PROPERTY, "RESOURCES"}, - { ICAL_RRULE_PROPERTY, "RRULE"}, - { ICAL_SEQUENCE_PROPERTY, "SEQUENCE"}, - { ICAL_STATUS_PROPERTY, "STATUS"}, - { ICAL_SUMMARY_PROPERTY, "SUMMARY"}, - { ICAL_TRANSP_PROPERTY, "TRANSP"}, - { ICAL_TRIGGER_PROPERTY, "TRIGGER"}, - { ICAL_TZID_PROPERTY, "TZID"}, - { ICAL_TZNAME_PROPERTY, "TZNAME"}, - { ICAL_TZOFFSETFROM_PROPERTY, "TZOFFSETFROM"}, - { ICAL_TZOFFSETTO_PROPERTY, "TZOFFSETTO"}, - { ICAL_TZURL_PROPERTY, "TZURL"}, - { ICAL_UID_PROPERTY, "UID"}, - { ICAL_URL_PROPERTY, "URL"}, - { ICAL_VERSION_PROPERTY, "VERSION"}, - { ICAL_X_PROPERTY,"X_PROPERTY"}, - - /* CAP Object Properties */ - - { ICAL_SCOPE_PROPERTY, "SCOPE"}, - { ICAL_MAXRESULTS_PROPERTY, "MAXRESULTS"}, - { ICAL_MAXRESULTSSIZE_PROPERTY, "MAXRESULTSSIZE"}, - { ICAL_QUERY_PROPERTY, "QUERY" }, - { ICAL_QUERYNAME_PROPERTY, "QUERYNAME" }, - { ICAL_TARGET_PROPERTY, "TARGET"}, - - /* libical private properties */ - { ICAL_XLICERROR_PROPERTY,"X-LIC-ERROR"}, - { ICAL_XLICCLUSTERCOUNT_PROPERTY,"X-LIC-CLUSTERCOUNT"}, - - /* End of the list */ - { ICAL_NO_PROPERTY, ""} -}; - - -char* icalenum_property_kind_to_string(icalproperty_kind kind) -{ - int i; - - for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { - if (property_map[i].kind == kind) { - return property_map[i].name; - } - } - - return 0; - -} - -icalproperty_kind icalenum_string_to_property_kind(char* string) -{ - int i; - - if (string ==0 ) { - return ICAL_NO_PROPERTY; - } - - for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) { - if (strcmp(property_map[i].name, string) == 0) { - return property_map[i].kind; - } - } - - return ICAL_NO_PROPERTY; -} - - - - -struct icalparameter_kind_map { - icalparameter_kind kind; - char name[20]; -}; - -static struct icalparameter_kind_map parameter_map[] = -{ - { ICAL_ALTREP_PARAMETER, "ALTREP"}, - { ICAL_CN_PARAMETER, "CN"}, - { ICAL_CUTYPE_PARAMETER, "CUTYPE"}, - { ICAL_DELEGATEDFROM_PARAMETER, "DELEGATED-FROM"}, - { ICAL_DELEGATEDTO_PARAMETER, "DELEGATED-TO"}, - { ICAL_DIR_PARAMETER, "DIR"}, - { ICAL_ENCODING_PARAMETER, "ENCODING"}, - { ICAL_FBTYPE_PARAMETER, "FBTYPE"}, - { ICAL_FMTTYPE_PARAMETER, "FMTTYPE"}, - { ICAL_LANGUAGE_PARAMETER, "LANGUAGE"}, - { ICAL_MEMBER_PARAMETER, "MEMBER"}, - { ICAL_PARTSTAT_PARAMETER, "PARTSTAT"}, - { ICAL_RANGE_PARAMETER, "RANGE"}, - { ICAL_RELATED_PARAMETER, "RELATED"}, - { ICAL_RELTYPE_PARAMETER, "RELTYPE"}, - { ICAL_ROLE_PARAMETER, "ROLE"}, - { ICAL_RSVP_PARAMETER, "RSVP"}, - { ICAL_SENTBY_PARAMETER, "SENT-BY"}, - { ICAL_TZID_PARAMETER, "TZID"}, - { ICAL_VALUE_PARAMETER, "VALUE"}, - - /* CAP parameters */ - - /* libical private parameters */ - { ICAL_XLICERRORTYPE_PARAMETER, "X-LIC-ERRORTYPE"}, - { ICAL_XLICCOMPARETYPE_PARAMETER, "X-LIC-COMPARETYPE"}, - - /* End of list */ - { ICAL_NO_PARAMETER, ""} -}; - -char* icalenum_parameter_kind_to_string(icalparameter_kind kind) -{ - int i; - - for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) { - if (parameter_map[i].kind == kind) { - return parameter_map[i].name; - } - } - - return 0; - -} - -icalparameter_kind icalenum_string_to_parameter_kind(char* string) -{ - int i; - - if (string ==0 ) { - return ICAL_NO_PARAMETER; - } - - for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) { - if (strcmp(parameter_map[i].name, string) == 0) { - return parameter_map[i].kind; - } - } - - return ICAL_NO_PARAMETER; -} - -struct icalvalue_kind_map { - icalvalue_kind kind; - char name[20]; -}; - -static struct icalvalue_kind_map value_map[] = -{ - { ICAL_BINARY_VALUE, "BINARY"}, - { ICAL_BOOLEAN_VALUE, "BOOLEAN"}, - { ICAL_CALADDRESS_VALUE, "CAL-ADDRESS"}, - { ICAL_DATE_VALUE, "DATE"}, - { ICAL_DATETIME_VALUE, "DATE-TIME"}, - { ICAL_DURATION_VALUE, "DURATION"}, - { ICAL_FLOAT_VALUE, "FLOAT"}, - { ICAL_INTEGER_VALUE, "INTEGER"}, - { ICAL_PERIOD_VALUE, "PERIOD"}, - { ICAL_RECUR_VALUE, "RECUR"}, - { ICAL_TEXT_VALUE, "TEXT"}, - { ICAL_TIME_VALUE, "TIME"}, - { ICAL_URI_VALUE, "URI"}, - { ICAL_UTCOFFSET_VALUE, "UTC-OFFSET"}, - { ICAL_GEO_VALUE, "FLOAT"}, /* Not an RFC2445 type */ - { ICAL_ATTACH_VALUE, "XATTACH"}, /* Not an RFC2445 type */ - { ICAL_DATETIMEDATE_VALUE, "XDATETIMEDATE"}, /* Not an RFC2445 type */ - { ICAL_DATETIMEPERIOD_VALUE, "XDATETIMEPERIOD"}, /* Not an RFC2445 type */ - { ICAL_QUERY_VALUE, "QUERY"}, - { ICAL_NO_VALUE, ""}, -}; - -char* icalenum_value_kind_to_string(icalvalue_kind kind) -{ - int i; - - for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) { - if (value_map[i].kind == kind) { - return value_map[i].name; - } - } - - return 0; - -} - -icalvalue_kind icalenum_value_kind_by_prop(icalproperty_kind kind) -{ - - return ICAL_NO_VALUE; -} - - -struct icalcomponent_kind_map { - icalcomponent_kind kind; - char name[20]; -}; - - - -static struct icalcomponent_kind_map component_map[] = -{ - { ICAL_VEVENT_COMPONENT, "VEVENT" }, - { ICAL_VTODO_COMPONENT, "VTODO" }, - { ICAL_VJOURNAL_COMPONENT, "VJOURNAL" }, - { ICAL_VCALENDAR_COMPONENT, "VCALENDAR" }, - { ICAL_VFREEBUSY_COMPONENT, "VFREEBUSY" }, - { ICAL_VTIMEZONE_COMPONENT, "VTIMEZONE" }, - { ICAL_VALARM_COMPONENT, "VALARM" }, - { ICAL_XSTANDARD_COMPONENT, "STANDARD" }, /*These are part of RFC2445 */ - { ICAL_XDAYLIGHT_COMPONENT, "DAYLIGHT" }, /*but are not really components*/ - { ICAL_X_COMPONENT, "X" }, - { ICAL_VSCHEDULE_COMPONENT, "SCHEDULE" }, - - /* CAP components */ - { ICAL_VQUERY_COMPONENT, "VQUERY" }, - { ICAL_VCAR_COMPONENT, "VCAR" }, - { ICAL_VCOMMAND_COMPONENT, "VCOMMAND" }, - - /* libical private components */ - { ICAL_XLICINVALID_COMPONENT, "X-LIC-UNKNOWN" }, - { ICAL_XROOT_COMPONENT, "ROOT" }, - - /* End of list */ - { ICAL_NO_COMPONENT, "" }, -}; - -char* icalenum_component_kind_to_string(icalcomponent_kind kind) -{ - int i; - - for (i=0; component_map[i].kind != ICAL_NO_COMPONENT; i++) { - if (component_map[i].kind == kind) { - return component_map[i].name; - } - } - - return 0; - -} - -icalcomponent_kind icalenum_string_to_component_kind(char* string) -{ - int i; - - if (string ==0 ) { - return ICAL_NO_COMPONENT; - } - - for (i=0; component_map[i].kind != ICAL_NO_COMPONENT; i++) { - if (strcmp(component_map[i].name, string) == 0) { - return component_map[i].kind; - } - } - - return ICAL_NO_COMPONENT; -} - -struct icalproperty_kind_value_map { - icalproperty_kind prop; - icalvalue_kind value; -}; - -static struct icalproperty_kind_value_map propval_map[] = -{ - { ICAL_CALSCALE_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_METHOD_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_PRODID_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_VERSION_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_CATEGORIES_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_CLASS_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_COMMENT_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_DESCRIPTION_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_LOCATION_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_PERCENTCOMPLETE_PROPERTY, ICAL_INTEGER_VALUE }, - { ICAL_PRIORITY_PROPERTY, ICAL_INTEGER_VALUE }, - { ICAL_RESOURCES_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_STATUS_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_SUMMARY_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_COMPLETED_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_FREEBUSY_PROPERTY, ICAL_PERIOD_VALUE }, - { ICAL_TRANSP_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_TZNAME_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_TZOFFSETFROM_PROPERTY, ICAL_UTCOFFSET_VALUE }, - { ICAL_TZOFFSETTO_PROPERTY, ICAL_UTCOFFSET_VALUE }, - { ICAL_TZURL_PROPERTY, ICAL_URI_VALUE }, - { ICAL_TZID_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_ATTENDEE_PROPERTY, ICAL_CALADDRESS_VALUE }, - { ICAL_CONTACT_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_ORGANIZER_PROPERTY, ICAL_CALADDRESS_VALUE }, - { ICAL_RELATEDTO_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_URL_PROPERTY, ICAL_URI_VALUE }, - { ICAL_UID_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_EXRULE_PROPERTY, ICAL_RECUR_VALUE }, - { ICAL_RRULE_PROPERTY, ICAL_RECUR_VALUE }, - { ICAL_ACTION_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_REPEAT_PROPERTY, ICAL_INTEGER_VALUE }, - { ICAL_CREATED_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_DTSTAMP_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_LASTMODIFIED_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_SEQUENCE_PROPERTY, ICAL_INTEGER_VALUE }, - { ICAL_X_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_REQUESTSTATUS_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_ATTACH_PROPERTY, ICAL_URI_VALUE }, - { ICAL_GEO_PROPERTY, ICAL_GEO_VALUE }, - { ICAL_DTEND_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_DUE_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_DTSTART_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_RECURRENCEID_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_EXDATE_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_RDATE_PROPERTY, ICAL_DATETIME_VALUE }, - { ICAL_TRIGGER_PROPERTY, ICAL_DURATION_VALUE }, - { ICAL_DURATION_PROPERTY, ICAL_DURATION_VALUE }, - - /* CAP properties */ - { ICAL_SCOPE_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_MAXRESULTS_PROPERTY, ICAL_INTEGER_VALUE}, - { ICAL_MAXRESULTSSIZE_PROPERTY, ICAL_INTEGER_VALUE}, - { ICAL_QUERY_PROPERTY, ICAL_QUERY_VALUE }, - { ICAL_QUERYNAME_PROPERTY, ICAL_TEXT_VALUE }, - { ICAL_TARGET_PROPERTY, ICAL_CALADDRESS_VALUE }, - - - /* libical private properties */ - { ICAL_XLICERROR_PROPERTY,ICAL_TEXT_VALUE}, - { ICAL_XLICCLUSTERCOUNT_PROPERTY,ICAL_INTEGER_VALUE}, - - - /* End of list */ - { ICAL_NO_PROPERTY, ICAL_NO_PROPERTY} -}; - - -icalvalue_kind icalenum_property_kind_to_value_kind(icalproperty_kind kind) -{ - int i; - - for (i=0; propval_map[i].value != ICAL_NO_VALUE; i++) { - if ( propval_map[i].prop == kind ) { - return propval_map[i].value; - } - } - - return ICAL_NO_VALUE; -} - -struct {icalrecurrencetype_weekday wd; char * str; } -wd_map[] = { - {ICAL_SUNDAY_WEEKDAY,"SU"}, - {ICAL_MONDAY_WEEKDAY,"MO"}, - {ICAL_TUESDAY_WEEKDAY,"TU"}, - {ICAL_WEDNESDAY_WEEKDAY,"WE"}, - {ICAL_THURSDAY_WEEKDAY,"TH"}, - {ICAL_FRIDAY_WEEKDAY,"FR"}, - {ICAL_SATURDAY_WEEKDAY,"SA"}, - {ICAL_NO_WEEKDAY,0} -}; - -char* icalenum_weekday_to_string(icalrecurrencetype_weekday kind) -{ - int i; - - for (i=0; wd_map[i].wd != ICAL_NO_WEEKDAY; i++) { - if ( wd_map[i].wd == kind) { - return wd_map[i].str; - } - } - - return 0; -} - - -struct { - icalrecurrencetype_frequency kind; - char* str; -} freq_map[] = { - {ICAL_SECONDLY_RECURRENCE,"SECONDLY"}, - {ICAL_MINUTELY_RECURRENCE,"MINUTELY"}, - {ICAL_HOURLY_RECURRENCE,"HOURLY"}, - {ICAL_DAILY_RECURRENCE,"DAILY"}, - {ICAL_WEEKLY_RECURRENCE,"WEEKLY"}, - {ICAL_MONTHLY_RECURRENCE,"MONTHLY"}, - {ICAL_YEARLY_RECURRENCE,"YEARLY"}, - {ICAL_NO_RECURRENCE,0} -}; - -char* icalenum_recurrence_to_string(icalrecurrencetype_frequency kind) -{ - int i; - - for (i=0; freq_map[i].kind != ICAL_NO_RECURRENCE ; i++) { - if ( freq_map[i].kind == kind ) { - return freq_map[i].str; - } - } - return 0; -} - - -struct { - icalrecurrencetype_frequency kind; - int major; - int minor; - char* str; -} status_map[] = { - {ICAL_2_0_SUCCESS_STATUS, 2,0,"Success."}, - {ICAL_2_1_FALLBACK_STATUS, 2,1,"Success but fallback taken on one or more property values."}, - {ICAL_2_2_IGPROP_STATUS, 2,2,"Success, invalid property ignored."}, - {ICAL_2_3_IGPARAM_STATUS, 2,3,"Success, invalid property parameter ignored."}, - {ICAL_2_4_IGXPROP_STATUS, 2,4,"Success, unknown non-standard property ignored."}, - {ICAL_2_5_IGXPARAM_STATUS, 2,5,"Success, unknown non standard property value ignored."}, - {ICAL_2_6_IGCOMP_STATUS, 2,6,"Success, invalid calendar component ignored."}, - {ICAL_2_7_FORWARD_STATUS, 2,7,"Success, request forwarded to Calendar User."}, - {ICAL_2_8_ONEEVENT_STATUS, 2,8,"Success, repeating event ignored. Scheduled as a single component."}, - {ICAL_2_9_TRUNC_STATUS, 2,9,"Success, truncated end date time to date boundary."}, - {ICAL_2_10_ONETODO_STATUS, 2,10,"Success, repeating VTODO ignored. Scheduled as a single VTODO."}, - {ICAL_2_11_TRUNCRRULE_STATUS, 2,11,"Success, unbounded RRULE clipped at some finite number of instances "}, - {ICAL_3_0_INVPROPNAME_STATUS, 3,0,"Invalid property name."}, - {ICAL_3_1_INVPROPVAL_STATUS, 3,1,"Invalid property value."}, - {ICAL_3_2_INVPARAM_STATUS, 3,2,"Invalid property parameter."}, - {ICAL_3_3_INVPARAMVAL_STATUS, 3,3,"Invalid property parameter value."}, - {ICAL_3_4_INVCOMP_STATUS, 3,4,"Invalid calendar component sequence."}, - {ICAL_3_5_INVTIME_STATUS, 3,5,"Invalid date or time."}, - {ICAL_3_6_INVRULE_STATUS, 3,6,"Invalid rule."}, - {ICAL_3_7_INVCU_STATUS, 3,7,"Invalid Calendar User."}, - {ICAL_3_8_NOAUTH_STATUS, 3,8,"No authority."}, - {ICAL_3_9_BADVERSION_STATUS, 3,9,"Unsupported version."}, - {ICAL_3_10_TOOBIG_STATUS, 3,10,"Request entity too large."}, - {ICAL_3_11_MISSREQCOMP_STATUS, 3,11,"Required component or property missing."}, - {ICAL_3_12_UNKCOMP_STATUS, 3,12,"Unknown component or property found."}, - {ICAL_3_13_BADCOMP_STATUS, 3,13,"Unsupported component or property found"}, - {ICAL_3_14_NOCAP_STATUS, 3,14,"Unsupported capability."}, - {ICAL_4_0_BUSY_STATUS, 4,0,"Event conflict. Date/time is busy."}, - {ICAL_5_0_MAYBE_STATUS, 5,0,"Request MAY supported."}, - {ICAL_5_1_UNAVAIL_STATUS, 5,1,"Service unavailable."}, - {ICAL_5_2_NOSERVICE_STATUS, 5,2,"Invalid calendar service."}, - {ICAL_5_3_NOSCHED_STATUS, 5,3,"No scheduling support for user."} -}; - -struct {icalproperty_method method; char* str;} method_map[] = { - {ICAL_METHOD_PUBLISH,"PUBLISH"}, - {ICAL_METHOD_REQUEST,"REQUEST"}, - {ICAL_METHOD_REPLY,"REPLY"}, - {ICAL_METHOD_ADD,"ADD"}, - {ICAL_METHOD_CANCEL,"CANCEL"}, - {ICAL_METHOD_REFRESH,"REFRESH"}, - {ICAL_METHOD_COUNTER,"CPUNTER"}, - {ICAL_METHOD_DECLINECOUNTER,"DECLINECOUNTER"}, - /* CAP Methods */ - {ICAL_METHOD_CREATE,"CREATE"}, - {ICAL_METHOD_READ,"READ"}, - {ICAL_METHOD_RESPONSE,"RESPONSE"}, - {ICAL_METHOD_MOVE,"MOVE"}, - {ICAL_METHOD_MODIFY,"MODIFY"}, - {ICAL_METHOD_GENERATEUID,"GENERATEUID"}, - {ICAL_METHOD_DELETE,"DELETE"}, - {ICAL_METHOD_NONE,"NONE"} -}; - - -char* icalenum_method_to_string(icalproperty_method method) -{ - int i; - - for (i=0; method_map[i].method != ICAL_METHOD_NONE; i++) { - if ( method_map[i].method == method) { - return method_map[i].str; - } - } - - return 0; -} - -icalproperty_method icalenum_string_to_method(char* str) -{ - int i; - - for (i=0; method_map[i].method != ICAL_METHOD_NONE; i++) { - if ( strcmp(method_map[i].str, str) == 0) { - return method_map[i].method; - } - } - - return ICAL_METHOD_NONE; -} diff --git a/libical/src/libical/icalenums.h b/libical/src/libical/icalenums.h deleted file mode 100644 index e60d230854..0000000000 --- a/libical/src/libical/icalenums.h +++ /dev/null @@ -1,459 +0,0 @@ -/* -*- Mode: C -*-*/ -/*====================================================================== - FILE: icalenums.h - - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalenums.h - - Contributions from: - Graham Davison (g.m.davison@computer.org) - -======================================================================*/ - -#ifndef ICALENUMS_H -#define ICALENUMS_H - - - -/*********************************************************************** - * Component enumerations -**********************************************************************/ - -typedef enum icalcomponent_kind { - ICAL_NO_COMPONENT, - ICAL_ANY_COMPONENT, /* Used in get_components to select all components*/ - ICAL_XROOT_COMPONENT, /* Root component returned by parser */ - ICAL_XATTACH_COMPONENT, /* MIME attached data, returned by parser. */ - ICAL_VEVENT_COMPONENT, - ICAL_VTODO_COMPONENT, - ICAL_VJOURNAL_COMPONENT, - ICAL_VCALENDAR_COMPONENT, - ICAL_VFREEBUSY_COMPONENT, - ICAL_VALARM_COMPONENT, - ICAL_XAUDIOALARM_COMPONENT, - ICAL_XDISPLAYALARM_COMPONENT, - ICAL_XEMAILALARM_COMPONENT, - ICAL_XPROCEDUREALARM_COMPONENT, - ICAL_VTIMEZONE_COMPONENT, - ICAL_XSTANDARD_COMPONENT, - ICAL_XDAYLIGHT_COMPONENT, - ICAL_X_COMPONENT, - ICAL_VSCHEDULE_COMPONENT, - ICAL_VQUERY_COMPONENT, - ICAL_VCAR_COMPONENT, - ICAL_VCOMMAND_COMPONENT, - ICAL_XLICINVALID_COMPONENT -} icalcomponent_kind; - -/*********************************************************************** - * Property Enumerations -**********************************************************************/ - -typedef enum icalproperty_kind { - ICAL_ANY_PROPERTY = 0, /* This must be the first enum, for iteration */ - ICAL_CALSCALE_PROPERTY, - ICAL_METHOD_PROPERTY, - ICAL_PRODID_PROPERTY, - ICAL_VERSION_PROPERTY, - ICAL_ATTACH_PROPERTY, - ICAL_CATEGORIES_PROPERTY, - ICAL_CLASS_PROPERTY, - ICAL_COMMENT_PROPERTY, - ICAL_DESCRIPTION_PROPERTY, - ICAL_GEO_PROPERTY, - ICAL_LOCATION_PROPERTY, - ICAL_PERCENTCOMPLETE_PROPERTY, - ICAL_PRIORITY_PROPERTY, - ICAL_RESOURCES_PROPERTY, - ICAL_STATUS_PROPERTY, - ICAL_SUMMARY_PROPERTY, - ICAL_COMPLETED_PROPERTY, - ICAL_DTEND_PROPERTY, - ICAL_DUE_PROPERTY, - ICAL_DTSTART_PROPERTY, - ICAL_DURATION_PROPERTY, - ICAL_FREEBUSY_PROPERTY, - ICAL_TRANSP_PROPERTY, - ICAL_TZID_PROPERTY, - ICAL_TZNAME_PROPERTY, - ICAL_TZOFFSETFROM_PROPERTY, - ICAL_TZOFFSETTO_PROPERTY, - ICAL_TZURL_PROPERTY, - ICAL_ATTENDEE_PROPERTY, - ICAL_CONTACT_PROPERTY, - ICAL_ORGANIZER_PROPERTY, - ICAL_RECURRENCEID_PROPERTY, - ICAL_RELATEDTO_PROPERTY, - ICAL_URL_PROPERTY, - ICAL_UID_PROPERTY, - ICAL_EXDATE_PROPERTY, - ICAL_EXRULE_PROPERTY, - ICAL_RDATE_PROPERTY, - ICAL_RRULE_PROPERTY, - ICAL_ACTION_PROPERTY, - ICAL_REPEAT_PROPERTY, - ICAL_TRIGGER_PROPERTY, - ICAL_CREATED_PROPERTY, - ICAL_DTSTAMP_PROPERTY, - ICAL_LASTMODIFIED_PROPERTY, - ICAL_SEQUENCE_PROPERTY, - ICAL_REQUESTSTATUS_PROPERTY, - ICAL_X_PROPERTY, - - /* CAP Properties */ - ICAL_SCOPE_PROPERTY, - ICAL_MAXRESULTS_PROPERTY, - ICAL_MAXRESULTSSIZE_PROPERTY, - ICAL_QUERY_PROPERTY, - ICAL_QUERYNAME_PROPERTY, - ICAL_TARGET_PROPERTY, - - /* libical private properties */ - ICAL_XLICERROR_PROPERTY, - ICAL_XLICCLUSTERCOUNT_PROPERTY, - - ICAL_NO_PROPERTY /* This must be the last enum, for iteration */ - -} icalproperty_kind; - -/*********************************************************************** - * Enumerations for the values of properties - ***********************************************************************/ - -typedef enum icalproperty_method { - ICAL_METHOD_PUBLISH, - ICAL_METHOD_REQUEST, - ICAL_METHOD_REPLY, - ICAL_METHOD_ADD, - ICAL_METHOD_CANCEL, - ICAL_METHOD_REFRESH, - ICAL_METHOD_COUNTER, - ICAL_METHOD_DECLINECOUNTER, - /* CAP Methods */ - ICAL_METHOD_CREATE, - ICAL_METHOD_READ, - ICAL_METHOD_RESPONSE, - ICAL_METHOD_MOVE, - ICAL_METHOD_MODIFY, - ICAL_METHOD_GENERATEUID, - ICAL_METHOD_DELETE, - ICAL_METHOD_NONE -} icalproperty_method ; - -typedef enum icalproperty_transp { - ICAL_TRANSP_OPAQUE, - ICAL_TRANS_TRANSPARENT -} icalproperty_trans; - -typedef enum icalproperty_calscale { - ICAL_CALSCALE_GREGORIAN -} icalproperty_calscale ; - - -typedef enum icalproperty_class { - ICAL_CLASS_PUBLIC, - ICAL_CLASS_PRIVATE, - ICAL_CLASS_CONFIDENTIAL, - ICAL_CLASS_XNAME -} icalproperty_class; - - -typedef enum icalproperty_status { - ICAL_STATUS_TENTATIVE, - ICAL_STATUS_CONFIRMED, - ICAL_STATUS_CANCELLED, /* CANCELED? SIC */ - ICAL_STATUS_NEEDSACTION, - ICAL_STATUS_COMPLETED, - ICAL_STATUS_INPROCESS, - ICAL_STATUS_DRAFT, - ICAL_STATUS_FINAL -} icalproperty_status; - -typedef enum icalproperty_action { - ICAL_ACTION_AUDIO, - ICAL_ACTION_DISPLAY, - ICAL_ACTION_EMAIL, - ICAL_ACTION_PROCEDURE, - ICAL_ACTION_XNAME -} icalproperty_action; - -/*********************************************************************** - * Value enumerations -**********************************************************************/ - -typedef enum icalvalue_kind { - ICAL_NO_VALUE, - ICAL_ATTACH_VALUE, /* Non-Standard*/ - ICAL_BINARY_VALUE, - ICAL_BOOLEAN_VALUE, - ICAL_CALADDRESS_VALUE, - ICAL_DATE_VALUE, - ICAL_DATETIME_VALUE, - ICAL_DATETIMEDATE_VALUE, /* Non-Standard */ - ICAL_DATETIMEPERIOD_VALUE, /* Non-Standard */ - ICAL_DURATION_VALUE, - ICAL_FLOAT_VALUE, - ICAL_GEO_VALUE, /* Non-Standard */ - ICAL_INTEGER_VALUE, - ICAL_METHOD_VALUE, - ICAL_PERIOD_VALUE, - ICAL_RECUR_VALUE, - ICAL_TEXT_VALUE, - ICAL_TIME_VALUE, - ICAL_TRIGGER_VALUE, /* Non-Standard */ - ICAL_URI_VALUE, - ICAL_UTCOFFSET_VALUE, - ICAL_QUERY_VALUE, - ICAL_XNAME_VALUE -} icalvalue_kind; - - -/*********************************************************************** - * Parameter Enumerations - **********************************************************************/ - - -typedef enum icalparameter_kind { - ICAL_NO_PARAMETER, - ICAL_ANY_PARAMETER, - ICAL_ALTREP_PARAMETER, /* DQUOTE uri DQUOTE */ - ICAL_CN_PARAMETER, /* text */ - ICAL_CUTYPE_PARAMETER, /*INDIVIDUAL, GROUP, RESOURCE,ROOM,UNKNOWN, x-name*/ - ICAL_DELEGATEDFROM_PARAMETER, /* *("," DQUOTE cal-address DQUOTE) */ - ICAL_DELEGATEDTO_PARAMETER, /* *("," DQUOTE cal-address DQUOTE) */ - ICAL_DIR_PARAMETER, /* DQUOTE uri DQUOTE */ - ICAL_ENCODING_PARAMETER, /* *BIT, BASE64, x-name */ - ICAL_FMTTYPE_PARAMETER, /* registered MINE content type */ - ICAL_FBTYPE_PARAMETER, /* FREE, BUSY, BUSY-UNAVAILABLE, BUSY-TENTATIVE,x-name */ - ICAL_LANGUAGE_PARAMETER, /* text from RFC 1766 */ - ICAL_MEMBER_PARAMETER, /* DQUOTE cal-address DQUOTE */ - ICAL_PARTSTAT_PARAMETER, /* NEEDS-ACTION, ACCEPTED, DECLINED, TENTATIVE, DELEGATED, x-name */ - ICAL_RANGE_PARAMETER, /* THISANDPRIOR, THISANDFUTURE */ - ICAL_RELATED_PARAMETER, /* START, END */ - ICAL_RELTYPE_PARAMETER, /* PARENT, CHILD, SIBLING,x-name */ - ICAL_ROLE_PARAMETER, /* CHAIR, REQ_PARTICIPANT, OPT_PARTICIPANT, NON_PARTICIPANT, x-name */ - ICAL_RSVP_PARAMETER, /* TRUE. FALSE */ - ICAL_SENTBY_PARAMETER, /* DQUOTE uri DQUOTE */ - ICAL_TZID_PARAMETER, /* [tzidprefix] paramtext CRLF */ - ICAL_VALUE_PARAMETER, /* BINARY, BOOLEAN, CAL_ADDRESS, DATE, DATE-TIME, DURATION, FLOAT, INTEGER, PERIOD, RECUR, TEXT, TIME, UTC_OFFSET, x-name */ - ICAL_XLICERRORTYPE_PARAMETER, /*ICAL_XLICERROR_PARSE_ERROR,ICAL_XLICERROR_INVALID_ITIP*/ - ICAL_XLICCOMPARETYPE_PARAMETER, /**/ - ICAL_X_PARAMETER /* text */ -} icalparameter_kind; - -typedef enum icalparameter_cutype { - ICAL_CUTYPE_INDIVIDUAL, - ICAL_CUTYPE_GROUP, - ICAL_CUTYPE_RESOURCE, - ICAL_CUTYPE_ROOM, - ICAL_CUTYPE_UNKNOWN, - ICAL_CUTYPE_XNAME -} icalparameter_cutype; - - -typedef enum icalparameter_encoding { - ICAL_ENCODING_8BIT, - ICAL_ENCODING_BASE64, - ICAL_ENCODING_XNAME -} icalparameter_encoding; - -typedef enum icalparameter_fbtype { - ICAL_FBTYPE_FREE, - ICAL_FBTYPE_BUSY, - ICAL_FBTYPE_BUSYUNAVAILABLE, - ICAL_FBTYPE_BUSYTENTATIVE, - ICAL_FBTYPE_XNAME -} icalparameter_fbtype; - -typedef enum icalparameter_partstat { - ICAL_PARTSTAT_NEEDSACTION, - ICAL_PARTSTAT_ACCEPTED, - ICAL_PARTSTAT_DECLINED, - ICAL_PARTSTAT_TENTATIVE, - ICAL_PARTSTAT_DELEGATED, - ICAL_PARTSTAT_COMPLETED, - ICAL_PARTSTAT_INPROCESS, - ICAL_PARTSTAT_XNAME -} icalparameter_partstat; - -typedef enum icalparameter_range { - ICAL_RANGE_THISANDPRIOR, - ICAL_RANGE_THISANDFUTURE -} icalparameter_range; - -typedef enum icalparameter_related { - ICAL_RELATED_START, - ICAL_RELATED_END -} icalparameter_related; - -typedef enum icalparameter_reltype { - ICAL_RELTYPE_PARENT, - ICAL_RELTYPE_CHILD, - ICAL_RELTYPE_SIBLING, - ICAL_RELTYPE_XNAME -} icalparameter_reltype; - -typedef enum icalparameter_role { - ICAL_ROLE_CHAIR, - ICAL_ROLE_REQPARTICIPANT, - ICAL_ROLE_OPTPARTICIPANT, - ICAL_ROLE_NONPARTICIPANT, - ICAL_ROLE_XNAME -} icalparameter_role; - -typedef enum icalparameter_xlicerrortype { - ICAL_XLICERRORTYPE_COMPONENTPARSEERROR, - ICAL_XLICERRORTYPE_PARAMETERPARSEERROR, - ICAL_XLICERRORTYPE_PROPERTYPARSEERROR, - ICAL_XLICERRORTYPE_VALUEPARSEERROR, - ICAL_XLICERRORTYPE_INVALIDITIP -} icalparameter_xlicerrortype; - -typedef enum icalparameter_xliccomparetype { - ICAL_XLICCOMPARETYPE_EQUAL=0, - ICAL_XLICCOMPARETYPE_LESS=-1, - ICAL_XLICCOMPARETYPE_LESSEQUAL=2, - ICAL_XLICCOMPARETYPE_GREATER=1, - ICAL_XLICCOMPARETYPE_GREATEREQUAL=3, - ICAL_XLICCOMPARETYPE_NOTEQUAL=4, - ICAL_XLICCOMPARETYPE_REGEX=5 -} icalparameter_xliccomparetype; - -typedef enum icalparameter_value { - ICAL_VALUE_XNAME = ICAL_XNAME_VALUE, - ICAL_VALUE_BINARY = ICAL_BINARY_VALUE, - ICAL_VALUE_BOOLEAN = ICAL_BOOLEAN_VALUE, - ICAL_VALUE_CALADDRESS = ICAL_CALADDRESS_VALUE, - ICAL_VALUE_DATE = ICAL_DATE_VALUE, - ICAL_VALUE_DATETIME = ICAL_DATETIME_VALUE, - ICAL_VALUE_DURATION = ICAL_DURATION_VALUE, - ICAL_VALUE_FLOAT = ICAL_FLOAT_VALUE, - ICAL_VALUE_INTEGER = ICAL_INTEGER_VALUE, - ICAL_VALUE_PERIOD = ICAL_PERIOD_VALUE, - ICAL_VALUE_RECUR = ICAL_RECUR_VALUE, - ICAL_VALUE_TEXT = ICAL_TEXT_VALUE, - ICAL_VALUE_TIME = ICAL_TIME_VALUE, - ICAL_VALUE_UTCOFFSET = ICAL_UTCOFFSET_VALUE, - ICAL_VALUE_URI = ICAL_URI_VALUE, - ICAL_VALUE_ERROR = ICAL_NO_VALUE -} icalparameter_value; - -/*********************************************************************** - * Recurrances -**********************************************************************/ - - -typedef enum icalrecurrencetype_frequency -{ - ICAL_NO_RECURRENCE, - ICAL_SECONDLY_RECURRENCE, - ICAL_MINUTELY_RECURRENCE, - ICAL_HOURLY_RECURRENCE, - ICAL_DAILY_RECURRENCE, - ICAL_WEEKLY_RECURRENCE, - ICAL_MONTHLY_RECURRENCE, - ICAL_YEARLY_RECURRENCE -} icalrecurrencetype_frequency; - -typedef enum icalrecurrencetype_weekday -{ - ICAL_NO_WEEKDAY, - ICAL_SUNDAY_WEEKDAY, - ICAL_MONDAY_WEEKDAY, - ICAL_TUESDAY_WEEKDAY, - ICAL_WEDNESDAY_WEEKDAY, - ICAL_THURSDAY_WEEKDAY, - ICAL_FRIDAY_WEEKDAY, - ICAL_SATURDAY_WEEKDAY -} icalrecurrencetype_weekday; - -enum { - ICAL_RECURRENCE_ARRAY_MAX = 0x7f7f, - ICAL_RECURRENCE_ARRAY_MAX_BYTE = 0x7f -}; - - -char* icalenum_recurrence_to_string(icalrecurrencetype_frequency kind); -char* icalenum_weekday_to_string(icalrecurrencetype_weekday kind); - -/*********************************************************************** - * Request Status codes - **********************************************************************/ - -typedef enum icalrequeststatus { - ICAL_2_0_SUCCESS_STATUS, - ICAL_2_1_FALLBACK_STATUS, - ICAL_2_2_IGPROP_STATUS, - ICAL_2_3_IGPARAM_STATUS, - ICAL_2_4_IGXPROP_STATUS, - ICAL_2_5_IGXPARAM_STATUS, - ICAL_2_6_IGCOMP_STATUS, - ICAL_2_7_FORWARD_STATUS, - ICAL_2_8_ONEEVENT_STATUS, - ICAL_2_9_TRUNC_STATUS, - ICAL_2_10_ONETODO_STATUS, - ICAL_2_11_TRUNCRRULE_STATUS, - ICAL_3_0_INVPROPNAME_STATUS, - ICAL_3_1_INVPROPVAL_STATUS, - ICAL_3_2_INVPARAM_STATUS, - ICAL_3_3_INVPARAMVAL_STATUS, - ICAL_3_4_INVCOMP_STATUS, - ICAL_3_5_INVTIME_STATUS, - ICAL_3_6_INVRULE_STATUS, - ICAL_3_7_INVCU_STATUS, - ICAL_3_8_NOAUTH_STATUS, - ICAL_3_9_BADVERSION_STATUS, - ICAL_3_10_TOOBIG_STATUS, - ICAL_3_11_MISSREQCOMP_STATUS, - ICAL_3_12_UNKCOMP_STATUS, - ICAL_3_13_BADCOMP_STATUS, - ICAL_3_14_NOCAP_STATUS, - ICAL_4_0_BUSY_STATUS, - ICAL_5_0_MAYBE_STATUS, - ICAL_5_1_UNAVAIL_STATUS, - ICAL_5_2_NOSERVICE_STATUS, - ICAL_5_3_NOSCHED_STATUS -} icalrequeststatus; - - - -/*********************************************************************** - * Conversion functions -**********************************************************************/ - -char* icalenum_property_kind_to_string(icalproperty_kind kind); -icalproperty_kind icalenum_string_to_property_kind(char* string); - -char* icalenum_value_kind_to_string(icalvalue_kind kind); -icalvalue_kind icalenum_value_kind_by_prop(icalproperty_kind kind); - -char* icalenum_parameter_kind_to_string(icalparameter_kind kind); -icalparameter_kind icalenum_string_to_parameter_kind(char* string); - -char* icalenum_component_kind_to_string(icalcomponent_kind kind); -icalcomponent_kind icalenum_string_to_component_kind(char* string); - -icalvalue_kind icalenum_property_kind_to_value_kind(icalproperty_kind kind); - -char* icalenum_method_to_string(icalproperty_method); -icalproperty_method icalenum_string_to_method(char* string); - -#endif /* !ICALENUMS_H */ - - - diff --git a/libical/src/libical/icalerror.c b/libical/src/libical/icalerror.c deleted file mode 100644 index d84c288d3a..0000000000 --- a/libical/src/libical/icalerror.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalerror.c - CREATOR: eric 16 May 1999 - - $Id$ - $Locker$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalerror.c - - ======================================================================*/ - -#include "icalerror.h" - -icalerrorenum icalerrno; - -int foo; -void icalerror_stop_here(void) -{ - foo++; /* Keep optimizers from removing routine */ -} - -void icalerror_clear_errno() { - - icalerrno = ICAL_NO_ERROR; -} - -void icalerror_set_errno(icalerrorenum e) { - - icalerror_stop_here(); - icalerrno = e; -} - - -struct icalerror_string_map { - icalerrorenum error; - char name[160]; -}; - -static struct icalerror_string_map string_map[] = -{ - {ICAL_BADARG_ERROR,"Bad argumnet to function"}, - {ICAL_NEWFAILED_ERROR,"Failed to create a new object via a *_new() routine"}, - {ICAL_MALFORMEDDATA_ERROR,"An input string was not correctly formed"}, - {ICAL_PARSE_ERROR,"Failed to parse a part of an iCal componet"}, - {ICAL_INTERNAL_ERROR,"Random internal error. This indicates an error in the library code, not an error in use"}, - {ICAL_FILE_ERROR,"An operation on a file failed. Check errno for more detail."}, - {ICAL_ALLOCATION_ERROR,"Failed to allocate memory"}, - {ICAL_USAGE_ERROR,"The caller failed to properly sequence called to an object's interface"}, - {ICAL_NO_ERROR,"No error"}, - {ICAL_UNKNOWN_ERROR,"Unknown error type -- icalerror_strerror() was probably given bad input"} -}; - - -char* icalerror_strerror(icalerrorenum e) { - - int i; - - for (i=0; string_map[i].error != ICAL_UNKNOWN_ERROR; i++) { - if (string_map[i].error == e) { - return string_map[i].name; - } - } - - return string_map[i].name; /* Return string for ICAL_UNKNOWN_ERROR*/ - -} - - - diff --git a/libical/src/libical/icalerror.h b/libical/src/libical/icalerror.h deleted file mode 100644 index 429d680022..0000000000 --- a/libical/src/libical/icalerror.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalerror.h - CREATOR: eric 09 May 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalerror.h - -======================================================================*/ - - -#ifndef ICALERROR_H -#define ICALERROR_H - -#include -#include /* For icalerror_warn() */ - -/* This routine is called before any error is triggered. It is called - by icalerror_set_errno, so it does not appear in all of the macros - below */ -void icalerror_stop_here(void); - -#ifdef ICAL_ERRORS_ARE_FATAL -#undef NDEBUG -#endif - -#define icalerror_check_value_type(value,type); -#define icalerror_check_property_type(value,type); -#define icalerror_check_parameter_type(value,type); -#define icalerror_check_component_type(value,type); - -/* Assert with a message */ -#ifdef ICAL_ERRORS_ARE_FATAL - -#ifdef __GNUC__ -#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);icalerror_stop_here(); abort();} -#else /*__GNUC__*/ -#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);icalerror_stop_here(); abort();} -#endif /*__GNUC__*/ -#else -#define icalerror_assert(test,message) -#endif - - -/* Check & abort if check fails */ -#ifdef ICAL_ERRORS_ARE_FATAL -#define icalerror_check_arg(test,arg) icalerror_stop_here();assert(test) -#else -#define icalerror_check_arg(test,arg) -#endif -/* Check & return void if check failes*/ - -#ifdef ICAL_ERRORS_ARE_FATAL -#define icalerror_check_arg_rv(test,arg) icalerror_stop_here();assert(test); -#else -#define icalerror_check_arg_rv(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return; } -#endif - -/* Check & return 0 if check failes*/ -#ifdef ICAL_ERRORS_ARE_FATAL -#define icalerror_check_arg_rz(test,arg) icalerror_stop_here();assert(test); -#else -#define icalerror_check_arg_rz(test,arg) if(!(test)) {icalerror_set_errno(ICAL_BADARG_ERROR); return 0;} -#endif - - -/* Check & return an error if check failes*/ -#ifdef ICAL_ERRORS_ARE_FATAL -#define icalerror_check_arg_re(test,arg,error) icalerror_stop_here();assert(test); -#else -#define icalerror_check_arg_re(test,arg,error) if(!(test)) {icalerror_stop_here(); return error;} -#endif - - -/* Warning messages */ - -#ifdef ICAL_ERRORS_ARE_FATAL - -#ifdef __GNUC__ -#define icalerror_warn(message) {fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message); abort();} -#else /* __GNU_C__ */ -#define icalerror_warn(message) {fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message); abort();} -#endif /* __GNU_C__ */ - -#else /*ICAL_ERRORS_ARE_FATAL */ - -#ifdef __GNUC__ -#define icalerror_warn(message) {fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);} -#else /* __GNU_C__ */ -#define icalerror_warn(message) {fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);} -#endif /* __GNU_C__ */ - -#endif /*ICAL_ERRORS_ARE_FATAL*/ - -typedef enum icalerrorenum { - - ICAL_BADARG_ERROR, - ICAL_NEWFAILED_ERROR, - ICAL_MALFORMEDDATA_ERROR, - ICAL_PARSE_ERROR, - ICAL_INTERNAL_ERROR, /* Like assert --internal consist. prob */ - ICAL_FILE_ERROR, - ICAL_ALLOCATION_ERROR, - ICAL_USAGE_ERROR, - ICAL_NO_ERROR, - ICAL_MULTIPLEINCLUSION_ERROR, - ICAL_UNKNOWN_ERROR /* Used for problems in input to icalerror_strerror()*/ - -} icalerrorenum; - -extern icalerrorenum icalerrno; - - -void icalerror_clear_errno(); -void icalerror_set_errno(icalerrorenum); - -char* icalerror_strerror(icalerrorenum e); - - -#endif /* !ICALERROR_H */ - - - diff --git a/libical/src/libical/icalirip.h b/libical/src/libical/icalirip.h deleted file mode 100644 index eefbca35c5..0000000000 --- a/libical/src/libical/icalirip.h +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalirip.h - CREATOR: eric 20 April 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalirip.h - -======================================================================*/ - - -#ifndef ICALIRIP_H -#define ICALIRIP_H - -#include "ical.h" - -typedef void* icalirip; - -/********************** Server (Reciever) Interfaces *************************/ - -icalirip* icalirip_new(); -void* icalirip_free(); - -/* Protocol functions */ -char* icalirip_process_request(icalirip* irip, char* string); - -/* iRIP server stubs */ -typedef struct icalirip_response { - char code[6]; - char caluid[1024]; - void* result; -} icalirip_response; - -icalirip_response icalirip_timedout_stub(icalirip* irip); -icalirip_response icalirip_authenticate_stub(icalirip* irip, char* mechanism, char* data); -icalirip_response icalirip_sendata_stub(icalirip* irip, unsigned int time); -icalirip_response icalirip_dequeue_stub(icalirip* irip, char* caluid,unsigned int time); -icalirip_response icalirip_recipient_stub(icalirip* irip, char* address, unsigned int time); -icalirip_response icalirip_switch_stub(icalirip* irip); -icalirip_response icalirip_disconnect_stub(icalirip* irip); -icalirip_response icalirip_unknown_stub(icalirip* irip, char* command); - -/* icalirip_set_stubs makes the module use function pointers to -instead of the above stubs. The set_stubs procedure will requires the -user to link another library with defined the above stubs and -re-directs the call to the appropriate pointer to function. */ - -typedef struct icalirip_stubs { - - void(*authenticate_stub)(icalirip* irip, char* mechanism, char* data); - void (*sendata_stub)(icalirip* irip, unsigned int time); - void (*dequeue_stub)(icalirip* irip, char* caluid, unsigned int time); - void (*recipient_stub)(icalirip* irip, char* address, unsigned int time); - void (*switch_stub)(icalirip* irip); - void (*disconnect_stub)(); - void (*unknown_stub)(icalirip* irip, char* command, char** data); - -} icalirip_stubs; - -void icalirip_set_stubs(icalirip* irip, icalirip_stubs* stubs); - -/********************** Client (Sender) Interfaces **************************/ - -/* Client API */ -icalirip_response icalirip_abort(icalirip* irip); -icalirip_response icalirip_authenticate(icalirip* irip, char* mechanism, char* data); -icalirip_response icalirip_capability(icalirip* irip); -icalirip_response icalirip_continue(icalirip* irip, unsigned int time); -icalirip_response icalirip_sendata(icalirip* irip, icalcomponent* comp, unsigned int time); -icalirip_response icalirip_recipient(icalirip* irip, char* address, unsigned int time); -icalirip_response icalirip_dequeue(icalirip* irip, char* address, unsigned int time); -icalirip_response icalirip_switch(icalirip* irip); -icalirip_response icalirip_disconnect(); -icalirip_response icalirip_unknown(icalirip* irip, char* command); - -/* client stubs */ -void icalirip_send_request(icalirip* irip,char* request); -char* icalirip_get_response(icalirip* irip); - -/********************** Configuration Interfaces **************************/ - -/* Configure capabilities */ -void icalirip_add_auth_mechanism(icalirip* irip, char* auth); -void icalirip_set_max_object_size(icalirip* irip, unsigned int size); -void icalirip_set_max_date(icalirip* irip, time_t time); -void icalirip_set_min_date(icalirip* irip, time_t time); - - -#endif /* !ICALIRIP_H */ - - - diff --git a/libical/src/libical/icalitip.l b/libical/src/libical/icalitip.l deleted file mode 100644 index 338c5c421f..0000000000 --- a/libical/src/libical/icalitip.l +++ /dev/null @@ -1,283 +0,0 @@ -%{ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalitip.y - CREATOR: eric 10 June 1999 - - DESCRIPTION: - - $Id: icalitip.l,v 1.2 2000/02/23 17:55:49 alves Exp $ - $Locker: $ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalitip.y - - - - ======================================================================*/ -#include "icalitip.tab.h" -#include "icalparser.h" -#include "icalenums.h" -#include "icalmemory.h" -#include "assert.h" - -#include /* For strdup() */ - -#define ICAL_MAX_STR_CONST 1024 - -#undef YY_INPUT -#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms)) -#undef yywrap - -#undef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) icalparser_yyerror(msg) - -icalvalue_kind value_kind=ICAL_NO_VALUE; -void set_parser_value_state(); -extern enum icalparser_state_enum icalparser_state; -extern int yydebug; - -void icalparser_yyerror(char *s); - -void init_str_buf(); - -int last_state; - -char *str_buf; -char *str_buf_p; -size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/ - - -%} - -crlf \x0D\x0A -nl \n -lbreak \x0D\x0A\x20 -ulbreak \x0A\x20 -space [ ] -qsafechar [^\x00-\x1F\"] -safechar [^\x00-\x1F\"\:\;\,] -tsafechar [\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E] -valuechar [^\x00-\x08\x10-\x1F] -xname X-[a-zA-Z0-9\-]+ -xname2 [a-zA-Z0-9\-\ ] -paramtext {safechar}+ -value {valuechar}+ -quotedstring \"{qsafechar}+\" -digit [0-9] - -%array /* Make yytext an array. Slow, but handy. HACK */ - -%option caseless - - -%s quoted_string -%s binary_value boolean_value uri_value time_value duration_value number_value period_value recur_value text_value utcoffset_value -%s enum_param_value string_param_value stringlist_param_value keyword line_start component seperator parameter end_of_value paramtext - - - -%% - -%{ -%} - - -{ -.* { icalparser_yylval.v_string= icalmemory_tmp_copy(yytext); - return STRING;} -{crlf}|\n { return EOL;} - -} - -{ -. { return CHARACTER; } -{crlf}|\n { return EOL;} - -} - -{ -.* { icalparser_yylval.v_string= icalmemory_tmp_copy(yytext); - return STRING;} -{crlf}|\n { return EOL;} - -} - - -{ -{digit}* { icalparser_yylval.v_string= icalmemory_tmp_copy(yytext); - return DIGITS; } -T { return TIME_CHAR; } -Z { return UTC_CHAR; } -{crlf}|\n { return EOL;} -} - -{ -{digit}+ { icalparser_yylval.v_string =icalmemory_tmp_copy(yytext); - return DIGITS; } -T { return TIME_CHAR; } -[\+\-PTWHMSD] { return yytext[0]; } -{crlf}|\n { return EOL;} - -} - -{ -[\+\-\.0-9]+ { icalparser_yylval.v_int=atoi(yytext); return INTNUMBER; } -{crlf}|\n { return EOL;} -} - -{ -{digit}+ { icalparser_yylval.v_string =icalmemory_tmp_copy(yytext) ; - return DIGITS; } -T { return TIME_CHAR; } -Z { return UTC_CHAR; } -[\/\+\-PWHMSD] { return yytext[0]; } -{crlf}|\n { return EOL;} - -} - -{ -INTERVAL { return INTERVAL; } -COUNT { return COUNT; } -UNTIL { return UNTIL; } -FREQ { return FREQ; } -BYDAY { return BYDAY; } -BYHOUR { return BYHOUR; } -BYMINUTE { return BYMINUTE; } -BYMONTH { return BYMONTH; } -BYMONTHDAY { return BYMONTHDAY; } -BYSECOND { return BYSECOND; } -BYSETPOS { return BYSETPOS; } -BYWEEKNO { return BYWEEKNO; } -BYYEARDAY { return BYYEARDAY; } -DAILY { return DAILY; } -SECONDLY { return SECONDLY; } -MINUTELY { return MINUTELY; } -HOURLY { return HOURLY; } -MONTHLY { return MONTHLY; } -WEEKLY { return WEEKLY; } -YEARLY { return YEARLY; } -WKST { return WKST; } -MO { return MO; } -SA { return SA; } -SU { return SU; } -TU { return TU; } -WE { return WE; } -TH { return TH; } -FR { return FR; } -= { return EQUALS; } -, { return COMMA; } -; { return SEMICOLON; } -[\-\+0-9]+ { icalparser_yylval.v_string= icalmemory_tmp_copy(yytext); - return DIGITS; } -T { return TIME_CHAR; } -Z { return UTC_CHAR; } -{crlf}|\n { return EOL;} -} - -{ -{crlf}|\n { return EOL;} -\-|\+ { return yytext[0]; } -{digit}{digit} { icalparser_yylval.v_int=atoi(yytext); return INTNUMBER; } - -} - -{ -. { return CHARACTER; } -{crlf}|\n { return EOL;} - -} - -{ -, { BEGIN(last_state); return COMMA; } -} - - -%% - -int yywrap() -{ - return 1; -} - - -void set_parser_value_state(icalvalue_kind kind) -{ - - switch (kind){ - - case ICAL_ATTACH_VALUE: - case ICAL_BINARY_VALUE: - {BEGIN(binary_value);break;} - - case ICAL_BOOLEAN_VALUE: - case ICAL_INTEGER_VALUE: - case ICAL_FLOAT_VALUE: - {BEGIN(number_value);break;} - - case ICAL_UTCOFFSET_VALUE: - {BEGIN(utcoffset_value);break;} - - case ICAL_TEXT_VALUE: - {BEGIN(text_value); - init_str_buf(); - break;} - - case ICAL_CALADDRESS_VALUE: - case ICAL_URI_VALUE: - {BEGIN(uri_value);break;} - - case ICAL_DATE_VALUE: - case ICAL_DATETIME_VALUE: - case ICAL_DATETIMEDATE_VALUE: - case ICAL_DATETIMEPERIOD_VALUE: - case ICAL_TIME_VALUE: - {BEGIN(time_value);break;} - - case ICAL_DURATION_VALUE: - {BEGIN(duration_value);break;} - - case ICAL_PERIOD_VALUE: - {BEGIN(period_value);break;} - - case ICAL_GEO_VALUE: - case ICAL_QUERY_VALUE: - {BEGIN(text_value);break;} - - case ICAL_RECUR_VALUE: - {BEGIN(recur_value);break;} - - case ICAL_NO_VALUE: - { - /* The value is probably actually a component name */ - {BEGIN(component); break;} - } - default: - { - assert(1==0); - } - } -} - -void init_str_buf() -{ - str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST); - str_buf_p = str_buf; - buf_sz = ICAL_MAX_STR_CONST; - - -} - diff --git a/libical/src/libical/icalitip.output b/libical/src/libical/icalitip.output deleted file mode 100644 index 1218f89c74..0000000000 --- a/libical/src/libical/icalitip.output +++ /dev/null @@ -1,1698 +0,0 @@ - - -Terminals which are not used: - - FLOATNUMBER - STRING - EOL - CHARACTER - COLON - TIMESEPERATOR - BIT8 - ACCEPTED - ADD - AUDIO - BASE64 - BINARY - BOOLEAN - BUSY - BUSYTENTATIVE - BUSYUNAVAILABLE - CALADDRESS - CANCEL - CANCELLED - CHAIR - CHILD - COMPLETED - CONFIDENTIAL - CONFIRMED - COUNTER - DATE - DATETIME - DECLINECOUNTER - DECLINED - DELEGATED - DISPLAY - DRAFT - DURATION - EMAIL - END - FINAL - FLOAT - FREE - GREGORIAN - GROUP - INDIVIDUAL - INPROCESS - INTEGER - NEEDSACTION - NONPARTICIPANT - OPAQUE - OPTPARTICIPANT - PARENT - PERIOD - PRIVATE - PROCEDURE - PUBLIC - PUBLISH - RECUR - REFRESH - REPLY - REQPARTICIPANT - REQUEST - RESOURCE - ROOM - SIBLING - START - TENTATIVE - TEXT - THISANDFUTURE - THISANDPRIOR - TIME - TRANSPAENT - UNKNOWN - UTCOFFSET - XNAME - ALTREP - CN - CUTYPE - DAYLIGHT - DIR - ENCODING - EVENT - FBTYPE - FMTTYPE - LANGUAGE - MEMBER - PARTSTAT - RANGE - RELATED - RELTYPE - ROLE - RSVP - SENTBY - STANDARD - URI - - - -Grammar -rule 1 value -> binary_value -rule 2 value -> boolean_value -rule 3 value -> date_value -rule 4 value -> datetime_value -rule 5 value -> duration_value -rule 6 value -> period_value -rule 7 value -> recur_value -rule 8 value -> utcoffset_value -rule 9 value -> error -rule 10 binary_value -> "unimplemented2" -rule 11 boolean_value -> TRUE -rule 12 boolean_value -> FALSE -rule 13 date_value -> DIGITS -rule 14 utc_char -> /* empty */ -rule 15 utc_char -> UTC_CHAR -rule 16 utc_char_b -> /* empty */ -rule 17 utc_char_b -> UTC_CHAR -rule 18 datetime_value -> DIGITS TIME_CHAR DIGITS utc_char -rule 19 dur_date -> dur_day -rule 20 dur_date -> dur_day dur_time -rule 21 dur_week -> DIGITS 'W' -rule 22 dur_time -> TIME_CHAR dur_hour -rule 23 dur_time -> TIME_CHAR dur_minute -rule 24 dur_time -> TIME_CHAR dur_second -rule 25 dur_hour -> DIGITS 'H' -rule 26 dur_hour -> DIGITS 'H' dur_minute -rule 27 dur_minute -> DIGITS 'M' -rule 28 dur_minute -> DIGITS 'M' dur_second -rule 29 dur_second -> DIGITS 'S' -rule 30 dur_day -> DIGITS 'D' -rule 31 dur_prefix -> /* empty */ -rule 32 dur_prefix -> '+' -rule 33 dur_prefix -> '-' -rule 34 duration_value -> dur_prefix 'P' dur_date -rule 35 duration_value -> dur_prefix 'P' dur_time -rule 36 duration_value -> dur_prefix 'P' dur_week -rule 37 period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b -rule 38 period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' duration_value -rule 39 recur_start -> FREQ EQUALS SECONDLY -rule 40 recur_start -> FREQ EQUALS MINUTELY -rule 41 recur_start -> FREQ EQUALS HOURLY -rule 42 recur_start -> FREQ EQUALS DAILY -rule 43 recur_start -> FREQ EQUALS WEEKLY -rule 44 recur_start -> FREQ EQUALS MONTHLY -rule 45 recur_start -> FREQ EQUALS YEARLY -rule 46 weekday -> SU -rule 47 weekday -> MO -rule 48 weekday -> TU -rule 49 weekday -> WE -rule 50 weekday -> TH -rule 51 weekday -> FR -rule 52 weekday -> SA -rule 53 weekday_list -> weekday -rule 54 weekday_list -> DIGITS weekday -rule 55 weekday_list -> weekday_list COMMA weekday -rule 56 recur_list -> DIGITS -rule 57 recur_list -> recur_list COMMA DIGITS -rule 58 recur_skip -> INTERVAL EQUALS DIGITS -rule 59 recur_skip -> WKST EQUALS SU -rule 60 recur_skip -> WKST EQUALS MO -rule 61 recur_skip -> WKST EQUALS TU -rule 62 recur_skip -> WKST EQUALS WE -rule 63 recur_skip -> WKST EQUALS TH -rule 64 recur_skip -> WKST EQUALS FR -rule 65 recur_skip -> WKST EQUALS SA -rule 66 recur_skip -> BYSECOND EQUALS recur_list -rule 67 recur_skip -> BYMINUTE EQUALS recur_list -rule 68 recur_skip -> BYHOUR EQUALS recur_list -rule 69 recur_skip -> BYDAY EQUALS weekday_list -rule 70 recur_skip -> BYMONTH EQUALS recur_list -rule 71 recur_skip -> BYMONTHDAY EQUALS recur_list -rule 72 recur_skip -> BYYEARDAY EQUALS recur_list -rule 73 recur_skip -> BYWEEKNO EQUALS recur_list -rule 74 recur_skip -> BYSETPOS EQUALS recur_list -rule 75 recur_skip -> UNTIL EQUALS datetime_value -rule 76 recur_skip -> UNTIL EQUALS date_value -rule 77 recur_skip -> COUNT EQUALS DIGITS -rule 78 recur_skip_list -> /* empty */ -rule 79 recur_skip_list -> recur_skip_list SEMICOLON recur_skip -rule 80 recur_value -> recur_start recur_skip_list -rule 81 plusminus -> '+' -rule 82 plusminus -> '-' -rule 83 utcoffset_value -> plusminus INTNUMBER INTNUMBER -rule 84 utcoffset_value -> plusminus INTNUMBER INTNUMBER INTNUMBER - -Terminals, with rules where they appear - -$ (-1) -'+' (43) 32 81 -'-' (45) 33 82 -'/' (47) 37 38 -'D' (68) 30 -'H' (72) 25 26 -'M' (77) 27 28 -'P' (80) 34 35 36 -'S' (83) 29 -'W' (87) 21 -error (256) 9 -DIGITS (257) 13 18 21 25 26 27 28 29 30 37 38 54 56 57 58 77 -INTNUMBER (258) 83 84 -FLOATNUMBER (259) -STRING (260) -EOL (261) -EQUALS (262) 39 40 41 42 43 44 45 58 59 60 61 62 63 64 65 66 67 68 - 69 70 71 72 73 74 75 76 77 -CHARACTER (263) -COLON (264) -COMMA (265) 55 57 -SEMICOLON (266) 79 -TIMESEPERATOR (267) -TRUE (268) 11 -FALSE (269) 12 -FREQ (270) 39 40 41 42 43 44 45 -BYDAY (271) 69 -BYHOUR (272) 68 -BYMINUTE (273) 67 -BYMONTH (274) 70 -BYMONTHDAY (275) 71 -BYSECOND (276) 66 -BYSETPOS (277) 74 -BYWEEKNO (278) 73 -BYYEARDAY (279) 72 -DAILY (280) 42 -MINUTELY (281) 40 -MONTHLY (282) 44 -SECONDLY (283) 39 -WEEKLY (284) 43 -HOURLY (285) 41 -YEARLY (286) 45 -INTERVAL (287) 58 -COUNT (288) 77 -UNTIL (289) 75 76 -WKST (290) 59 60 61 62 63 64 65 -MO (291) 47 60 -SA (292) 52 65 -SU (293) 46 59 -TU (294) 48 61 -WE (295) 49 62 -TH (296) 50 63 -FR (297) 51 64 -BIT8 (298) -ACCEPTED (299) -ADD (300) -AUDIO (301) -BASE64 (302) -BINARY (303) -BOOLEAN (304) -BUSY (305) -BUSYTENTATIVE (306) -BUSYUNAVAILABLE (307) -CALADDRESS (308) -CANCEL (309) -CANCELLED (310) -CHAIR (311) -CHILD (312) -COMPLETED (313) -CONFIDENTIAL (314) -CONFIRMED (315) -COUNTER (316) -DATE (317) -DATETIME (318) -DECLINECOUNTER (319) -DECLINED (320) -DELEGATED (321) -DISPLAY (322) -DRAFT (323) -DURATION (324) -EMAIL (325) -END (326) -FINAL (327) -FLOAT (328) -FREE (329) -GREGORIAN (330) -GROUP (331) -INDIVIDUAL (332) -INPROCESS (333) -INTEGER (334) -NEEDSACTION (335) -NONPARTICIPANT (336) -OPAQUE (337) -OPTPARTICIPANT (338) -PARENT (339) -PERIOD (340) -PRIVATE (341) -PROCEDURE (342) -PUBLIC (343) -PUBLISH (344) -RECUR (345) -REFRESH (346) -REPLY (347) -REQPARTICIPANT (348) -REQUEST (349) -RESOURCE (350) -ROOM (351) -SIBLING (352) -START (353) -TENTATIVE (354) -TEXT (355) -THISANDFUTURE (356) -THISANDPRIOR (357) -TIME (358) -TRANSPAENT (359) -UNKNOWN (360) -UTCOFFSET (361) -XNAME (362) -ALTREP (363) -CN (364) -CUTYPE (365) -DAYLIGHT (366) -DIR (367) -ENCODING (368) -EVENT (369) -FBTYPE (370) -FMTTYPE (371) -LANGUAGE (372) -MEMBER (373) -PARTSTAT (374) -RANGE (375) -RELATED (376) -RELTYPE (377) -ROLE (378) -RSVP (379) -SENTBY (380) -STANDARD (381) -URI (382) -TIME_CHAR (383) 18 22 23 24 37 38 -UTC_CHAR (384) 15 17 -"unimplemented2" (385) 10 - -Nonterminals, with rules where they appear - -value (141) - on left: 1 2 3 4 5 6 7 8 9 -binary_value (142) - on left: 10, on right: 1 -boolean_value (143) - on left: 11 12, on right: 2 -date_value (144) - on left: 13, on right: 3 76 -utc_char (145) - on left: 14 15, on right: 18 37 38 -utc_char_b (146) - on left: 16 17, on right: 37 -datetime_value (147) - on left: 18, on right: 4 75 -dur_date (148) - on left: 19 20, on right: 34 -dur_week (149) - on left: 21, on right: 36 -dur_time (150) - on left: 22 23 24, on right: 20 35 -dur_hour (151) - on left: 25 26, on right: 22 -dur_minute (152) - on left: 27 28, on right: 23 26 -dur_second (153) - on left: 29, on right: 24 28 -dur_day (154) - on left: 30, on right: 19 20 -dur_prefix (155) - on left: 31 32 33, on right: 34 35 36 -duration_value (156) - on left: 34 35 36, on right: 5 38 -period_value (157) - on left: 37 38, on right: 6 -recur_start (158) - on left: 39 40 41 42 43 44 45, on right: 80 -weekday (159) - on left: 46 47 48 49 50 51 52, on right: 53 54 55 -weekday_list (160) - on left: 53 54 55, on right: 55 69 -recur_list (161) - on left: 56 57, on right: 57 66 67 68 70 71 72 73 74 -recur_skip (162) - on left: 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 - 76 77, on right: 79 -recur_skip_list (163) - on left: 78 79, on right: 79 80 -recur_value (164) - on left: 80, on right: 7 -plusminus (165) - on left: 81 82, on right: 83 84 -utcoffset_value (166) - on left: 83 84, on right: 8 - - -state 0 - - error shift, and go to state 1 - DIGITS shift, and go to state 2 - TRUE shift, and go to state 3 - FALSE shift, and go to state 4 - FREQ shift, and go to state 5 - "unimplemented2" shift, and go to state 6 - '+' shift, and go to state 7 - '-' shift, and go to state 8 - - 'P' reduce using rule 31 (dur_prefix) - - value go to state 133 - binary_value go to state 9 - boolean_value go to state 10 - date_value go to state 11 - datetime_value go to state 12 - dur_prefix go to state 13 - duration_value go to state 14 - period_value go to state 15 - recur_start go to state 16 - recur_value go to state 17 - plusminus go to state 18 - utcoffset_value go to state 19 - - - -state 1 - - value -> error . (rule 9) - - $default reduce using rule 9 (value) - - - -state 2 - - date_value -> DIGITS . (rule 13) - datetime_value -> DIGITS . TIME_CHAR DIGITS utc_char (rule 18) - period_value -> DIGITS . TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b (rule 37) - period_value -> DIGITS . TIME_CHAR DIGITS utc_char '/' duration_value (rule 38) - - TIME_CHAR shift, and go to state 20 - - $default reduce using rule 13 (date_value) - - - -state 3 - - boolean_value -> TRUE . (rule 11) - - $default reduce using rule 11 (boolean_value) - - - -state 4 - - boolean_value -> FALSE . (rule 12) - - $default reduce using rule 12 (boolean_value) - - - -state 5 - - recur_start -> FREQ . EQUALS SECONDLY (rule 39) - recur_start -> FREQ . EQUALS MINUTELY (rule 40) - recur_start -> FREQ . EQUALS HOURLY (rule 41) - recur_start -> FREQ . EQUALS DAILY (rule 42) - recur_start -> FREQ . EQUALS WEEKLY (rule 43) - recur_start -> FREQ . EQUALS MONTHLY (rule 44) - recur_start -> FREQ . EQUALS YEARLY (rule 45) - - EQUALS shift, and go to state 21 - - - -state 6 - - binary_value -> "unimplemented2" . (rule 10) - - $default reduce using rule 10 (binary_value) - - - -state 7 - - dur_prefix -> '+' . (rule 32) - plusminus -> '+' . (rule 81) - - INTNUMBER reduce using rule 81 (plusminus) - $default reduce using rule 32 (dur_prefix) - - - -state 8 - - dur_prefix -> '-' . (rule 33) - plusminus -> '-' . (rule 82) - - INTNUMBER reduce using rule 82 (plusminus) - $default reduce using rule 33 (dur_prefix) - - - -state 9 - - value -> binary_value . (rule 1) - - $default reduce using rule 1 (value) - - - -state 10 - - value -> boolean_value . (rule 2) - - $default reduce using rule 2 (value) - - - -state 11 - - value -> date_value . (rule 3) - - $default reduce using rule 3 (value) - - - -state 12 - - value -> datetime_value . (rule 4) - - $default reduce using rule 4 (value) - - - -state 13 - - duration_value -> dur_prefix . 'P' dur_date (rule 34) - duration_value -> dur_prefix . 'P' dur_time (rule 35) - duration_value -> dur_prefix . 'P' dur_week (rule 36) - - 'P' shift, and go to state 22 - - - -state 14 - - value -> duration_value . (rule 5) - - $default reduce using rule 5 (value) - - - -state 15 - - value -> period_value . (rule 6) - - $default reduce using rule 6 (value) - - - -state 16 - - recur_value -> recur_start . recur_skip_list (rule 80) - - $default reduce using rule 78 (recur_skip_list) - - recur_skip_list go to state 23 - - - -state 17 - - value -> recur_value . (rule 7) - - $default reduce using rule 7 (value) - - - -state 18 - - utcoffset_value -> plusminus . INTNUMBER INTNUMBER (rule 83) - utcoffset_value -> plusminus . INTNUMBER INTNUMBER INTNUMBER (rule 84) - - INTNUMBER shift, and go to state 24 - - - -state 19 - - value -> utcoffset_value . (rule 8) - - $default reduce using rule 8 (value) - - - -state 20 - - datetime_value -> DIGITS TIME_CHAR . DIGITS utc_char (rule 18) - period_value -> DIGITS TIME_CHAR . DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b (rule 37) - period_value -> DIGITS TIME_CHAR . DIGITS utc_char '/' duration_value (rule 38) - - DIGITS shift, and go to state 25 - - - -state 21 - - recur_start -> FREQ EQUALS . SECONDLY (rule 39) - recur_start -> FREQ EQUALS . MINUTELY (rule 40) - recur_start -> FREQ EQUALS . HOURLY (rule 41) - recur_start -> FREQ EQUALS . DAILY (rule 42) - recur_start -> FREQ EQUALS . WEEKLY (rule 43) - recur_start -> FREQ EQUALS . MONTHLY (rule 44) - recur_start -> FREQ EQUALS . YEARLY (rule 45) - - DAILY shift, and go to state 26 - MINUTELY shift, and go to state 27 - MONTHLY shift, and go to state 28 - SECONDLY shift, and go to state 29 - WEEKLY shift, and go to state 30 - HOURLY shift, and go to state 31 - YEARLY shift, and go to state 32 - - - -state 22 - - duration_value -> dur_prefix 'P' . dur_date (rule 34) - duration_value -> dur_prefix 'P' . dur_time (rule 35) - duration_value -> dur_prefix 'P' . dur_week (rule 36) - - DIGITS shift, and go to state 33 - TIME_CHAR shift, and go to state 34 - - dur_date go to state 35 - dur_week go to state 36 - dur_time go to state 37 - dur_day go to state 38 - - - -state 23 - - recur_skip_list -> recur_skip_list . SEMICOLON recur_skip (rule 79) - recur_value -> recur_start recur_skip_list . (rule 80) - - SEMICOLON shift, and go to state 39 - - $default reduce using rule 80 (recur_value) - - - -state 24 - - utcoffset_value -> plusminus INTNUMBER . INTNUMBER (rule 83) - utcoffset_value -> plusminus INTNUMBER . INTNUMBER INTNUMBER (rule 84) - - INTNUMBER shift, and go to state 40 - - - -state 25 - - datetime_value -> DIGITS TIME_CHAR DIGITS . utc_char (rule 18) - period_value -> DIGITS TIME_CHAR DIGITS . utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b (rule 37) - period_value -> DIGITS TIME_CHAR DIGITS . utc_char '/' duration_value (rule 38) - - UTC_CHAR shift, and go to state 41 - - $default reduce using rule 14 (utc_char) - - utc_char go to state 42 - - - -state 26 - - recur_start -> FREQ EQUALS DAILY . (rule 42) - - $default reduce using rule 42 (recur_start) - - - -state 27 - - recur_start -> FREQ EQUALS MINUTELY . (rule 40) - - $default reduce using rule 40 (recur_start) - - - -state 28 - - recur_start -> FREQ EQUALS MONTHLY . (rule 44) - - $default reduce using rule 44 (recur_start) - - - -state 29 - - recur_start -> FREQ EQUALS SECONDLY . (rule 39) - - $default reduce using rule 39 (recur_start) - - - -state 30 - - recur_start -> FREQ EQUALS WEEKLY . (rule 43) - - $default reduce using rule 43 (recur_start) - - - -state 31 - - recur_start -> FREQ EQUALS HOURLY . (rule 41) - - $default reduce using rule 41 (recur_start) - - - -state 32 - - recur_start -> FREQ EQUALS YEARLY . (rule 45) - - $default reduce using rule 45 (recur_start) - - - -state 33 - - dur_week -> DIGITS . 'W' (rule 21) - dur_day -> DIGITS . 'D' (rule 30) - - 'W' shift, and go to state 43 - 'D' shift, and go to state 44 - - - -state 34 - - dur_time -> TIME_CHAR . dur_hour (rule 22) - dur_time -> TIME_CHAR . dur_minute (rule 23) - dur_time -> TIME_CHAR . dur_second (rule 24) - - DIGITS shift, and go to state 45 - - dur_hour go to state 46 - dur_minute go to state 47 - dur_second go to state 48 - - - -state 35 - - duration_value -> dur_prefix 'P' dur_date . (rule 34) - - $default reduce using rule 34 (duration_value) - - - -state 36 - - duration_value -> dur_prefix 'P' dur_week . (rule 36) - - $default reduce using rule 36 (duration_value) - - - -state 37 - - duration_value -> dur_prefix 'P' dur_time . (rule 35) - - $default reduce using rule 35 (duration_value) - - - -state 38 - - dur_date -> dur_day . (rule 19) - dur_date -> dur_day . dur_time (rule 20) - - TIME_CHAR shift, and go to state 34 - - $default reduce using rule 19 (dur_date) - - dur_time go to state 49 - - - -state 39 - - recur_skip_list -> recur_skip_list SEMICOLON . recur_skip (rule 79) - - BYDAY shift, and go to state 50 - BYHOUR shift, and go to state 51 - BYMINUTE shift, and go to state 52 - BYMONTH shift, and go to state 53 - BYMONTHDAY shift, and go to state 54 - BYSECOND shift, and go to state 55 - BYSETPOS shift, and go to state 56 - BYWEEKNO shift, and go to state 57 - BYYEARDAY shift, and go to state 58 - INTERVAL shift, and go to state 59 - COUNT shift, and go to state 60 - UNTIL shift, and go to state 61 - WKST shift, and go to state 62 - - recur_skip go to state 63 - - - -state 40 - - utcoffset_value -> plusminus INTNUMBER INTNUMBER . (rule 83) - utcoffset_value -> plusminus INTNUMBER INTNUMBER . INTNUMBER (rule 84) - - INTNUMBER shift, and go to state 64 - - $default reduce using rule 83 (utcoffset_value) - - - -state 41 - - utc_char -> UTC_CHAR . (rule 15) - - $default reduce using rule 15 (utc_char) - - - -state 42 - - datetime_value -> DIGITS TIME_CHAR DIGITS utc_char . (rule 18) - period_value -> DIGITS TIME_CHAR DIGITS utc_char . '/' DIGITS TIME_CHAR DIGITS utc_char_b (rule 37) - period_value -> DIGITS TIME_CHAR DIGITS utc_char . '/' duration_value (rule 38) - - '/' shift, and go to state 65 - - $default reduce using rule 18 (datetime_value) - - - -state 43 - - dur_week -> DIGITS 'W' . (rule 21) - - $default reduce using rule 21 (dur_week) - - - -state 44 - - dur_day -> DIGITS 'D' . (rule 30) - - $default reduce using rule 30 (dur_day) - - - -state 45 - - dur_hour -> DIGITS . 'H' (rule 25) - dur_hour -> DIGITS . 'H' dur_minute (rule 26) - dur_minute -> DIGITS . 'M' (rule 27) - dur_minute -> DIGITS . 'M' dur_second (rule 28) - dur_second -> DIGITS . 'S' (rule 29) - - 'H' shift, and go to state 66 - 'M' shift, and go to state 67 - 'S' shift, and go to state 68 - - - -state 46 - - dur_time -> TIME_CHAR dur_hour . (rule 22) - - $default reduce using rule 22 (dur_time) - - - -state 47 - - dur_time -> TIME_CHAR dur_minute . (rule 23) - - $default reduce using rule 23 (dur_time) - - - -state 48 - - dur_time -> TIME_CHAR dur_second . (rule 24) - - $default reduce using rule 24 (dur_time) - - - -state 49 - - dur_date -> dur_day dur_time . (rule 20) - - $default reduce using rule 20 (dur_date) - - - -state 50 - - recur_skip -> BYDAY . EQUALS weekday_list (rule 69) - - EQUALS shift, and go to state 69 - - - -state 51 - - recur_skip -> BYHOUR . EQUALS recur_list (rule 68) - - EQUALS shift, and go to state 70 - - - -state 52 - - recur_skip -> BYMINUTE . EQUALS recur_list (rule 67) - - EQUALS shift, and go to state 71 - - - -state 53 - - recur_skip -> BYMONTH . EQUALS recur_list (rule 70) - - EQUALS shift, and go to state 72 - - - -state 54 - - recur_skip -> BYMONTHDAY . EQUALS recur_list (rule 71) - - EQUALS shift, and go to state 73 - - - -state 55 - - recur_skip -> BYSECOND . EQUALS recur_list (rule 66) - - EQUALS shift, and go to state 74 - - - -state 56 - - recur_skip -> BYSETPOS . EQUALS recur_list (rule 74) - - EQUALS shift, and go to state 75 - - - -state 57 - - recur_skip -> BYWEEKNO . EQUALS recur_list (rule 73) - - EQUALS shift, and go to state 76 - - - -state 58 - - recur_skip -> BYYEARDAY . EQUALS recur_list (rule 72) - - EQUALS shift, and go to state 77 - - - -state 59 - - recur_skip -> INTERVAL . EQUALS DIGITS (rule 58) - - EQUALS shift, and go to state 78 - - - -state 60 - - recur_skip -> COUNT . EQUALS DIGITS (rule 77) - - EQUALS shift, and go to state 79 - - - -state 61 - - recur_skip -> UNTIL . EQUALS datetime_value (rule 75) - recur_skip -> UNTIL . EQUALS date_value (rule 76) - - EQUALS shift, and go to state 80 - - - -state 62 - - recur_skip -> WKST . EQUALS SU (rule 59) - recur_skip -> WKST . EQUALS MO (rule 60) - recur_skip -> WKST . EQUALS TU (rule 61) - recur_skip -> WKST . EQUALS WE (rule 62) - recur_skip -> WKST . EQUALS TH (rule 63) - recur_skip -> WKST . EQUALS FR (rule 64) - recur_skip -> WKST . EQUALS SA (rule 65) - - EQUALS shift, and go to state 81 - - - -state 63 - - recur_skip_list -> recur_skip_list SEMICOLON recur_skip . (rule 79) - - $default reduce using rule 79 (recur_skip_list) - - - -state 64 - - utcoffset_value -> plusminus INTNUMBER INTNUMBER INTNUMBER . (rule 84) - - $default reduce using rule 84 (utcoffset_value) - - - -state 65 - - period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' . DIGITS TIME_CHAR DIGITS utc_char_b (rule 37) - period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' . duration_value (rule 38) - - DIGITS shift, and go to state 82 - '+' shift, and go to state 83 - '-' shift, and go to state 84 - - $default reduce using rule 31 (dur_prefix) - - dur_prefix go to state 13 - duration_value go to state 85 - - - -state 66 - - dur_hour -> DIGITS 'H' . (rule 25) - dur_hour -> DIGITS 'H' . dur_minute (rule 26) - - DIGITS shift, and go to state 86 - - $default reduce using rule 25 (dur_hour) - - dur_minute go to state 87 - - - -state 67 - - dur_minute -> DIGITS 'M' . (rule 27) - dur_minute -> DIGITS 'M' . dur_second (rule 28) - - DIGITS shift, and go to state 88 - - $default reduce using rule 27 (dur_minute) - - dur_second go to state 89 - - - -state 68 - - dur_second -> DIGITS 'S' . (rule 29) - - $default reduce using rule 29 (dur_second) - - - -state 69 - - recur_skip -> BYDAY EQUALS . weekday_list (rule 69) - - DIGITS shift, and go to state 90 - MO shift, and go to state 91 - SA shift, and go to state 92 - SU shift, and go to state 93 - TU shift, and go to state 94 - WE shift, and go to state 95 - TH shift, and go to state 96 - FR shift, and go to state 97 - - weekday go to state 98 - weekday_list go to state 99 - - - -state 70 - - recur_skip -> BYHOUR EQUALS . recur_list (rule 68) - - DIGITS shift, and go to state 100 - - recur_list go to state 101 - - - -state 71 - - recur_skip -> BYMINUTE EQUALS . recur_list (rule 67) - - DIGITS shift, and go to state 100 - - recur_list go to state 102 - - - -state 72 - - recur_skip -> BYMONTH EQUALS . recur_list (rule 70) - - DIGITS shift, and go to state 100 - - recur_list go to state 103 - - - -state 73 - - recur_skip -> BYMONTHDAY EQUALS . recur_list (rule 71) - - DIGITS shift, and go to state 100 - - recur_list go to state 104 - - - -state 74 - - recur_skip -> BYSECOND EQUALS . recur_list (rule 66) - - DIGITS shift, and go to state 100 - - recur_list go to state 105 - - - -state 75 - - recur_skip -> BYSETPOS EQUALS . recur_list (rule 74) - - DIGITS shift, and go to state 100 - - recur_list go to state 106 - - - -state 76 - - recur_skip -> BYWEEKNO EQUALS . recur_list (rule 73) - - DIGITS shift, and go to state 100 - - recur_list go to state 107 - - - -state 77 - - recur_skip -> BYYEARDAY EQUALS . recur_list (rule 72) - - DIGITS shift, and go to state 100 - - recur_list go to state 108 - - - -state 78 - - recur_skip -> INTERVAL EQUALS . DIGITS (rule 58) - - DIGITS shift, and go to state 109 - - - -state 79 - - recur_skip -> COUNT EQUALS . DIGITS (rule 77) - - DIGITS shift, and go to state 110 - - - -state 80 - - recur_skip -> UNTIL EQUALS . datetime_value (rule 75) - recur_skip -> UNTIL EQUALS . date_value (rule 76) - - DIGITS shift, and go to state 111 - - date_value go to state 112 - datetime_value go to state 113 - - - -state 81 - - recur_skip -> WKST EQUALS . SU (rule 59) - recur_skip -> WKST EQUALS . MO (rule 60) - recur_skip -> WKST EQUALS . TU (rule 61) - recur_skip -> WKST EQUALS . WE (rule 62) - recur_skip -> WKST EQUALS . TH (rule 63) - recur_skip -> WKST EQUALS . FR (rule 64) - recur_skip -> WKST EQUALS . SA (rule 65) - - MO shift, and go to state 114 - SA shift, and go to state 115 - SU shift, and go to state 116 - TU shift, and go to state 117 - WE shift, and go to state 118 - TH shift, and go to state 119 - FR shift, and go to state 120 - - - -state 82 - - period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS . TIME_CHAR DIGITS utc_char_b (rule 37) - - TIME_CHAR shift, and go to state 121 - - - -state 83 - - dur_prefix -> '+' . (rule 32) - - $default reduce using rule 32 (dur_prefix) - - - -state 84 - - dur_prefix -> '-' . (rule 33) - - $default reduce using rule 33 (dur_prefix) - - - -state 85 - - period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' duration_value . (rule 38) - - $default reduce using rule 38 (period_value) - - - -state 86 - - dur_minute -> DIGITS . 'M' (rule 27) - dur_minute -> DIGITS . 'M' dur_second (rule 28) - - 'M' shift, and go to state 67 - - - -state 87 - - dur_hour -> DIGITS 'H' dur_minute . (rule 26) - - $default reduce using rule 26 (dur_hour) - - - -state 88 - - dur_second -> DIGITS . 'S' (rule 29) - - 'S' shift, and go to state 68 - - - -state 89 - - dur_minute -> DIGITS 'M' dur_second . (rule 28) - - $default reduce using rule 28 (dur_minute) - - - -state 90 - - weekday_list -> DIGITS . weekday (rule 54) - - MO shift, and go to state 91 - SA shift, and go to state 92 - SU shift, and go to state 93 - TU shift, and go to state 94 - WE shift, and go to state 95 - TH shift, and go to state 96 - FR shift, and go to state 97 - - weekday go to state 122 - - - -state 91 - - weekday -> MO . (rule 47) - - $default reduce using rule 47 (weekday) - - - -state 92 - - weekday -> SA . (rule 52) - - $default reduce using rule 52 (weekday) - - - -state 93 - - weekday -> SU . (rule 46) - - $default reduce using rule 46 (weekday) - - - -state 94 - - weekday -> TU . (rule 48) - - $default reduce using rule 48 (weekday) - - - -state 95 - - weekday -> WE . (rule 49) - - $default reduce using rule 49 (weekday) - - - -state 96 - - weekday -> TH . (rule 50) - - $default reduce using rule 50 (weekday) - - - -state 97 - - weekday -> FR . (rule 51) - - $default reduce using rule 51 (weekday) - - - -state 98 - - weekday_list -> weekday . (rule 53) - - $default reduce using rule 53 (weekday_list) - - - -state 99 - - weekday_list -> weekday_list . COMMA weekday (rule 55) - recur_skip -> BYDAY EQUALS weekday_list . (rule 69) - - COMMA shift, and go to state 123 - - $default reduce using rule 69 (recur_skip) - - - -state 100 - - recur_list -> DIGITS . (rule 56) - - $default reduce using rule 56 (recur_list) - - - -state 101 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYHOUR EQUALS recur_list . (rule 68) - - COMMA shift, and go to state 124 - - $default reduce using rule 68 (recur_skip) - - - -state 102 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYMINUTE EQUALS recur_list . (rule 67) - - COMMA shift, and go to state 124 - - $default reduce using rule 67 (recur_skip) - - - -state 103 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYMONTH EQUALS recur_list . (rule 70) - - COMMA shift, and go to state 124 - - $default reduce using rule 70 (recur_skip) - - - -state 104 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYMONTHDAY EQUALS recur_list . (rule 71) - - COMMA shift, and go to state 124 - - $default reduce using rule 71 (recur_skip) - - - -state 105 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYSECOND EQUALS recur_list . (rule 66) - - COMMA shift, and go to state 124 - - $default reduce using rule 66 (recur_skip) - - - -state 106 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYSETPOS EQUALS recur_list . (rule 74) - - COMMA shift, and go to state 124 - - $default reduce using rule 74 (recur_skip) - - - -state 107 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYWEEKNO EQUALS recur_list . (rule 73) - - COMMA shift, and go to state 124 - - $default reduce using rule 73 (recur_skip) - - - -state 108 - - recur_list -> recur_list . COMMA DIGITS (rule 57) - recur_skip -> BYYEARDAY EQUALS recur_list . (rule 72) - - COMMA shift, and go to state 124 - - $default reduce using rule 72 (recur_skip) - - - -state 109 - - recur_skip -> INTERVAL EQUALS DIGITS . (rule 58) - - $default reduce using rule 58 (recur_skip) - - - -state 110 - - recur_skip -> COUNT EQUALS DIGITS . (rule 77) - - $default reduce using rule 77 (recur_skip) - - - -state 111 - - date_value -> DIGITS . (rule 13) - datetime_value -> DIGITS . TIME_CHAR DIGITS utc_char (rule 18) - - TIME_CHAR shift, and go to state 125 - - $default reduce using rule 13 (date_value) - - - -state 112 - - recur_skip -> UNTIL EQUALS date_value . (rule 76) - - $default reduce using rule 76 (recur_skip) - - - -state 113 - - recur_skip -> UNTIL EQUALS datetime_value . (rule 75) - - $default reduce using rule 75 (recur_skip) - - - -state 114 - - recur_skip -> WKST EQUALS MO . (rule 60) - - $default reduce using rule 60 (recur_skip) - - - -state 115 - - recur_skip -> WKST EQUALS SA . (rule 65) - - $default reduce using rule 65 (recur_skip) - - - -state 116 - - recur_skip -> WKST EQUALS SU . (rule 59) - - $default reduce using rule 59 (recur_skip) - - - -state 117 - - recur_skip -> WKST EQUALS TU . (rule 61) - - $default reduce using rule 61 (recur_skip) - - - -state 118 - - recur_skip -> WKST EQUALS WE . (rule 62) - - $default reduce using rule 62 (recur_skip) - - - -state 119 - - recur_skip -> WKST EQUALS TH . (rule 63) - - $default reduce using rule 63 (recur_skip) - - - -state 120 - - recur_skip -> WKST EQUALS FR . (rule 64) - - $default reduce using rule 64 (recur_skip) - - - -state 121 - - period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR . DIGITS utc_char_b (rule 37) - - DIGITS shift, and go to state 126 - - - -state 122 - - weekday_list -> DIGITS weekday . (rule 54) - - $default reduce using rule 54 (weekday_list) - - - -state 123 - - weekday_list -> weekday_list COMMA . weekday (rule 55) - - MO shift, and go to state 91 - SA shift, and go to state 92 - SU shift, and go to state 93 - TU shift, and go to state 94 - WE shift, and go to state 95 - TH shift, and go to state 96 - FR shift, and go to state 97 - - weekday go to state 127 - - - -state 124 - - recur_list -> recur_list COMMA . DIGITS (rule 57) - - DIGITS shift, and go to state 128 - - - -state 125 - - datetime_value -> DIGITS TIME_CHAR . DIGITS utc_char (rule 18) - - DIGITS shift, and go to state 129 - - - -state 126 - - period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS . utc_char_b (rule 37) - - UTC_CHAR shift, and go to state 130 - - $default reduce using rule 16 (utc_char_b) - - utc_char_b go to state 131 - - - -state 127 - - weekday_list -> weekday_list COMMA weekday . (rule 55) - - $default reduce using rule 55 (weekday_list) - - - -state 128 - - recur_list -> recur_list COMMA DIGITS . (rule 57) - - $default reduce using rule 57 (recur_list) - - - -state 129 - - datetime_value -> DIGITS TIME_CHAR DIGITS . utc_char (rule 18) - - UTC_CHAR shift, and go to state 41 - - $default reduce using rule 14 (utc_char) - - utc_char go to state 132 - - - -state 130 - - utc_char_b -> UTC_CHAR . (rule 17) - - $default reduce using rule 17 (utc_char_b) - - - -state 131 - - period_value -> DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b . (rule 37) - - $default reduce using rule 37 (period_value) - - - -state 132 - - datetime_value -> DIGITS TIME_CHAR DIGITS utc_char . (rule 18) - - $default reduce using rule 18 (datetime_value) - - - -state 133 - - $ go to state 134 - - - -state 134 - - $ go to state 135 - - - -state 135 - - $default accept diff --git a/libical/src/libical/icalitip.tab.c b/libical/src/libical/icalitip.tab.c deleted file mode 100644 index 82536647e3..0000000000 --- a/libical/src/libical/icalitip.tab.c +++ /dev/null @@ -1,1663 +0,0 @@ - -/* A Bison parser, made from icalitip.y - by GNU Bison version 1.28 */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define yyparse icalparser_yyparse -#define yylex icalparser_yylex -#define yyerror icalparser_yyerror -#define yylval icalparser_yylval -#define yychar icalparser_yychar -#define yydebug icalparser_yydebug -#define yynerrs icalparser_yynerrs -#define DIGITS 257 -#define INTNUMBER 258 -#define FLOATNUMBER 259 -#define STRING 260 -#define EOL 261 -#define EQUALS 262 -#define CHARACTER 263 -#define COLON 264 -#define COMMA 265 -#define SEMICOLON 266 -#define TIMESEPERATOR 267 -#define TRUE 268 -#define FALSE 269 -#define FREQ 270 -#define BYDAY 271 -#define BYHOUR 272 -#define BYMINUTE 273 -#define BYMONTH 274 -#define BYMONTHDAY 275 -#define BYSECOND 276 -#define BYSETPOS 277 -#define BYWEEKNO 278 -#define BYYEARDAY 279 -#define DAILY 280 -#define MINUTELY 281 -#define MONTHLY 282 -#define SECONDLY 283 -#define WEEKLY 284 -#define HOURLY 285 -#define YEARLY 286 -#define INTERVAL 287 -#define COUNT 288 -#define UNTIL 289 -#define WKST 290 -#define MO 291 -#define SA 292 -#define SU 293 -#define TU 294 -#define WE 295 -#define TH 296 -#define FR 297 -#define BIT8 298 -#define ACCEPTED 299 -#define ADD 300 -#define AUDIO 301 -#define BASE64 302 -#define BINARY 303 -#define BOOLEAN 304 -#define BUSY 305 -#define BUSYTENTATIVE 306 -#define BUSYUNAVAILABLE 307 -#define CALADDRESS 308 -#define CANCEL 309 -#define CANCELLED 310 -#define CHAIR 311 -#define CHILD 312 -#define COMPLETED 313 -#define CONFIDENTIAL 314 -#define CONFIRMED 315 -#define COUNTER 316 -#define DATE 317 -#define DATETIME 318 -#define DECLINECOUNTER 319 -#define DECLINED 320 -#define DELEGATED 321 -#define DISPLAY 322 -#define DRAFT 323 -#define DURATION 324 -#define EMAIL 325 -#define END 326 -#define FINAL 327 -#define FLOAT 328 -#define FREE 329 -#define GREGORIAN 330 -#define GROUP 331 -#define INDIVIDUAL 332 -#define INPROCESS 333 -#define INTEGER 334 -#define NEEDSACTION 335 -#define NONPARTICIPANT 336 -#define OPAQUE 337 -#define OPTPARTICIPANT 338 -#define PARENT 339 -#define PERIOD 340 -#define PRIVATE 341 -#define PROCEDURE 342 -#define PUBLIC 343 -#define PUBLISH 344 -#define RECUR 345 -#define REFRESH 346 -#define REPLY 347 -#define REQPARTICIPANT 348 -#define REQUEST 349 -#define RESOURCE 350 -#define ROOM 351 -#define SIBLING 352 -#define START 353 -#define TENTATIVE 354 -#define TEXT 355 -#define THISANDFUTURE 356 -#define THISANDPRIOR 357 -#define TIME 358 -#define TRANSPAENT 359 -#define UNKNOWN 360 -#define UTCOFFSET 361 -#define XNAME 362 -#define ALTREP 363 -#define CN 364 -#define CUTYPE 365 -#define DAYLIGHT 366 -#define DIR 367 -#define ENCODING 368 -#define EVENT 369 -#define FBTYPE 370 -#define FMTTYPE 371 -#define LANGUAGE 372 -#define MEMBER 373 -#define PARTSTAT 374 -#define RANGE 375 -#define RELATED 376 -#define RELTYPE 377 -#define ROLE 378 -#define RSVP 379 -#define SENTBY 380 -#define STANDARD 381 -#define URI 382 -#define TIME_CHAR 383 -#define UTC_CHAR 384 - -#line 1 "icalitip.y" - -/* -*- Mode: C -*- - ====================================================================== - FILE: icalitip.y - CREATOR: eric 10 June 1999 - - DESCRIPTION: - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalitip.y - - - - ================================b======================================*/ - -#include -#include /* for strdup() */ -#include /* for SHRT_MAX*/ -#include "icalparser.h" -#include "ical.h" -#include "pvl.h" - -#define YYERROR_VERBOSE -#define YYDEBUG 1 - -icalvalue *icalparser_yy_value; /* Current Value */ - -/* Globals for UTCOFFSET values */ -int utc; -int utc_b; -int utcsign; - -/* Globals for DURATION values */ -struct icaldurationtype duration; - -/* Globals for RECUR values */ -struct icalrecurrencetype recur; -short skiplist[367]; -short skippos; - -void copy_list(short* array, size_t size); -void clear_recur(); -void add_prop(icalproperty_kind); -void icalparser_fill_date(struct tm* t, char* dstr); -void icalparser_fill_time(struct tm* t, char* tstr); -void set_value_type(icalvalue_kind kind); -void yyerror(char *s); /* Don't know why I need this.... */ -int yylex(void); /* Or this. */ -void set_parser_value_state(); -struct icaltimetype fill_datetime(char* d, char* t); - - - -/* Set the state of the lexer so it will interpret values ( iCAL - VALUEs, that is, ) correctly. */ - - -#line 75 "icalitip.y" -typedef union { - float v_float; - int v_int; - char* v_string; - -} YYSTYPE; -#include - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 135 -#define YYFLAG -32768 -#define YYNTBASE 141 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 385 ? yytranslate[x] : 167) - -static const short 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, 137, 2, 138, 2, 140, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 136, 2, 2, - 2, 133, 2, 2, 2, 2, 134, 2, 2, 139, - 2, 2, 135, 2, 2, 2, 132, 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, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, - 20, 22, 24, 26, 27, 29, 30, 32, 37, 39, - 42, 45, 48, 51, 54, 57, 61, 64, 68, 71, - 74, 75, 77, 79, 83, 87, 91, 101, 108, 112, - 116, 120, 124, 128, 132, 136, 138, 140, 142, 144, - 146, 148, 150, 152, 155, 159, 161, 165, 169, 173, - 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, - 217, 221, 225, 229, 233, 237, 241, 245, 246, 250, - 253, 255, 257, 261 -}; - -static const short yyrhs[] = { 142, - 0, 143, 0, 144, 0, 147, 0, 156, 0, 157, - 0, 164, 0, 166, 0, 1, 0, 131, 0, 14, - 0, 15, 0, 3, 0, 0, 130, 0, 0, 130, - 0, 3, 129, 3, 145, 0, 154, 0, 154, 150, - 0, 3, 132, 0, 129, 151, 0, 129, 152, 0, - 129, 153, 0, 3, 133, 0, 3, 133, 152, 0, - 3, 134, 0, 3, 134, 153, 0, 3, 135, 0, - 3, 136, 0, 0, 137, 0, 138, 0, 155, 139, - 148, 0, 155, 139, 150, 0, 155, 139, 149, 0, - 3, 129, 3, 145, 140, 3, 129, 3, 146, 0, - 3, 129, 3, 145, 140, 156, 0, 16, 8, 29, - 0, 16, 8, 27, 0, 16, 8, 31, 0, 16, - 8, 26, 0, 16, 8, 30, 0, 16, 8, 28, - 0, 16, 8, 32, 0, 39, 0, 37, 0, 40, - 0, 41, 0, 42, 0, 43, 0, 38, 0, 159, - 0, 3, 159, 0, 160, 11, 159, 0, 3, 0, - 161, 11, 3, 0, 33, 8, 3, 0, 36, 8, - 39, 0, 36, 8, 37, 0, 36, 8, 40, 0, - 36, 8, 41, 0, 36, 8, 42, 0, 36, 8, - 43, 0, 36, 8, 38, 0, 22, 8, 161, 0, - 19, 8, 161, 0, 18, 8, 161, 0, 17, 8, - 160, 0, 20, 8, 161, 0, 21, 8, 161, 0, - 25, 8, 161, 0, 24, 8, 161, 0, 23, 8, - 161, 0, 35, 8, 147, 0, 35, 8, 144, 0, - 34, 8, 3, 0, 0, 163, 12, 162, 0, 158, - 163, 0, 137, 0, 138, 0, 165, 4, 4, 0, - 165, 4, 4, 4, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 112, 114, 115, 116, 117, 118, 119, 120, 121, 127, - 129, 132, 135, 150, 152, 155, 157, 159, 175, 176, - 178, 183, 186, 189, 193, 197, 202, 206, 211, 216, - 221, 224, 227, 231, 236, 241, 250, 271, 303, 305, - 306, 307, 308, 309, 310, 314, 316, 317, 318, 319, - 320, 321, 325, 327, 328, 331, 333, 336, 338, 339, - 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, - 350, 351, 352, 353, 354, 357, 360, 364, 366, 368, - 376, 377, 379, 385 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","DIGITS", -"INTNUMBER","FLOATNUMBER","STRING","EOL","EQUALS","CHARACTER","COLON","COMMA", -"SEMICOLON","TIMESEPERATOR","TRUE","FALSE","FREQ","BYDAY","BYHOUR","BYMINUTE", -"BYMONTH","BYMONTHDAY","BYSECOND","BYSETPOS","BYWEEKNO","BYYEARDAY","DAILY", -"MINUTELY","MONTHLY","SECONDLY","WEEKLY","HOURLY","YEARLY","INTERVAL","COUNT", -"UNTIL","WKST","MO","SA","SU","TU","WE","TH","FR","BIT8","ACCEPTED","ADD","AUDIO", -"BASE64","BINARY","BOOLEAN","BUSY","BUSYTENTATIVE","BUSYUNAVAILABLE","CALADDRESS", -"CANCEL","CANCELLED","CHAIR","CHILD","COMPLETED","CONFIDENTIAL","CONFIRMED", -"COUNTER","DATE","DATETIME","DECLINECOUNTER","DECLINED","DELEGATED","DISPLAY", -"DRAFT","DURATION","EMAIL","END","FINAL","FLOAT","FREE","GREGORIAN","GROUP", -"INDIVIDUAL","INPROCESS","INTEGER","NEEDSACTION","NONPARTICIPANT","OPAQUE","OPTPARTICIPANT", -"PARENT","PERIOD","PRIVATE","PROCEDURE","PUBLIC","PUBLISH","RECUR","REFRESH", -"REPLY","REQPARTICIPANT","REQUEST","RESOURCE","ROOM","SIBLING","START","TENTATIVE", -"TEXT","THISANDFUTURE","THISANDPRIOR","TIME","TRANSPAENT","UNKNOWN","UTCOFFSET", -"XNAME","ALTREP","CN","CUTYPE","DAYLIGHT","DIR","ENCODING","EVENT","FBTYPE", -"FMTTYPE","LANGUAGE","MEMBER","PARTSTAT","RANGE","RELATED","RELTYPE","ROLE", -"RSVP","SENTBY","STANDARD","URI","TIME_CHAR","UTC_CHAR","\"unimplemented2\"", -"'W'","'H'","'M'","'S'","'D'","'+'","'-'","'P'","'/'","value","binary_value", -"boolean_value","date_value","utc_char","utc_char_b","datetime_value","dur_date", -"dur_week","dur_time","dur_hour","dur_minute","dur_second","dur_day","dur_prefix", -"duration_value","period_value","recur_start","weekday","weekday_list","recur_list", -"recur_skip","recur_skip_list","recur_value","plusminus","utcoffset_value", NULL -}; -#endif - -static const short yyr1[] = { 0, - 141, 141, 141, 141, 141, 141, 141, 141, 141, 142, - 143, 143, 144, 145, 145, 146, 146, 147, 148, 148, - 149, 150, 150, 150, 151, 151, 152, 152, 153, 154, - 155, 155, 155, 156, 156, 156, 157, 157, 158, 158, - 158, 158, 158, 158, 158, 159, 159, 159, 159, 159, - 159, 159, 160, 160, 160, 161, 161, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, - 162, 162, 162, 162, 162, 162, 162, 163, 163, 164, - 165, 165, 166, 166 -}; - -static const short yyr2[] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 1, 0, 1, 4, 1, 2, - 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, - 0, 1, 1, 3, 3, 3, 9, 6, 3, 3, - 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 3, 1, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 0, 3, 2, - 1, 1, 3, 4 -}; - -static const short yydefact[] = { 0, - 9, 13, 11, 12, 0, 10, 32, 33, 1, 2, - 3, 4, 0, 5, 6, 78, 7, 0, 8, 0, - 0, 0, 80, 0, 14, 42, 40, 44, 39, 43, - 41, 45, 0, 0, 34, 36, 35, 19, 0, 83, - 15, 18, 21, 30, 0, 22, 23, 24, 20, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 79, 84, 31, 25, 27, 29, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 32, 33, 38, 0, 26, 0, 28, 0, - 47, 52, 46, 48, 49, 50, 51, 53, 69, 56, - 68, 67, 70, 71, 66, 74, 73, 72, 58, 77, - 13, 76, 75, 60, 65, 59, 61, 62, 63, 64, - 0, 54, 0, 0, 0, 16, 55, 57, 14, 17, - 37, 18, 0, 0, 0 -}; - -static const short yydefgoto[] = { 133, - 9, 10, 11, 42, 131, 12, 35, 36, 37, 46, - 47, 48, 38, 13, 14, 15, 16, 98, 99, 101, - 63, 23, 17, 18, 19 -}; - -static const short yypact[] = { -1, --32768, -123,-32768,-32768, 1,-32768, 3, 6,-32768,-32768, --32768,-32768, -127,-32768,-32768,-32768,-32768, 64,-32768, 66, - -10, -2, 58, 67, -58,-32768,-32768,-32768,-32768,-32768, --32768,-32768, -128, 70,-32768,-32768,-32768, -55, 28, 71, --32768, -64,-32768,-32768, -68,-32768,-32768,-32768,-32768, 69, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83,-32768,-32768, 2, 89, 90,-32768, 0, 91, - 91, 91, 91, 91, 91, 91, 91, 92, 93, 94, - -14, -51,-32768,-32768,-32768, -36,-32768, -56,-32768, -7, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88,-32768, - 95, 95, 95, 95, 95, 95, 95, 95,-32768,-32768, - -29,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 98,-32768, -7, 99, 100, -26,-32768,-32768, -58,-32768, --32768,-32768, 105, 107,-32768 -}; - -static const short yypgoto[] = {-32768, --32768,-32768, 29, -21,-32768, 30,-32768,-32768, 84,-32768, - 45, 46,-32768,-32768, 47,-32768,-32768, -79,-32768, -17, --32768,-32768,-32768,-32768,-32768 -}; - - -#define YYLAST 140 - - -static const short yytable[] = { 1, - 33, 2, 90, 43, 82, 20, -81, 44, 21, -82, - 122, 22, 3, 4, 5, 26, 27, 28, 29, 30, - 31, 32, 114, 115, 116, 117, 118, 119, 120, 91, - 92, 93, 94, 95, 96, 97, 91, 92, 93, 94, - 95, 96, 97, 127, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 102, 103, 104, 105, 106, 107, 108, - 59, 60, 61, 62, 66, 67, 68, 24, 25, 39, - 40, 41, 45, 34, 64, 65, 69, 121, 68, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 86, 88, 100, 109, 110, 111, 67, 123, 125, - 126, 128, 129, 130, 134, 124, 135, 132, 112, 113, - 87, 85, 89, 0, 0, 0, 0, 0, 0, 0, - 0, 49, 0, 0, 0, 0, 34, 0, 0, 6, - 0, 0, 0, 0, 0, 7, 8, -31, 83, 84 -}; - -static const short yycheck[] = { 1, - 3, 3, 3, 132, 3, 129, 4, 136, 8, 4, - 90, 139, 14, 15, 16, 26, 27, 28, 29, 30, - 31, 32, 37, 38, 39, 40, 41, 42, 43, 37, - 38, 39, 40, 41, 42, 43, 37, 38, 39, 40, - 41, 42, 43, 123, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 71, 72, 73, 74, 75, 76, 77, - 33, 34, 35, 36, 133, 134, 135, 4, 3, 12, - 4, 130, 3, 129, 4, 140, 8, 129, 135, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 3, 3, 3, 3, 3, 3, 134, 11, 129, - 3, 3, 3, 130, 0, 11, 0, 129, 80, 80, - 66, 65, 67, -1, -1, -1, -1, -1, -1, -1, - -1, 38, -1, -1, -1, -1, 129, -1, -1, 131, - -1, -1, -1, -1, -1, 137, 138, 139, 137, 138 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/lib/bison.simple" -/* This file comes from bison-1.28. */ - -/* 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 -#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 -#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 */ - #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 217 "/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 9: -#line 121 "icalitip.y" -{ - icalparser_yy_value = 0; - icalparser_clear_flex_input(); - yyclearin; - ; - break;} -case 11: -#line 131 "icalitip.y" -{ icalparser_yy_value = icalvalue_new_boolean(1); ; - break;} -case 12: -#line 133 "icalitip.y" -{ icalparser_yy_value = icalvalue_new_boolean(0); ; - break;} -case 13: -#line 136 "icalitip.y" -{ - struct icaltimetype stm; - - stm = fill_datetime(yyvsp[0].v_string,0); - - stm.hour = -1; - stm.minute = -1; - stm.second = -1; - stm.is_utc = 0; - stm.is_date = 1; - - icalparser_yy_value = icalvalue_new_date(stm); - ; - break;} -case 14: -#line 151 "icalitip.y" -{utc = 0;; - break;} -case 15: -#line 152 "icalitip.y" -{utc = 1;; - break;} -case 16: -#line 156 "icalitip.y" -{utc_b = 0;; - break;} -case 17: -#line 157 "icalitip.y" -{utc_b = 1;; - break;} -case 18: -#line 161 "icalitip.y" -{ - struct icaltimetype stm; - stm = fill_datetime(yyvsp[-3].v_string, yyvsp[-1].v_string); - stm.is_utc = utc; - stm.is_date = 0; - - icalparser_yy_value = - icalvalue_new_datetime(stm); - ; - break;} -case 21: -#line 179 "icalitip.y" -{ - duration.weeks = atoi(yyvsp[-1].v_string); - ; - break;} -case 22: -#line 184 "icalitip.y" -{ - ; - break;} -case 23: -#line 187 "icalitip.y" -{ - ; - break;} -case 24: -#line 190 "icalitip.y" -{ - ; - break;} -case 25: -#line 194 "icalitip.y" -{ - duration.hours = atoi(yyvsp[-1].v_string); - ; - break;} -case 26: -#line 198 "icalitip.y" -{ - duration.hours = atoi(yyvsp[-2].v_string); - ; - break;} -case 27: -#line 203 "icalitip.y" -{ - duration.minutes = atoi(yyvsp[-1].v_string); - ; - break;} -case 28: -#line 207 "icalitip.y" -{ - duration.minutes = atoi(yyvsp[-2].v_string); - ; - break;} -case 29: -#line 212 "icalitip.y" -{ - duration.seconds = atoi(yyvsp[-1].v_string); - ; - break;} -case 30: -#line 217 "icalitip.y" -{ - duration.days = atoi(yyvsp[-1].v_string); - ; - break;} -case 31: -#line 222 "icalitip.y" -{ - ; - break;} -case 32: -#line 225 "icalitip.y" -{ - ; - break;} -case 33: -#line 228 "icalitip.y" -{ - ; - break;} -case 34: -#line 232 "icalitip.y" -{ - icalparser_yy_value = icalvalue_new_duration(duration); - memset(&duration,0, sizeof(duration)); - ; - break;} -case 35: -#line 237 "icalitip.y" -{ - icalparser_yy_value = icalvalue_new_duration(duration); - memset(&duration,0, sizeof(duration)); - ; - break;} -case 36: -#line 242 "icalitip.y" -{ - icalparser_yy_value = icalvalue_new_duration(duration); - memset(&duration,0, sizeof(duration)); - ; - break;} -case 37: -#line 251 "icalitip.y" -{ - struct icalperiodtype p; - - p.start = fill_datetime(yyvsp[-8].v_string,yyvsp[-6].v_string); - p.start.is_utc = utc; - p.start.is_date = 0; - - - p.end = fill_datetime(yyvsp[-3].v_string,yyvsp[-1].v_string); - p.end.is_utc = utc_b; - p.end.is_date = 0; - - p.duration.days = -1; - p.duration.weeks = -1; - p.duration.hours = -1; - p.duration.minutes = -1; - p.duration.seconds = -1; - - icalparser_yy_value = icalvalue_new_period(p); - ; - break;} -case 38: -#line 272 "icalitip.y" -{ - struct icalperiodtype p; - - p.start = fill_datetime(yyvsp[-5].v_string,yyvsp[-3].v_string); - p.start.is_utc = utc; - p.start.is_date = 0; - - p.end.year = -1; - p.end.month = -1; - p.end.day = -1; - p.end.hour = -1; - p.end.minute = -1; - p.end.second = -1; - - /* The duration_value rule setes the global 'duration' - variable, but it also creates a new value in - icalparser_yy_value. So, free that, then copy - 'duration' into the icalperiodtype struct. */ - - p.duration = icalvalue_get_duration(icalparser_yy_value); - icalvalue_free(icalparser_yy_value); - icalparser_yy_value = 0; - - icalparser_yy_value = icalvalue_new_period(p); - - ; - break;} -case 39: -#line 304 "icalitip.y" -{clear_recur();recur.freq = ICAL_SECONDLY_RECURRENCE;; - break;} -case 40: -#line 305 "icalitip.y" -{clear_recur();recur.freq = ICAL_MINUTELY_RECURRENCE;; - break;} -case 41: -#line 306 "icalitip.y" -{clear_recur();recur.freq = ICAL_HOURLY_RECURRENCE;; - break;} -case 42: -#line 307 "icalitip.y" -{clear_recur();recur.freq = ICAL_DAILY_RECURRENCE;; - break;} -case 43: -#line 308 "icalitip.y" -{clear_recur();recur.freq = ICAL_WEEKLY_RECURRENCE;; - break;} -case 44: -#line 309 "icalitip.y" -{clear_recur();recur.freq = ICAL_MONTHLY_RECURRENCE;; - break;} -case 45: -#line 310 "icalitip.y" -{clear_recur();recur.freq = ICAL_YEARLY_RECURRENCE;; - break;} -case 46: -#line 315 "icalitip.y" -{ skiplist[skippos]=ICAL_SUNDAY_WEEKDAY; if( skippos<8) skippos++;; - break;} -case 47: -#line 316 "icalitip.y" -{ skiplist[skippos]=ICAL_MONDAY_WEEKDAY;if( skippos<8) skippos++;; - break;} -case 48: -#line 317 "icalitip.y" -{ skiplist[skippos]=ICAL_TUESDAY_WEEKDAY;if( skippos<8) skippos++;; - break;} -case 49: -#line 318 "icalitip.y" -{ skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY;if( skippos<8) skippos++;; - break;} -case 50: -#line 319 "icalitip.y" -{ skiplist[skippos]=ICAL_THURSDAY_WEEKDAY;if( skippos<8) skippos++;; - break;} -case 51: -#line 320 "icalitip.y" -{ skiplist[skippos]=ICAL_FRIDAY_WEEKDAY;if( skippos<8) skippos++;; - break;} -case 52: -#line 321 "icalitip.y" -{ skiplist[skippos]=ICAL_SATURDAY_WEEKDAY;if( skippos<8) skippos++;; - break;} -case 54: -#line 327 "icalitip.y" -{ ; - break;} -case 56: -#line 332 "icalitip.y" -{ skiplist[skippos] = atoi(yyvsp[0].v_string); skippos++;; - break;} -case 57: -#line 333 "icalitip.y" -{ skiplist[skippos] = atoi(yyvsp[0].v_string); if (skippos<367) skippos++;; - break;} -case 58: -#line 337 "icalitip.y" -{recur.interval = atoi(yyvsp[0].v_string);; - break;} -case 59: -#line 338 "icalitip.y" -{recur.week_start = ICAL_SUNDAY_WEEKDAY;; - break;} -case 60: -#line 339 "icalitip.y" -{recur.week_start = ICAL_MONDAY_WEEKDAY;; - break;} -case 61: -#line 340 "icalitip.y" -{recur.week_start = ICAL_TUESDAY_WEEKDAY;; - break;} -case 62: -#line 341 "icalitip.y" -{recur.week_start = ICAL_WEDNESDAY_WEEKDAY;; - break;} -case 63: -#line 342 "icalitip.y" -{recur.week_start = ICAL_THURSDAY_WEEKDAY;; - break;} -case 64: -#line 343 "icalitip.y" -{recur.week_start = ICAL_FRIDAY_WEEKDAY;; - break;} -case 65: -#line 344 "icalitip.y" -{recur.week_start = ICAL_SATURDAY_WEEKDAY;; - break;} -case 66: -#line 345 "icalitip.y" -{copy_list(recur.by_second,60);; - break;} -case 67: -#line 346 "icalitip.y" -{copy_list(recur.by_minute,60);; - break;} -case 68: -#line 347 "icalitip.y" -{copy_list(recur.by_hour,24);; - break;} -case 69: -#line 348 "icalitip.y" -{copy_list(recur.by_day,7);; - break;} -case 70: -#line 349 "icalitip.y" -{copy_list(recur.by_month,12);; - break;} -case 71: -#line 350 "icalitip.y" -{copy_list(recur.by_month_day,31);; - break;} -case 72: -#line 351 "icalitip.y" -{copy_list(recur.by_year_day,366);; - break;} -case 73: -#line 352 "icalitip.y" -{copy_list(recur.by_week_no,53);; - break;} -case 74: -#line 353 "icalitip.y" -{copy_list(recur.by_set_pos,366);; - break;} -case 75: -#line 355 "icalitip.y" -{ recur.until = icalvalue_get_datetime(icalparser_yy_value); - icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;; - break;} -case 76: -#line 358 "icalitip.y" -{ recur.until = icalvalue_get_date(icalparser_yy_value); - icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;; - break;} -case 77: -#line 361 "icalitip.y" -{ recur.count = atoi(yyvsp[0].v_string); ; - break;} -case 80: -#line 370 "icalitip.y" -{ icalparser_yy_value = icalvalue_new_recur(recur); ; - break;} -case 81: -#line 376 "icalitip.y" -{ utcsign = 1; ; - break;} -case 82: -#line 377 "icalitip.y" -{ utcsign = -1; ; - break;} -case 83: -#line 381 "icalitip.y" -{ - icalparser_yy_value = icalvalue_new_utcoffset( utcsign * (yyvsp[-1].v_int*3600) + (yyvsp[0].v_int*60) ); - ; - break;} -case 84: -#line 386 "icalitip.y" -{ - icalparser_yy_value = icalvalue_new_utcoffset(utcsign * (yyvsp[-2].v_int*3600) + (yyvsp[-1].v_int*60) +(yyvsp[0].v_int)); - ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/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 392 "icalitip.y" - - - -void clear_recur() -{ - memset(&skiplist, ICAL_RECURRENCE_ARRAY_MAX_BYTE, sizeof(skiplist)); - skippos = 0; - - icalrecurrencetype_clear(&recur); -} - -void copy_list(short* array, size_t size) -{ - memcpy(array, skiplist, size*sizeof(short)); - memset(&skiplist,ICAL_RECURRENCE_ARRAY_MAX_BYTE, sizeof(skiplist)); - skippos = 0; -} - -struct icaltimetype fill_datetime(char* datestr, char* timestr) -{ - struct icaltimetype stm; - - memset(&stm,0,sizeof(stm)); - - if (datestr != 0){ - sscanf(datestr,"%4d%2d%2d",&(stm.year), &(stm.month), - &(stm.day)); - } - - if (timestr != 0){ - sscanf(timestr,"%2d%2d%2d", &(stm.hour), &(stm.minute), - &(stm.second)); - } - - return stm; - -} - -void yyerror(char* s) -{ - /*fprintf(stderr,"Parse error \'%s\'\n", s);*/ -} - diff --git a/libical/src/libical/icalitip.tab.h b/libical/src/libical/icalitip.tab.h deleted file mode 100644 index 197bd1c292..0000000000 --- a/libical/src/libical/icalitip.tab.h +++ /dev/null @@ -1,137 +0,0 @@ -typedef union { - float v_float; - int v_int; - char* v_string; - -} YYSTYPE; -#define DIGITS 257 -#define INTNUMBER 258 -#define FLOATNUMBER 259 -#define STRING 260 -#define EOL 261 -#define EQUALS 262 -#define CHARACTER 263 -#define COLON 264 -#define COMMA 265 -#define SEMICOLON 266 -#define TIMESEPERATOR 267 -#define TRUE 268 -#define FALSE 269 -#define FREQ 270 -#define BYDAY 271 -#define BYHOUR 272 -#define BYMINUTE 273 -#define BYMONTH 274 -#define BYMONTHDAY 275 -#define BYSECOND 276 -#define BYSETPOS 277 -#define BYWEEKNO 278 -#define BYYEARDAY 279 -#define DAILY 280 -#define MINUTELY 281 -#define MONTHLY 282 -#define SECONDLY 283 -#define WEEKLY 284 -#define HOURLY 285 -#define YEARLY 286 -#define INTERVAL 287 -#define COUNT 288 -#define UNTIL 289 -#define WKST 290 -#define MO 291 -#define SA 292 -#define SU 293 -#define TU 294 -#define WE 295 -#define TH 296 -#define FR 297 -#define BIT8 298 -#define ACCEPTED 299 -#define ADD 300 -#define AUDIO 301 -#define BASE64 302 -#define BINARY 303 -#define BOOLEAN 304 -#define BUSY 305 -#define BUSYTENTATIVE 306 -#define BUSYUNAVAILABLE 307 -#define CALADDRESS 308 -#define CANCEL 309 -#define CANCELLED 310 -#define CHAIR 311 -#define CHILD 312 -#define COMPLETED 313 -#define CONFIDENTIAL 314 -#define CONFIRMED 315 -#define COUNTER 316 -#define DATE 317 -#define DATETIME 318 -#define DECLINECOUNTER 319 -#define DECLINED 320 -#define DELEGATED 321 -#define DISPLAY 322 -#define DRAFT 323 -#define DURATION 324 -#define EMAIL 325 -#define END 326 -#define FINAL 327 -#define FLOAT 328 -#define FREE 329 -#define GREGORIAN 330 -#define GROUP 331 -#define INDIVIDUAL 332 -#define INPROCESS 333 -#define INTEGER 334 -#define NEEDSACTION 335 -#define NONPARTICIPANT 336 -#define OPAQUE 337 -#define OPTPARTICIPANT 338 -#define PARENT 339 -#define PERIOD 340 -#define PRIVATE 341 -#define PROCEDURE 342 -#define PUBLIC 343 -#define PUBLISH 344 -#define RECUR 345 -#define REFRESH 346 -#define REPLY 347 -#define REQPARTICIPANT 348 -#define REQUEST 349 -#define RESOURCE 350 -#define ROOM 351 -#define SIBLING 352 -#define START 353 -#define TENTATIVE 354 -#define TEXT 355 -#define THISANDFUTURE 356 -#define THISANDPRIOR 357 -#define TIME 358 -#define TRANSPAENT 359 -#define UNKNOWN 360 -#define UTCOFFSET 361 -#define XNAME 362 -#define ALTREP 363 -#define CN 364 -#define CUTYPE 365 -#define DAYLIGHT 366 -#define DIR 367 -#define ENCODING 368 -#define EVENT 369 -#define FBTYPE 370 -#define FMTTYPE 371 -#define LANGUAGE 372 -#define MEMBER 373 -#define PARTSTAT 374 -#define RANGE 375 -#define RELATED 376 -#define RELTYPE 377 -#define ROLE 378 -#define RSVP 379 -#define SENTBY 380 -#define STANDARD 381 -#define URI 382 -#define TIME_CHAR 383 -#define UTC_CHAR 384 - - -extern YYSTYPE icalparser_yylval; diff --git a/libical/src/libical/icalitip.y b/libical/src/libical/icalitip.y deleted file mode 100644 index 8e4f16b553..0000000000 --- a/libical/src/libical/icalitip.y +++ /dev/null @@ -1,434 +0,0 @@ -%{ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalitip.y - CREATOR: eric 10 June 1999 - - DESCRIPTION: - - $Id: icalitip.y,v 1.1.1.2 2000/02/21 13:19:26 alves Exp $ - $Locker: $ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalitip.y - - - - ================================b======================================*/ - -#include -#include /* for strdup() */ -#include /* for SHRT_MAX*/ -#include "icalparser.h" -#include "ical.h" -#include "pvl.h" - -#define YYERROR_VERBOSE -#define YYDEBUG 1 - -icalvalue *icalparser_yy_value; /* Current Value */ - -/* Globals for UTCOFFSET values */ -int utc; -int utc_b; -int utcsign; - -/* Globals for DURATION values */ -struct icaldurationtype duration; - -/* Globals for RECUR values */ -struct icalrecurrencetype recur; -short skiplist[367]; -short skippos; - -void copy_list(short* array, size_t size); -void clear_recur(); -void add_prop(icalproperty_kind); -void icalparser_fill_date(struct tm* t, char* dstr); -void icalparser_fill_time(struct tm* t, char* tstr); -void set_value_type(icalvalue_kind kind); -void yyerror(char *s); /* Don't know why I need this.... */ -int yylex(void); /* Or this. */ -void set_parser_value_state(); -struct icaltimetype fill_datetime(char* d, char* t); - - - -/* Set the state of the lexer so it will interpret values ( iCAL - VALUEs, that is, ) correctly. */ - -%} - -%union { - float v_float; - int v_int; - char* v_string; - -} - -%token DIGITS -%token INTNUMBER -%token FLOATNUMBER -%token STRING -%token EOL EQUALS CHARACTER COLON COMMA SEMICOLON TIMESEPERATOR - -%token TRUE FALSE - -%token FREQ BYDAY BYHOUR BYMINUTE BYMONTH BYMONTHDAY BYSECOND BYSETPOS BYWEEKNO -%token BYYEARDAY DAILY MINUTELY MONTHLY SECONDLY WEEKLY HOURLY YEARLY -%token INTERVAL COUNT UNTIL WKST MO SA SU TU WE TH FR - -%token BIT8 ACCEPTED ADD AUDIO BASE64 BINARY BOOLEAN BUSY BUSYTENTATIVE -%token BUSYUNAVAILABLE CALADDRESS CANCEL CANCELLED CHAIR CHILD COMPLETED -%token CONFIDENTIAL CONFIRMED COUNTER DATE DATETIME DECLINECOUNTER DECLINED -%token DELEGATED DISPLAY DRAFT DURATION EMAIL END FINAL FLOAT FREE GREGORIAN -%token GROUP INDIVIDUAL INPROCESS INTEGER NEEDSACTION NONPARTICIPANT -%token OPAQUE OPTPARTICIPANT PARENT PERIOD PRIVATE PROCEDURE PUBLIC PUBLISH -%token RECUR REFRESH REPLY REQPARTICIPANT REQUEST RESOURCE ROOM SIBLING -%token START TENTATIVE TEXT THISANDFUTURE THISANDPRIOR TIME TRANSPAENT -%token UNKNOWN UTCOFFSET XNAME - -%token ALTREP CN CUTYPE DAYLIGHT DIR ENCODING EVENT FBTYPE FMTTYPE LANGUAGE -%token MEMBER PARTSTAT RANGE RELATED RELTYPE ROLE RSVP SENTBY STANDARD URI - -%token TIME_CHAR UTC_CHAR - - -%% - -value: - binary_value - | boolean_value - | date_value - | datetime_value - | duration_value - | period_value - | recur_value - | utcoffset_value - | error { - icalparser_yy_value = 0; - icalparser_clear_flex_input(); - yyclearin; - } - -binary_value: "unimplemented2" - -boolean_value: - TRUE - { icalparser_yy_value = icalvalue_new_boolean(1); } - | FALSE - { icalparser_yy_value = icalvalue_new_boolean(0); } - -date_value: DIGITS - { - struct icaltimetype stm; - - stm = fill_datetime($1,0); - - stm.hour = -1; - stm.minute = -1; - stm.second = -1; - stm.is_utc = 0; - stm.is_date = 1; - - icalparser_yy_value = icalvalue_new_date(stm); - } - -utc_char: - /*empty*/ {utc = 0;} - | UTC_CHAR {utc = 1;} - -/* This is used in the period_value, where there may be two utc characters per rule. */ -utc_char_b: - /*empty*/ {utc_b = 0;} - | UTC_CHAR {utc_b = 1;} - -datetime_value: - DIGITS TIME_CHAR DIGITS utc_char - { - struct icaltimetype stm; - stm = fill_datetime($1, $3); - stm.is_utc = utc; - stm.is_date = 0; - - icalparser_yy_value = - icalvalue_new_datetime(stm); - } - - -/* Duration */ - - -dur_date: dur_day - | dur_day dur_time - -dur_week: DIGITS 'W' - { - duration.weeks = atoi($1); - } - -dur_time: TIME_CHAR dur_hour - { - } - | TIME_CHAR dur_minute - { - } - | TIME_CHAR dur_second - { - } - -dur_hour: DIGITS 'H' - { - duration.hours = atoi($1); - } - | DIGITS 'H' dur_minute - { - duration.hours = atoi($1); - } - -dur_minute: DIGITS 'M' - { - duration.minutes = atoi($1); - } - | DIGITS 'M' dur_second - { - duration.minutes = atoi($1); - } - -dur_second: DIGITS 'S' - { - duration.seconds = atoi($1); - } - -dur_day: DIGITS 'D' - { - duration.days = atoi($1); - } - -dur_prefix: /* empty */ - { - } - | '+' - { - } - | '-' - { - } - -duration_value: dur_prefix 'P' dur_date - { - icalparser_yy_value = icalvalue_new_duration(duration); - memset(&duration,0, sizeof(duration)); - } - | dur_prefix 'P' dur_time - { - icalparser_yy_value = icalvalue_new_duration(duration); - memset(&duration,0, sizeof(duration)); - } - | dur_prefix 'P' dur_week - { - icalparser_yy_value = icalvalue_new_duration(duration); - memset(&duration,0, sizeof(duration)); - } - - -/* Period */ - -period_value: DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b - { - struct icalperiodtype p; - - p.start = fill_datetime($1,$3); - p.start.is_utc = utc; - p.start.is_date = 0; - - - p.end = fill_datetime($6,$8); - p.end.is_utc = utc_b; - p.end.is_date = 0; - - p.duration.days = -1; - p.duration.weeks = -1; - p.duration.hours = -1; - p.duration.minutes = -1; - p.duration.seconds = -1; - - icalparser_yy_value = icalvalue_new_period(p); - } - | DIGITS TIME_CHAR DIGITS utc_char '/' duration_value - { - struct icalperiodtype p; - - p.start = fill_datetime($1,$3); - p.start.is_utc = utc; - p.start.is_date = 0; - - p.end.year = -1; - p.end.month = -1; - p.end.day = -1; - p.end.hour = -1; - p.end.minute = -1; - p.end.second = -1; - - /* The duration_value rule setes the global 'duration' - variable, but it also creates a new value in - icalparser_yy_value. So, free that, then copy - 'duration' into the icalperiodtype struct. */ - - p.duration = icalvalue_get_duration(icalparser_yy_value); - icalvalue_free(icalparser_yy_value); - icalparser_yy_value = 0; - - icalparser_yy_value = icalvalue_new_period(p); - - } - - - -/* Recur */ - -recur_start: - FREQ EQUALS SECONDLY {clear_recur();recur.freq = ICAL_SECONDLY_RECURRENCE;} - | FREQ EQUALS MINUTELY {clear_recur();recur.freq = ICAL_MINUTELY_RECURRENCE;} - | FREQ EQUALS HOURLY {clear_recur();recur.freq = ICAL_HOURLY_RECURRENCE;} - | FREQ EQUALS DAILY {clear_recur();recur.freq = ICAL_DAILY_RECURRENCE;} - | FREQ EQUALS WEEKLY {clear_recur();recur.freq = ICAL_WEEKLY_RECURRENCE;} - | FREQ EQUALS MONTHLY {clear_recur();recur.freq = ICAL_MONTHLY_RECURRENCE;} - | FREQ EQUALS YEARLY {clear_recur();recur.freq = ICAL_YEARLY_RECURRENCE;} - ; - - -weekday: - SU { skiplist[skippos]=ICAL_SUNDAY_WEEKDAY; if( skippos<8) skippos++;} - | MO { skiplist[skippos]=ICAL_MONDAY_WEEKDAY;if( skippos<8) skippos++;} - | TU { skiplist[skippos]=ICAL_TUESDAY_WEEKDAY;if( skippos<8) skippos++;} - | WE { skiplist[skippos]=ICAL_WEDNESDAY_WEEKDAY;if( skippos<8) skippos++;} - | TH { skiplist[skippos]=ICAL_THURSDAY_WEEKDAY;if( skippos<8) skippos++;} - | FR { skiplist[skippos]=ICAL_FRIDAY_WEEKDAY;if( skippos<8) skippos++;} - | SA { skiplist[skippos]=ICAL_SATURDAY_WEEKDAY;if( skippos<8) skippos++;} - ; - - -weekday_list: - weekday - | DIGITS weekday { } /* HACK Incorectly handles int in BYDAY */ - | weekday_list COMMA weekday - - -recur_list: - DIGITS { skiplist[skippos] = atoi($1); skippos++;} - | recur_list COMMA DIGITS { skiplist[skippos] = atoi($3); if (skippos<367) skippos++;} - ; - -recur_skip: - INTERVAL EQUALS DIGITS {recur.interval = atoi($3);} - | WKST EQUALS SU {recur.week_start = ICAL_SUNDAY_WEEKDAY;} - | WKST EQUALS MO {recur.week_start = ICAL_MONDAY_WEEKDAY;} - | WKST EQUALS TU {recur.week_start = ICAL_TUESDAY_WEEKDAY;} - | WKST EQUALS WE {recur.week_start = ICAL_WEDNESDAY_WEEKDAY;} - | WKST EQUALS TH {recur.week_start = ICAL_THURSDAY_WEEKDAY;} - | WKST EQUALS FR {recur.week_start = ICAL_FRIDAY_WEEKDAY;} - | WKST EQUALS SA {recur.week_start = ICAL_SATURDAY_WEEKDAY;} - | BYSECOND EQUALS recur_list{copy_list(recur.by_second,60);} - | BYMINUTE EQUALS recur_list{copy_list(recur.by_minute,60);} - | BYHOUR EQUALS recur_list{copy_list(recur.by_hour,24);} - | BYDAY EQUALS weekday_list{copy_list(recur.by_day,7);} - | BYMONTH EQUALS recur_list{copy_list(recur.by_month,12);} - | BYMONTHDAY EQUALS recur_list{copy_list(recur.by_month_day,31);} - | BYYEARDAY EQUALS recur_list{copy_list(recur.by_year_day,366);} - | BYWEEKNO EQUALS recur_list{copy_list(recur.by_week_no,53);} - | BYSETPOS EQUALS recur_list{copy_list(recur.by_set_pos,366);} - | UNTIL EQUALS datetime_value - { recur.until = icalvalue_get_datetime(icalparser_yy_value); - icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;} - | UNTIL EQUALS date_value - { recur.until = icalvalue_get_date(icalparser_yy_value); - icalvalue_free(icalparser_yy_value); icalparser_yy_value=0;} - | COUNT EQUALS DIGITS - { recur.count = atoi($3); } - ; - -recur_skip_list: - /* empty */ - | recur_skip_list SEMICOLON recur_skip - -recur_value: - recur_start recur_skip_list - { icalparser_yy_value = icalvalue_new_recur(recur); } - - - -/* UTC Offset */ - -plusminus: '+' { utcsign = 1; } - | '-' { utcsign = -1; } - -utcoffset_value: - plusminus INTNUMBER INTNUMBER - { - icalparser_yy_value = icalvalue_new_utcoffset( utcsign * ($2*3600) + ($3*60) ); - } - - | plusminus INTNUMBER INTNUMBER INTNUMBER - { - icalparser_yy_value = icalvalue_new_utcoffset(utcsign * ($2*3600) + ($3*60) +($4)); - } - - - -%% - - -void clear_recur() -{ - memset(&skiplist, ICAL_RECURRENCE_ARRAY_MAX_BYTE, sizeof(skiplist)); - skippos = 0; - - icalrecurrencetype_clear(&recur); -} - -void copy_list(short* array, size_t size) -{ - memcpy(array, skiplist, size*sizeof(short)); - memset(&skiplist,ICAL_RECURRENCE_ARRAY_MAX_BYTE, sizeof(skiplist)); - skippos = 0; -} - -struct icaltimetype fill_datetime(char* datestr, char* timestr) -{ - struct icaltimetype stm; - - memset(&stm,0,sizeof(stm)); - - if (datestr != 0){ - sscanf(datestr,"%4d%2d%2d",&(stm.year), &(stm.month), - &(stm.day)); - } - - if (timestr != 0){ - sscanf(timestr,"%2d%2d%2d", &(stm.hour), &(stm.minute), - &(stm.second)); - } - - return stm; - -} - -void yyerror(char* s) -{ - /*fprintf(stderr,"Parse error \'%s\'\n", s);*/ -} - diff --git a/libical/src/libical/icalmemory.c b/libical/src/libical/icalmemory.c deleted file mode 100644 index 7d99eb62b3..0000000000 --- a/libical/src/libical/icalmemory.c +++ /dev/null @@ -1,239 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalmemory.c - CREATOR: eric 30 June 1999 - - $Id$ - $Locker$ - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is icalmemory.h - The Initial Developer of the Original Code is Eric Busboom - - (C) COPYRIGHT 1999 The Software Studio. - http://www.softwarestudio.org - - ======================================================================*/ - -/* libical often passes strings back to the caller. To make these - * interfaces simple, I did not want the caller to have to pass in a - * memory buffer, but having libical pass out newly allocated memory - * makes it difficult to de-allocate the memory. - * - * The ring buffer in this scheme makes it possible for libical to pass - * out references to memory which the caller does not own, and be able - * to de-allocate the memory later. The ring allows libical to have - * several buffers active simultaneously, which is handy when creating - * string representations of components. */ - - -#define ICALMEMORY_C - -#include "icalmemory.h" -#include "icalerror.h" - -#include /* for printf (debugging) */ -#include /* for malloc, realloc */ - -#define BUFFER_RING_SIZE 25 -#define MIN_BUFFER_SIZE 200 - -void* buffer_ring[BUFFER_RING_SIZE+1]; -int buffer_pos = 0; -int initialized = 0; - -/* Create a new temporary buffer on the ring. Libical owns these and wil deallocate them. */ -void* -icalmemory_tmp_buffer (size_t size) -{ - void *rtrn; - /* I don't think I need this -- I think static arrays are - initialized to 0 as a standard part of C, but I am not sure. */ - - if (initialized == 0){ - int i; - for(i=0; i BUFFER_RING_SIZE){ - buffer_pos = 0; - } - - return rtrn; -} - -void icalmemory_free_ring() -{ - - int i; - for(i=0; i (size_t) *buf_size ) { - - - *buf_size = (*buf_size) * 2 + final_length; - - new_buf = realloc(*buf,*buf_size); - - new_pos = (void*)((size_t)new_buf + data_length); - - *pos = new_pos; - *buf = new_buf; - } - - strcpy(*pos, string); - - *pos += string_length; -} - - -void -icalmemory_append_char(char** buf, char** pos, size_t* buf_size, - char ch) -{ - char *new_buf; - char *new_pos; - - size_t data_length, final_length; - -#ifndef ICAL_NO_INTERNAL_DEBUG - icalerror_check_arg_rv( (buf!=0),"buf"); - icalerror_check_arg_rv( (*buf!=0),"*buf"); - icalerror_check_arg_rv( (pos!=0),"pos"); - icalerror_check_arg_rv( (*pos!=0),"*pos"); - icalerror_check_arg_rv( (buf_size!=0),"buf_size"); - icalerror_check_arg_rv( (*buf_size!=0),"*buf_size"); -#endif - - data_length = (size_t)*pos - (size_t)*buf; - - final_length = data_length + 2; - - if ( final_length > (size_t) *buf_size ) { - - - *buf_size = (*buf_size) * 2 + final_length +1; - - new_buf = realloc(*buf,*buf_size); - - new_pos = (void*)((size_t)new_buf + data_length); - - *pos = new_pos; - *buf = new_buf; - } - - **pos = ch; - *pos += 1; - -} diff --git a/libical/src/libical/icalmemory.h b/libical/src/libical/icalmemory.h deleted file mode 100644 index 26d22b7316..0000000000 --- a/libical/src/libical/icalmemory.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalmemory.h - CREATOR: eric 30 June 1999 - - - $Id$ - $Locker$ - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is icalmemory.h - The Initial Developer of the Original Code is Eric Busboom - - (C) COPYRIGHT 1999 The Software Studio. - http://www.softwarestudio.org - -======================================================================*/ - -#ifndef ICALMEMORY_H -#define ICALMEMORY_H - -#include /* for size_t */ - -/* Tmp buffers are managed by ical. References can be returned to the caller, although the caller will not own the memory. */ - -void* icalmemory_tmp_buffer(size_t size); -char* icalmemory_tmp_copy(char* str); - -/* Add an externally allocated buffer to the ring. */ -void icalmemory_add_tmp_buffer(void*); - - -/* Free all memory used in the ring */ -void icalmemory_free_ring(); - -/* Non-tmp buffers must be freed. These are mostly wrappers around - * malloc, etc, but are used so the caller can change the memory - * allocators in a future version of the library */ - -void* icalmemory_new_buffer(size_t size); -void* icalmemory_resize_buffer(void* buf, size_t size); -void icalmemory_free_buffer(void* buf); - -/* icalmemory_append_string will copy the string 'string' to the - buffer 'buf' starting at position 'pos', reallocing 'buf' if it is - too small. 'buf_size' is the size of 'buf' and will be changed if - 'buf' is reallocated. 'pos' will point to the last byte of the new - string in 'buf', usually a '\0' */ - -/* THESE ROUTINES CAN NOT BE USED ON TMP BUFFERS. Only use them on - normally allocated memory, or on buffers created from - icalmemory_new_buffer, never with buffers created by - icalmemory_tmp_buffer. If icalmemory_append_string has to resize a - buffer on the ring, the ring will loose track of it an you will - have memory problems. */ - -void icalmemory_append_string(char** buf, char** pos, size_t* buf_size, - char* string); - -/* icalmemory_append_char is similar, but is appends a character instead of a string */ -void icalmemory_append_char(char** buf, char** pos, size_t* buf_size, - char ch); - -#endif /* !ICALMEMORY_H */ - - - diff --git a/libical/src/libical/icalparameter.c b/libical/src/libical/icalparameter.c deleted file mode 100644 index ff9c76f79c..0000000000 --- a/libical/src/libical/icalparameter.c +++ /dev/null @@ -1,1887 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalderivedparameters.{c,h} - CREATOR: eric 09 May 1999 - - $Id$ - $Locker$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalderivedparameters.{c,h} - - Contributions from: - Graham Davison (g.m.davison@computer.org) - - ======================================================================*/ - -#include "ical.h" -#include "icalerror.h" -#include /* for malloc() */ -#include -#include /* for memset() */ -#include "icalmemory.h" - -struct icalparameter_impl -{ - icalparameter_kind kind; - char id[5]; - int size; - char* string; - char* x_name; - icalproperty* parent; - - union data { - int v_int; - int v_rsvp; - icalparameter_cutype v_cutype; - icalparameter_encoding v_encoding; - icalparameter_fbtype v_fbtype; - icalparameter_partstat v_partstat; - icalparameter_range v_range; - icalparameter_related v_related; - icalparameter_reltype v_reltype; - icalparameter_role v_role; - icalparameter_value v_value; - icalparameter_xlicerrortype v_xlicerrortype; - icalparameter_xliccomparetype v_xliccomparetype; - } data; -}; - -struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind) -{ - struct icalparameter_impl* v; - - if ( ( v = (struct icalparameter_impl*) - malloc(sizeof(struct icalparameter_impl))) == 0) { - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - errno = ENOMEM; - return 0; - } - - strcpy(v->id,"para"); - - v->kind = kind; - v->size = 0; - v->string = 0; - v->x_name = 0; - v->parent = 0; - memset(&(v->data),0,sizeof(v->data)); - - return v; -} - -icalparameter* -icalparameter_new (icalparameter_kind kind) -{ - struct icalparameter_impl* v = icalparameter_new_impl(kind); - - return (icalparameter*) v; - -} - -icalparameter* -icalparameter_new_clone(icalparameter* param) -{ - struct icalparameter_impl *old; - struct icalparameter_impl *new; - - old = (struct icalparameter_impl *)param; - new = icalparameter_new_impl(old->kind); - - icalerror_check_arg_rz((param!=0),"param"); - - if (new == 0){ - return 0; - } - - memcpy(new,old,sizeof(struct icalparameter_impl)); - - if (old->string != 0){ - new->string = strdup(old->string); - if (new->string == 0){ - icalparameter_free(new); - return 0; - } - } - - if (old->x_name != 0){ - new->x_name = strdup(old->x_name); - if (new->x_name == 0){ - icalparameter_free(new); - return 0; - } - } - - return new; -} - - -icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val) -{ - - icalparameter* param=0; - - icalerror_check_arg_rz((val!=0),"val"); - - switch (kind) { - case ICAL_ALTREP_PARAMETER: - { - param = icalparameter_new_altrep(val); - - break; - } - case ICAL_CN_PARAMETER: - { - param = icalparameter_new_cn(val); - - break; - } - case ICAL_CUTYPE_PARAMETER: - { - if(strcmp(val,"INDIVIDUAL") == 0){ - param = icalparameter_new_cutype(ICAL_CUTYPE_INDIVIDUAL); - } - else if(strcmp(val,"GROUP") == 0){ - param = icalparameter_new_cutype(ICAL_CUTYPE_GROUP); - } - else if(strcmp(val,"RESOURCE") == 0){ - param = icalparameter_new_cutype(ICAL_CUTYPE_RESOURCE); - } - else if(strcmp(val,"ROOM") == 0){ - param = icalparameter_new_cutype(ICAL_CUTYPE_ROOM); - } - else if(strcmp(val,"UNKNOWN") == 0){ - param = icalparameter_new_cutype(ICAL_CUTYPE_UNKNOWN); - } - else { - param = icalparameter_new_cutype(ICAL_CUTYPE_XNAME); - icalparameter_set_xvalue(param,val); - } - break; - } - - case ICAL_DELEGATEDFROM_PARAMETER: - { - param = icalparameter_new_delegatedfrom(val); - - break; - } - case ICAL_DELEGATEDTO_PARAMETER: - { - param = icalparameter_new_delegatedto(val); - - break; - } - case ICAL_DIR_PARAMETER: - { - param = icalparameter_new_dir(val); - - break; - } - case ICAL_ENCODING_PARAMETER: - { - if(strcmp(val,"BIT8") == 0){ - param = icalparameter_new_encoding(ICAL_ENCODING_8BIT); - } - else if(strcmp(val,"BASE64") == 0){ - param = icalparameter_new_encoding(ICAL_ENCODING_BASE64); - } - else { - param = icalparameter_new_encoding(ICAL_ENCODING_XNAME); - icalparameter_set_xvalue(param,val); - } - break; - } - case ICAL_FBTYPE_PARAMETER: - { - if(strcmp(val,"FREE") == 0){ - param = icalparameter_new_fbtype(ICAL_FBTYPE_FREE); - } - else if(strcmp(val,"BUSY") == 0){ - param = icalparameter_new_fbtype(ICAL_FBTYPE_BUSY); - } - else if(strcmp(val,"BUSYUNAVAILABLE") == 0){ - param = icalparameter_new_fbtype(ICAL_FBTYPE_BUSYUNAVAILABLE); - } - else if(strcmp(val,"BUSYTENTATIVE") == 0){ - param = icalparameter_new_fbtype(ICAL_FBTYPE_BUSYTENTATIVE); - } - else { - param = icalparameter_new_fbtype(ICAL_FBTYPE_XNAME); - icalparameter_set_xvalue(param,val); - } - break; - } - case ICAL_FMTTYPE_PARAMETER: - { - param = icalparameter_new_fmttype(val); - break; - } - case ICAL_LANGUAGE_PARAMETER: - { - param = icalparameter_new_language(val); - - break; - } - case ICAL_MEMBER_PARAMETER: - { - param = icalparameter_new_member(val); - - break; - } - case ICAL_PARTSTAT_PARAMETER: - { - if(strcmp(val,"NEEDSACTION") == 0){ - param = icalparameter_new_partstat(ICAL_PARTSTAT_NEEDSACTION); - } - else if(strcmp(val,"ACCEPTED") == 0){ - param = icalparameter_new_partstat(ICAL_PARTSTAT_ACCEPTED); - } - else if(strcmp(val,"DECLINED") == 0){ - param = icalparameter_new_partstat(ICAL_PARTSTAT_DECLINED); - } - else if(strcmp(val,"TENTATIVE") == 0){ - param = icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE); - } - else if(strcmp(val,"DELEGATED") == 0){ - param = icalparameter_new_partstat(ICAL_PARTSTAT_DELEGATED); - } - else if(strcmp(val,"COMPLETED") == 0){ - param = icalparameter_new_partstat(ICAL_PARTSTAT_COMPLETED); - } - else if(strcmp(val,"INPROCESS") == 0){ - param = icalparameter_new_partstat(ICAL_PARTSTAT_INPROCESS); - } - else { - param = icalparameter_new_partstat(ICAL_PARTSTAT_XNAME); - icalparameter_set_xvalue(param,val); - } - break; - } - case ICAL_RANGE_PARAMETER: - { - if(strcmp(val,"THISANDFUTURE") == 0){ - param = icalparameter_new_range(ICAL_RANGE_THISANDFUTURE); - } - else if(strcmp(val,"THISANDPRIOR") == 0){ - param = icalparameter_new_range(ICAL_RANGE_THISANDPRIOR); - } - - break; - } - case ICAL_RELATED_PARAMETER: - { - if(strcmp(val,"START") == 0){ - param = icalparameter_new_related(ICAL_RELATED_START); - } - else if(strcmp(val,"END") == 0){ - param = icalparameter_new_related(ICAL_RELATED_END); - } - - break; - } - case ICAL_RELTYPE_PARAMETER: - { - if(strcmp(val,"PARENT") == 0){ - param = icalparameter_new_reltype(ICAL_RELTYPE_PARENT); - } - else if(strcmp(val,"CHILD") == 0){ - param = icalparameter_new_reltype(ICAL_RELTYPE_CHILD); - } - else if(strcmp(val,"SIBLING") == 0){ - param = icalparameter_new_reltype(ICAL_RELTYPE_SIBLING); - } - else { - param = icalparameter_new_reltype(ICAL_RELTYPE_XNAME); - icalparameter_set_xvalue(param,val); - } - break; - } - case ICAL_ROLE_PARAMETER: - { - if(strcmp(val,"CHAIR") == 0){ - param = icalparameter_new_role(ICAL_ROLE_CHAIR); - } - else if(strcmp(val,"REQ-PARTICIPANT") == 0){ - param = icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT); - } - else if(strcmp(val,"OPT-PARTICIPANT") == 0){ - param = icalparameter_new_role(ICAL_ROLE_OPTPARTICIPANT); - } - else if(strcmp(val,"NON-PARTICIPANT") == 0){ - param = icalparameter_new_role(ICAL_ROLE_NONPARTICIPANT); - } - else { - param = icalparameter_new_role(ICAL_ROLE_XNAME); - icalparameter_set_xvalue(param,val); - } - break; - } - case ICAL_RSVP_PARAMETER: - { - if(strcmp(val,"TRUE") == 0){ - param = icalparameter_new_rsvp(1); - } - else if(strcmp(val,"FALSE") == 0){ - param = icalparameter_new_rsvp(0); - } - - break; - } - case ICAL_SENTBY_PARAMETER: - { - param = icalparameter_new_sentby(val); - - break; - } - case ICAL_TZID_PARAMETER: - { - param = icalparameter_new_tzid(val); - - break; - } - case ICAL_VALUE_PARAMETER: - { - if(strcmp(val,"BINARY") == 0){ - param = icalparameter_new_value(ICAL_VALUE_BINARY); - } - else if(strcmp(val,"BOOLEAN") == 0){ - param = icalparameter_new_value(ICAL_VALUE_BOOLEAN); - } - else if(strcmp(val,"CAL-ADDRESS") == 0){ - param = icalparameter_new_value(ICAL_VALUE_CALADDRESS); - } - else if(strcmp(val,"DATE") == 0){ - param = icalparameter_new_value(ICAL_VALUE_DATE); - } - else if(strcmp(val,"DATE-TIME") == 0){ - param = icalparameter_new_value(ICAL_VALUE_DATETIME); - } - else if(strcmp(val,"DURATION") == 0){ - param = icalparameter_new_value(ICAL_VALUE_DURATION); - } - else if(strcmp(val,"FLOAT") == 0){ - param = icalparameter_new_value(ICAL_VALUE_FLOAT); - } - else if(strcmp(val,"INTEGER") == 0){ - param = icalparameter_new_value(ICAL_VALUE_INTEGER); - } - else if(strcmp(val,"PERIOD") == 0){ - param = icalparameter_new_value(ICAL_VALUE_PERIOD); - } - else if(strcmp(val,"RECUR") == 0){ - param = icalparameter_new_value(ICAL_VALUE_RECUR); - } - else if(strcmp(val,"TEXT") == 0){ - param = icalparameter_new_value(ICAL_VALUE_TEXT); - } - else if(strcmp(val,"TIME") == 0){ - param = icalparameter_new_value(ICAL_VALUE_TIME); - } - else if(strcmp(val,"URI") == 0){ - param = icalparameter_new_value(ICAL_VALUE_URI); - } - else if(strcmp(val,"UTC-OFFSET") == 0){ - param = icalparameter_new_value(ICAL_VALUE_UTCOFFSET); - } - else { - param = 0; - } - break; - } - case ICAL_XLICERRORTYPE_PARAMETER: - { - - if(strcmp(val,"COMPONENT_PARSE_ERROR") == 0){ - param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); - } - else if(strcmp(val,"PROPERTY_PARSE_ERROR") == 0){ - param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_PROPERTYPARSEERROR); - } - else if(strcmp(val,"PARAMETER_PARSE_ERROR") == 0){ - param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_PARAMETERPARSEERROR); - } - else if(strcmp(val,"VALUE_PARSE_ERROR") == 0){ - param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_VALUEPARSEERROR); - } - else if(strcmp(val,"INVALID_ITIP") == 0){ - param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP); - } - break; - } - case ICAL_X_PARAMETER: - { - param = icalparameter_new(ICAL_FBTYPE_PARAMETER); - icalparameter_set_xvalue(param,val); - break; - } - - case ICAL_NO_PARAMETER: - default: - { - return 0; - } - - - } - - return param; -} - -void -icalparameter_free (icalparameter* parameter) -{ - struct icalparameter_impl * impl; - - impl = (struct icalparameter_impl*)parameter; - -/* HACK. This always triggers, even when parameter is non-zero - icalerror_check_arg_rv((parameter==0),"parameter");*/ - - -#ifdef ICAL_FREE_ON_LIST_IS_ERROR - icalerror_assert( (impl->parent ==0),"Tried to free a parameter that is still attached to a component. "); - -#else - if(impl->parent !=0){ - return; - } -#endif - - - if (impl->string != 0){ - free (impl->string); - } - - if (impl->x_name != 0){ - free (impl->x_name); - } - - memset(impl,0,sizeof(impl)); - - impl->parent = 0; - impl->id[0] = 'X'; - free(impl); -} - - -char no_parameter[]="Error: No Parameter"; -char* -icalparameter_as_ical_string (icalparameter* parameter) -{ - struct icalparameter_impl* impl; - size_t buf_size = 1024; - char* buf; - char* buf_ptr; - char *out_buf; - char *kind_string; - - char tend[1024]; /* HACK . Should be using memory buffer ring */ - - icalerror_check_arg_rz( (parameter!=0), "parameter"); - - /* Create new buffer that we can append names, parameters and a - value to, and reallocate as needed. Later, this buffer will be - copied to a icalmemory_tmp_buffer, which is managed internally - by libical, so it can be given to the caller without fear of - the caller forgetting to free it */ - - buf = icalmemory_new_buffer(buf_size); - buf_ptr = buf; - impl = (struct icalparameter_impl*)parameter; - - kind_string = icalenum_parameter_kind_to_string(impl->kind); - - if (impl->kind == ICAL_NO_PARAMETER || - impl->kind == ICAL_ANY_PARAMETER || - kind_string == 0) - { - icalerror_set_errno(ICAL_BADARG_ERROR); - return 0; - } - - /* Put the parameter name into the string */ - icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "="); - - switch (impl->kind) { - case ICAL_CUTYPE_PARAMETER: - { - switch (impl->data.v_cutype) { - case ICAL_CUTYPE_INDIVIDUAL: { - strcpy(tend,"INDIVIDUAL");break; - } - case ICAL_CUTYPE_GROUP:{ - strcpy(tend,"GROUP");break; - } - case ICAL_CUTYPE_RESOURCE: { - strcpy(tend,"RESOURCE");break; - } - case ICAL_CUTYPE_ROOM:{ - strcpy(tend,"ROOM");break; - } - case ICAL_CUTYPE_UNKNOWN:{ - strcpy(tend,"UNKNOWN");break; - } - case ICAL_CUTYPE_XNAME:{ - if (impl->string == 0){ return no_parameter;} - strcpy(tend,impl->string);break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - - } - case ICAL_ENCODING_PARAMETER: - { - switch (impl->data.v_encoding) { - case ICAL_ENCODING_8BIT: { - strcpy(tend,"8BIT");break; - } - case ICAL_ENCODING_BASE64:{ - strcpy(tend,"BASE64");break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - } - - case ICAL_FBTYPE_PARAMETER: - { - switch (impl->data.v_fbtype) { - case ICAL_FBTYPE_FREE:{ - strcpy(tend,"FREE");break; - } - case ICAL_FBTYPE_BUSY: { - strcpy(tend,"BUSY");break; - } - case ICAL_FBTYPE_BUSYUNAVAILABLE:{ - strcpy(tend,"BUSYUNAVAILABLE");break; - } - case ICAL_FBTYPE_BUSYTENTATIVE:{ - strcpy(tend,"BUSYTENTATIVE");break; - } - case ICAL_FBTYPE_XNAME:{ - if (impl->string == 0){ return no_parameter;} - strcpy(tend,impl->string);break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - - } - case ICAL_PARTSTAT_PARAMETER: - { - switch (impl->data.v_partstat) { - case ICAL_PARTSTAT_NEEDSACTION: { - strcpy(tend,"NEEDSACTION");break; - } - case ICAL_PARTSTAT_ACCEPTED: { - strcpy(tend,"ACCEPTED");break; - } - case ICAL_PARTSTAT_DECLINED:{ - strcpy(tend,"DECLINED");break; - } - case ICAL_PARTSTAT_TENTATIVE:{ - strcpy(tend,"TENTATIVE");break; - } - case ICAL_PARTSTAT_DELEGATED:{ - strcpy(tend,"DELEGATED");break; - } - case ICAL_PARTSTAT_COMPLETED:{ - strcpy(tend,"COMPLETED");break; - } - case ICAL_PARTSTAT_INPROCESS:{ - strcpy(tend,"INPROCESS");break; - } - case ICAL_PARTSTAT_XNAME:{ - if (impl->string == 0){ return no_parameter;} - strcpy(tend,impl->string);break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - - } - case ICAL_RANGE_PARAMETER: - { - switch (impl->data.v_range) { - case ICAL_RANGE_THISANDPRIOR: { - strcpy(tend,"THISANDPRIOR");break; - } - case ICAL_RANGE_THISANDFUTURE: { - strcpy(tend,"THISANDFUTURE");break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - } - case ICAL_RELATED_PARAMETER: - { - switch (impl->data.v_related) { - case ICAL_RELATED_START: { - strcpy(tend,"START");break; - } - case ICAL_RELATED_END: { - strcpy(tend,"END");break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - } - case ICAL_RELTYPE_PARAMETER: - { - switch (impl->data.v_reltype) { - case ICAL_RELTYPE_PARENT: { - strcpy(tend,"PARENT");break; - } - case ICAL_RELTYPE_CHILD:{ - strcpy(tend,"CHILD");break; - } - case ICAL_RELTYPE_SIBLING:{ - strcpy(tend,"SIBLING");break; - } - case ICAL_RELTYPE_XNAME:{ - if (impl->string == 0){ return no_parameter;} - strcpy(tend,impl->string);break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - } - case ICAL_ROLE_PARAMETER: - { - switch (impl->data.v_role) { - case ICAL_ROLE_CHAIR: { - strcpy(tend,"CHAIR");break; - } - case ICAL_ROLE_REQPARTICIPANT: { - strcpy(tend,"REQ-PARTICIPANT");break; - } - case ICAL_ROLE_OPTPARTICIPANT: { - strcpy(tend,"OPT-PARTICIPANT");break; - } - case ICAL_ROLE_NONPARTICIPANT: { - strcpy(tend,"NON-PARTICIPANT");break; - } - case ICAL_ROLE_XNAME:{ - if (impl->string == 0){ return no_parameter;} - strcpy(tend,impl->string);break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - } - case ICAL_RSVP_PARAMETER: - { - switch (impl->data.v_rsvp) { - case 1: { - strcpy(tend,"TRUE");break; - } - case 0: { - strcpy(tend,"FALSE");break; - } - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - } - case ICAL_VALUE_PARAMETER: - { - switch (impl->data.v_value) { - case ICAL_VALUE_BINARY: { - strcpy(tend,"BINARY");break; - } - case ICAL_VALUE_BOOLEAN: { - strcpy(tend,"BOOLEAN");break; - } - case ICAL_VALUE_CALADDRESS: { - strcpy(tend,"CAL-ADDRESS");break; - } - case ICAL_VALUE_DATE: { - strcpy(tend,"DATE");break; - } - case ICAL_VALUE_DATETIME: { - strcpy(tend,"DATE-TIME");break; - } - case ICAL_VALUE_DURATION: { - strcpy(tend,"DURATION");break; - } - case ICAL_VALUE_FLOAT: { - strcpy(tend,"FLOAT");break; - } - case ICAL_VALUE_INTEGER: { - strcpy(tend,"INTEGER");break; - } - case ICAL_VALUE_PERIOD: { - strcpy(tend,"PERIOD");break; - } - case ICAL_VALUE_RECUR: { - strcpy(tend,"RECUR");break; - } - case ICAL_VALUE_TEXT: { - strcpy(tend,"TEXT");break; - } - case ICAL_VALUE_TIME: { - strcpy(tend,"TIME");break; - } - case ICAL_VALUE_URI: { - strcpy(tend,"URI");break; - } - case ICAL_VALUE_UTCOFFSET: { - strcpy(tend,"UTC-OFFSET");break; - } - case ICAL_VALUE_XNAME: { - if (impl->string == 0){ return no_parameter;} - strcpy(tend,impl->string);break; - } - default:{ - strcpy(tend,"ERROR");break; - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - } - break; - } - - - case ICAL_XLICERRORTYPE_PARAMETER: - { - switch (impl->data.v_xlicerrortype) { - case ICAL_XLICERRORTYPE_COMPONENTPARSEERROR: - { - strcpy(tend,"COMPONENT_PARSE_ERROR");break; - } - case ICAL_XLICERRORTYPE_PROPERTYPARSEERROR: - { - strcpy(tend,"PROPERTY_PARSE_ERROR");break; - } - case ICAL_XLICERRORTYPE_PARAMETERPARSEERROR: - { - strcpy(tend,"PARAMETER_PARSE_ERROR");break; - } - case ICAL_XLICERRORTYPE_VALUEPARSEERROR: - { - strcpy(tend,"VALUE_PARSE_ERROR");break; - } - case ICAL_XLICERRORTYPE_INVALIDITIP: - { - strcpy(tend,"INVALID_ITIP");break; - } - } - break; - } - - case ICAL_XLICCOMPARETYPE_PARAMETER: - { - switch (impl->data.v_xliccomparetype) { - case ICAL_XLICCOMPARETYPE_EQUAL: - { - strcpy(tend,"EQUAL");break; - } - case ICAL_XLICCOMPARETYPE_NOTEQUAL: - { - strcpy(tend,"NOTEQUAL");break; - } - case ICAL_XLICCOMPARETYPE_LESS: - { - strcpy(tend,"LESS");break; - } - case ICAL_XLICCOMPARETYPE_GREATER: - { - strcpy(tend,"GREATER");break; - } - case ICAL_XLICCOMPARETYPE_LESSEQUAL: - { - strcpy(tend,"LESSEQUAL");break; - } - case ICAL_XLICCOMPARETYPE_GREATEREQUAL: - { - strcpy(tend,"GREATEREQUAL");break; - } - case ICAL_XLICCOMPARETYPE_REGEX: - { - strcpy(tend,"REGEX");break; - } - break; - } - - default:{ - icalerror_set_errno(ICAL_BADARG_ERROR);break; - } - break; - } - - - case ICAL_SENTBY_PARAMETER: - case ICAL_TZID_PARAMETER: - case ICAL_X_PARAMETER: - case ICAL_FMTTYPE_PARAMETER: - case ICAL_LANGUAGE_PARAMETER: - case ICAL_MEMBER_PARAMETER: - case ICAL_DELEGATEDFROM_PARAMETER: - case ICAL_DELEGATEDTO_PARAMETER: - case ICAL_DIR_PARAMETER: - case ICAL_ALTREP_PARAMETER: - case ICAL_CN_PARAMETER: - { - if (impl->string == 0){ return no_parameter;} - strcpy(tend,impl->string);break; - break; - } - - case ICAL_NO_PARAMETER: - case ICAL_ANY_PARAMETER: - { - /* These are actually handled before the case/switch - clause */ - } - - } - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, tend); - - /* Now, copy the buffer to a tmp_buffer, which is safe to give to - the caller without worring about de-allocating it. */ - - - out_buf = icalmemory_tmp_buffer(strlen(buf)); - strcpy(out_buf, buf); - - icalmemory_free_buffer(buf); - - return out_buf; - -} - - -int -icalparameter_is_valid (icalparameter* parameter); - - -icalparameter_kind -icalparameter_isa (icalparameter* parameter) -{ - if(parameter == 0){ - return ICAL_NO_PARAMETER; - } - - return ((struct icalparameter_impl *)parameter)->kind; -} - - -int -icalparameter_isa_parameter (void* parameter) -{ - struct icalparameter_impl *impl = (struct icalparameter_impl *)parameter; - - if (parameter == 0){ - return 0; - } - - if (strcmp(impl->id,"para") == 0) { - return 1; - } else { - return 0; - } -} - - -void -icalparameter_set_xname (icalparameter* param, char* v) -{ - struct icalparameter_impl *impl = (struct icalparameter_impl*)param; - icalerror_check_arg_rv( (param!=0),"param"); - icalerror_check_arg_rv( (v!=0),"v"); - - if (impl->x_name != 0){ - free(impl->x_name); - } - - impl->x_name = strdup(v); - - if (impl->x_name == 0){ - errno = ENOMEM; - } - -} - -char* -icalparameter_get_xname (icalparameter* param) -{ - struct icalparameter_impl *impl = (struct icalparameter_impl*)param; - icalerror_check_arg_rz( (param!=0),"param"); - - return impl->x_name; -} - -void -icalparameter_set_xvalue (icalparameter* param, char* v) -{ - struct icalparameter_impl *impl = (struct icalparameter_impl*)param; - - icalerror_check_arg_rv( (param!=0),"param"); - icalerror_check_arg_rv( (v!=0),"v"); - - if (impl->string != 0){ - free(impl->string); - } - - impl->string = strdup(v); - - if (impl->string == 0){ - errno = ENOMEM; - } - -} - -char* -icalparameter_get_xvalue (icalparameter* param) -{ - struct icalparameter_impl *impl = (struct icalparameter_impl*)param; - - icalerror_check_arg_rz( (param!=0),"param"); - - return impl->string; - -} - -void icalparameter_set_parent(icalparameter* param, - icalproperty* property) -{ - struct icalparameter_impl *impl = (struct icalparameter_impl*)param; - - icalerror_check_arg_rv( (param!=0),"param"); - - impl->parent = property; -} - -icalproperty* icalparameter_get_parent(icalparameter* param) -{ - struct icalparameter_impl *impl = (struct icalparameter_impl*)param; - - icalerror_check_arg_rv( (param!=0),"param"); - - return impl->parent; -} - - -/* Everything below this line is machine generated. Do not edit. */ -/* ALTREP */ -icalparameter* icalparameter_new_altrep(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_ALTREP_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_altrep((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_altrep(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_altrep(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* CN */ -icalparameter* icalparameter_new_cn(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_CN_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_cn((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_cn(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_cn(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* CUTYPE */ -icalparameter* icalparameter_new_cutype(icalparameter_cutype v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_CUTYPE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_cutype((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_cutype icalparameter_get_cutype(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_CUTYPE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_cutype; - -} - -void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_cutype = v; -} - -/* DELEGATED-FROM */ -icalparameter* icalparameter_new_delegatedfrom(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_DELEGATEDFROM_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_delegatedfrom((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_delegatedfrom(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_delegatedfrom(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* DELEGATED-TO */ -icalparameter* icalparameter_new_delegatedto(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_DELEGATEDTO_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_delegatedto((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_delegatedto(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_delegatedto(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* DIR */ -icalparameter* icalparameter_new_dir(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_DIR_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_dir((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_dir(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_dir(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* ENCODING */ -icalparameter* icalparameter_new_encoding(icalparameter_encoding v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_ENCODING_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_encoding((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_encoding icalparameter_get_encoding(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_ENCODING_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_encoding; - -} - -void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_encoding = v; -} - -/* FBTYPE */ -icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_FBTYPE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_fbtype((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_fbtype icalparameter_get_fbtype(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_FBTYPE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_fbtype; - -} - -void icalparameter_set_fbtype(icalparameter* param, icalparameter_fbtype v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_fbtype = v; -} - -/* FMTTYPE */ -icalparameter* icalparameter_new_fmttype(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_FMTTYPE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_fmttype((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_fmttype(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_fmttype(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* LANGUAGE */ -icalparameter* icalparameter_new_language(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_LANGUAGE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_language((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_language(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_language(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* MEMBER */ -icalparameter* icalparameter_new_member(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_MEMBER_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_member((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_member(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_member(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* PARTSTAT */ -icalparameter* icalparameter_new_partstat(icalparameter_partstat v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_PARTSTAT_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_partstat((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_partstat icalparameter_get_partstat(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_PARTSTAT_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_partstat; - -} - -void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_partstat = v; -} - -/* RANGE */ -icalparameter* icalparameter_new_range(icalparameter_range v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_RANGE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_range((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_range icalparameter_get_range(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_PARTSTAT_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_range; - -} - -void icalparameter_set_range(icalparameter* param, icalparameter_range v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_range = v; -} - -/* RELATED */ -icalparameter* icalparameter_new_related(icalparameter_related v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_RELATED_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_related((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_related icalparameter_get_related(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_PARTSTAT_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_related; - -} - -void icalparameter_set_related(icalparameter* param, icalparameter_related v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_related = v; -} - -/* RELTYPE */ -icalparameter* icalparameter_new_reltype(icalparameter_reltype v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_RELTYPE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_reltype((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_reltype icalparameter_get_reltype(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_RELTYPE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_reltype; - -} - -void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_reltype = v; -} - -/* ROLE */ -icalparameter* icalparameter_new_role(icalparameter_role v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_ROLE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_role((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_role icalparameter_get_role(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_ROLE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_role; - -} - -void icalparameter_set_role(icalparameter* param, icalparameter_role v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_role = v; -} - -/* RSVP */ -icalparameter* icalparameter_new_rsvp(int v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_RSVP_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_rsvp((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -int icalparameter_get_rsvp(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_ROLE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_rsvp; - -} - -void icalparameter_set_rsvp(icalparameter* param, int v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_rsvp = v; -} - -/* SENT-BY */ -icalparameter* icalparameter_new_sentby(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_SENTBY_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_sentby((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_sentby(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_sentby(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* TZID */ -icalparameter* icalparameter_new_tzid(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_TZID_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_tzid((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_tzid(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_tzid(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* VALUE */ -icalparameter* icalparameter_new_value(icalparameter_value v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_VALUE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_value((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_value icalparameter_get_value(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_VALUE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_value; - -} - -void icalparameter_set_value(icalparameter* param, icalparameter_value v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_value = v; -} - -/* X */ -icalparameter* icalparameter_new_x(char* v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - icalerror_check_arg_rz( (v!=0),"v"); - impl = icalparameter_new_impl(ICAL_X_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_x((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -char* icalparameter_get_x(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg_rz( (param!=0), "param"); - return ((struct icalparameter_impl*)param)->string; -} - -void icalparameter_set_x(icalparameter* param, char* v) -{ - icalerror_check_arg_rz( (v!=0),"v"); - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->string = strdup(v); -} - -/* X-LIC-ERRORTYPE */ -icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_XLICERRORTYPE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_xlicerrortype((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_VALUE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_xlicerrortype; - -} - -void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerrortype v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_xlicerrortype = v; -} - -/* X-LIC-COMPARETYPE */ -icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v) -{ - struct icalparameter_impl *impl; - icalerror_clear_errno(); - - impl = icalparameter_new_impl(ICAL_XLICCOMPARETYPE_PARAMETER); - if (impl == 0) { - return 0; - } - - icalparameter_set_xliccomparetype((icalparameter*) impl,v); - if (icalerrno != ICAL_NO_ERROR) { - icalparameter_free((icalparameter*) impl); - return 0; - } - - return (icalparameter*) impl; -} - -icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* param) -{ - icalerror_clear_errno(); - icalerror_check_arg( (param!=0), "param"); - if ( ((struct icalparameter_impl*)param)->string != 0){ - return ICAL_VALUE_XNAME; - } - - return ((struct icalparameter_impl*)param)->data.v_xliccomparetype; - -} - -void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xliccomparetype v) -{ - - icalerror_check_arg_rv( (param!=0), "param"); - icalerror_clear_errno(); - - ((struct icalparameter_impl*)param)->data.v_xliccomparetype = v; -} - diff --git a/libical/src/libical/icalparameter.h b/libical/src/libical/icalparameter.h deleted file mode 100644 index 174cae6f3f..0000000000 --- a/libical/src/libical/icalparameter.h +++ /dev/null @@ -1,174 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalparam.h - CREATOR: eric 20 March 1999 - - - $Id$ - $Locker$ - - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalparam.h - - ======================================================================*/ - -#ifndef ICALPARAM_H -#define ICALPARAM_H - -#include "icalenums.h" /* defined icalparameter_kind and other enums */ - -typedef void icalparameter; - -icalparameter* icalparameter_new(icalparameter_kind kind); -icalparameter* icalparameter_new_clone(icalparameter* p); -icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* value); - -void icalparameter_free(icalparameter* parameter); - -char* icalparameter_as_ical_string(icalparameter* parameter); - -int icalparameter_is_valid(icalparameter* parameter); - -icalparameter_kind icalparameter_isa(icalparameter* parameter); - -int icalparameter_isa_parameter(void* param); - -/* Acess the name of an X parameer */ -void icalparameter_set_xname (icalparameter* param, char* v); -char* icalparameter_get_xname(icalparameter* param); -void icalparameter_set_xvalue (icalparameter* param, char* v); -char* icalparameter_get_xvalue(icalparameter* param); - - -/* Everything below this line is machine generated. Do not edit. */ -/* ALTREP */ -icalparameter* icalparameter_new_altrep(char* v); -char* icalparameter_get_altrep(icalparameter* value); -void icalparameter_set_altrep(icalparameter* value, char* v); - -/* CN */ -icalparameter* icalparameter_new_cn(char* v); -char* icalparameter_get_cn(icalparameter* value); -void icalparameter_set_cn(icalparameter* value, char* v); - -/* CUTYPE */ -icalparameter* icalparameter_new_cutype(icalparameter_cutype v); -icalparameter_cutype icalparameter_get_cutype(icalparameter* value); -void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v); - -/* DELEGATED-FROM */ -icalparameter* icalparameter_new_delegatedfrom(char* v); -char* icalparameter_get_delegatedfrom(icalparameter* value); -void icalparameter_set_delegatedfrom(icalparameter* value, char* v); - -/* DELEGATED-TO */ -icalparameter* icalparameter_new_delegatedto(char* v); -char* icalparameter_get_delegatedto(icalparameter* value); -void icalparameter_set_delegatedto(icalparameter* value, char* v); - -/* DIR */ -icalparameter* icalparameter_new_dir(char* v); -char* icalparameter_get_dir(icalparameter* value); -void icalparameter_set_dir(icalparameter* value, char* v); - -/* ENCODING */ -icalparameter* icalparameter_new_encoding(icalparameter_encoding v); -icalparameter_encoding icalparameter_get_encoding(icalparameter* value); -void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v); - -/* FBTYPE */ -icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v); -icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value); -void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v); - -/* FMTTYPE */ -icalparameter* icalparameter_new_fmttype(char* v); -char* icalparameter_get_fmttype(icalparameter* value); -void icalparameter_set_fmttype(icalparameter* value, char* v); - -/* LANGUAGE */ -icalparameter* icalparameter_new_language(char* v); -char* icalparameter_get_language(icalparameter* value); -void icalparameter_set_language(icalparameter* value, char* v); - -/* MEMBER */ -icalparameter* icalparameter_new_member(char* v); -char* icalparameter_get_member(icalparameter* value); -void icalparameter_set_member(icalparameter* value, char* v); - -/* PARTSTAT */ -icalparameter* icalparameter_new_partstat(icalparameter_partstat v); -icalparameter_partstat icalparameter_get_partstat(icalparameter* value); -void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v); - -/* RANGE */ -icalparameter* icalparameter_new_range(icalparameter_range v); -icalparameter_range icalparameter_get_range(icalparameter* value); -void icalparameter_set_range(icalparameter* value, icalparameter_range v); - -/* RELATED */ -icalparameter* icalparameter_new_related(icalparameter_related v); -icalparameter_related icalparameter_get_related(icalparameter* value); -void icalparameter_set_related(icalparameter* value, icalparameter_related v); - -/* RELTYPE */ -icalparameter* icalparameter_new_reltype(icalparameter_reltype v); -icalparameter_reltype icalparameter_get_reltype(icalparameter* value); -void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v); - -/* ROLE */ -icalparameter* icalparameter_new_role(icalparameter_role v); -icalparameter_role icalparameter_get_role(icalparameter* value); -void icalparameter_set_role(icalparameter* value, icalparameter_role v); - -/* RSVP */ -icalparameter* icalparameter_new_rsvp(int v); -int icalparameter_get_rsvp(icalparameter* value); -void icalparameter_set_rsvp(icalparameter* value, int v); - -/* SENT-BY */ -icalparameter* icalparameter_new_sentby(char* v); -char* icalparameter_get_sentby(icalparameter* value); -void icalparameter_set_sentby(icalparameter* value, char* v); - -/* TZID */ -icalparameter* icalparameter_new_tzid(char* v); -char* icalparameter_get_tzid(icalparameter* value); -void icalparameter_set_tzid(icalparameter* value, char* v); - -/* VALUE */ -icalparameter* icalparameter_new_value(icalparameter_value v); -icalparameter_value icalparameter_get_value(icalparameter* value); -void icalparameter_set_value(icalparameter* value, icalparameter_value v); - -/* X */ -icalparameter* icalparameter_new_x(char* v); -char* icalparameter_get_x(icalparameter* value); -void icalparameter_set_x(icalparameter* value, char* v); - -/* X-LIC-ERRORTYPE */ -icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v); -icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value); -void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v); - -/* X-LIC-COMPARETYPE */ -icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v); -icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value); -void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v); - -#endif ICALPARAMETER_H diff --git a/libical/src/libical/icalparser.c b/libical/src/libical/icalparser.c deleted file mode 100644 index b4c1822a68..0000000000 --- a/libical/src/libical/icalparser.c +++ /dev/null @@ -1,901 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalparser.c - CREATOR: eric 04 August 1999 - - $Id$ - $Locker$ - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is - - (C) COPYRIGHT 1999 The Software Studio. - http://www.softwarestudio.org - - ======================================================================*/ -#include "ical.h" -#include "pvl.h" -#include "icalparser.h" -#include "icalmemory.h" -#include /* For strncpy */ -#include /* For FILE and fgets and sprintf */ -#include /* for free */ - - -extern icalvalue* icalparser_yy_value; -void set_parser_value_state(icalvalue_kind kind); -int icalparser_yyparse(void); - -char* icalparser_get_next_char(char c, char *str); -char* icalparser_get_next_parameter(char* line,char** end); -char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind); -char* icalparser_get_prop_name(char* line, char** end); -char* icalparser_get_param_name(char* line, char **end); - -icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind, char* str, icalproperty **error); - - - -char* icalparser_get_next_char(char c, char *str) -{ - int quote_mode = 0; - char* p; - - - for(p=str; *p!=0; p++){ - - if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){ - quote_mode =1; - continue; - } - - if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){ - quote_mode =0; - continue; - } - - if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){ - return p; - } - - } - - return 0; -} - -/* make a new tmp buffer out of a substring */ -char* make_segment(char* start, char* end) -{ - char *buf; - size_t size = (size_t)end - (size_t)start; - - buf = icalmemory_tmp_buffer(size+1); - - - strncpy(buf,start,size); - *(buf+size) = 0; - - return buf; - -} - -char* input_buffer; -char* input_buffer_p; -#define min(a,b) ((a) < (b) ? (a) : (b)) - -int icalparser_flex_input(char* buf, int max_size) -{ - int n = min(max_size,strlen(input_buffer_p)); - - if (n > 0){ - memcpy(buf, input_buffer_p, n); - input_buffer_p += n; - return n; - } else { - return 0; - } -} - -void icalparser_clear_flex_input() -{ - input_buffer_p = input_buffer+strlen(input_buffer); -} - -/* Cal the flex parser to parse a complex value */ - -icalvalue* icalparser_parse_value(icalvalue_kind kind, - char* str, icalproperty** error) -{ - int r; - input_buffer_p = input_buffer = str; - - set_parser_value_state(kind); - icalparser_yy_value = 0; - - r = icalparser_yyparse(); - - /* Error. Parse failed */ - if( icalparser_yy_value == 0 || r != 0){ - - if(icalparser_yy_value !=0){ - icalvalue_free(icalparser_yy_value); - icalparser_yy_value = 0; - } - - return 0; - } - - if (error != 0){ - *error = 0; - } - - return icalparser_yy_value; -} - -char* icalparser_get_prop_name(char* line, char** end) -{ - char* p; - char* v; - char *str; - - p = icalparser_get_next_char(';',line); - v = icalparser_get_next_char(':',line); - if (p== 0 && v == 0) { - return 0; - } - - /* There is no ';' or, it is after the ';' that marks the beginning of - the value */ - if (v!=0 && ( p == 0 || p > v)){ - str = make_segment(line,v); - *end = v+1; - } else { - str = make_segment(line,p); - *end = p+1; - } - - return str; -} - -char* icalparser_get_param_name(char* line, char **end) -{ - - char* next; - char *str; - - next = icalparser_get_next_char('=',line); - - if (next == 0) { - return 0; - } - - str = make_segment(line,next); - *end = next+1; - return str; - -} - -char* icalparser_get_next_paramvalue(char* line, char **end) -{ - - char* next; - char *str; - - next = icalparser_get_next_char(',',line); - - if (next == 0){ - next = (char*)(size_t)line+(size_t)strlen(line);\ - } - - if (next == line){ - return 0; - } else { - str = make_segment(line,next); - *end = next+1; - return str; - } - -} - -/* A property may have multiple values, if the values are seperated by - commas in the content line. This routine will look for the next - comma after line and will set the next place to start searching in - end. */ - -char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind) -{ - - char* next; - char *p; - char *str; - size_t length = strlen(line); - - p = line; - while(1){ - - next = icalparser_get_next_char(',',p); - - /* Unforunately, RFC2445 says that for the RECUR value, COMMA - can both seperate digits in a list, and it can seperate - multiple recurrence specifications. This is not a friendly - part of the spec. This weirdness tries to - distinguish the two uses. it is probably a HACK*/ - - if( kind == ICAL_RECUR_VALUE ) { - if ( next != 0 && - (*end+length) > next+5 && - strncmp(next,"FREQ",4) == 0 - ) { - /* The COMMA was followed by 'FREQ', is it a real seperator*/ - /* Fall through */ - printf("%s\n",next); - } else if (next != 0){ - /* Not real, get the next COMMA */ - p = next+1; - next = 0; - continue; - } - } - - /* If the comma is preceeded by a '\', then it is a literal and - not a value seperator*/ - - if ( (next!=0 && *(next-1) == '\\') || - (next!=0 && *(next-3) == '\\') - ) - /*second clause for '/' is on prev line. HACK may be out of bounds */ - { - p = next+1; - } else { - break; - } - - } - - if (next == 0){ - next = (char*)(size_t)line+length; - *end = next; - } else { - *end = next+1; - } - - if (next == line){ - return 0; - } - - - str = make_segment(line,next); - return str; - -} - -char* icalparser_get_next_parameter(char* line,char** end) -{ - char *next; - char *v; - char *str; - - v = icalparser_get_next_char(':',line); - next = icalparser_get_next_char(';', line); - - /* There is no ';' or, it is after the ':' that marks the beginning of - the value */ - - if (next == 0 || next > v) { - next = icalparser_get_next_char(':', line); - } - - if (next != 0) { - str = make_segment(line,next); - *end = next+1; - return str; - } else { - *end = line; - return 0; - } -} - -/* HACK. This is not threadsafe */ -int buffer_full=0; -size_t tmp_buf_size = 80; -char temp[80]; - - -/* Get a single property line, from the property name through the - final new line, and include any continuation lines */ - -char* icalparser_get_line(char* (*line_gen_func)(char *s, size_t size, void *d), int *lineno) -{ - char *line; - char *line_p; - size_t buf_size = tmp_buf_size; - - - line_p = line = icalmemory_new_buffer(buf_size); - line[0] = '\0'; - - while(1) { - - /* The buffer is not clear, so transfer the data in it to the - output. This may be left over from a previous call */ - if (temp[0] != '\0' ) { - if (temp[tmp_buf_size-1] == 0){ - buffer_full = 1; - } else { - buffer_full = 0; - } - icalmemory_append_string(&line,&line_p,&buf_size,temp); - temp[0] = '\0' ; - } - - temp[tmp_buf_size-1] = 1; /* Mark end of buffer */ - - if ((*line_gen_func)(temp,tmp_buf_size,0)==0){/* Get more data */ - if (temp[0] == '\0'){ - if(line[0] != '\0'){ - break; - } else { - free(line); - return 0; - } - } - } - - if ( line_p > line+1 && *(line_p-1) == '\n' && temp[0] == ' ') { - - /* If the output line ends in a '\n' and the temp buffer - begins with a ' ', then the buffer holds a continuation - line, so keep reading. */ - - /* back up the pointer to erase the continuation characters */ - line_p--; - - /* shift the temp buffer down to eliminate the leading space*/ - memmove(&(temp[0]),&(temp[1]),tmp_buf_size); - temp[tmp_buf_size-1] = temp[tmp_buf_size-2]; - - } else if ( buffer_full == 1 ) { - - /* The buffer was filled on the last read, so read again */ - - } else { - - /* Looks like the end of this content line, so break */ - break; - } - - - } - - /* Erase the final newline */ - if ( line_p > line+1 && *(line_p-1) == '\n') { - - *(line_p-1) = '\0'; - } else { - *(line_p) = '\0'; - } - - return line; - -} - -#if 0 -char* icalparser_old_get_line(char* (*line_gen_func)(char *s, size_t size, void *d), int *lineno) -{ - char *line, *output_line; - char *line_p; - char last_line = 0; - size_t buf_size = tmp_buf_size; - int break_flag = 0; - - line_p = line = icalmemory_new_buffer(buf_size); - - /* If the hold buffer is empty, read a line. Otherwise, use the data that - is still in 'temp'*/ - if (hold == 1){ - /* Do nothing */ - } else { - temp[tmp_buf_size-1] = 1; /* Mark end of buffer */ - (*line_gen_func)(temp,tmp_buf_size,0); - } - - /* Append the hold buffer or new line into the output */ - icalmemory_append_string(&line,&line_p,&buf_size,temp); - - if ( temp[tmp_buf_size-1] == 0 ) { /* Check if mark was overwritten */ - buffer_full = 1; - } else { - buffer_full = 0; - } - - /* Try to suck up any continuation lines */ - while(last_line == 0){ - - temp[tmp_buf_size-1] = 1; /* Mark end of buffer */ - if ((*line_gen_func)(temp,tmp_buf_size,0) == 0){ - /* No more lines -- we are finished */ - if (hold == 1) { - hold = 0; - break_flag = 1; - } else { - icalmemory_free_buffer(line); - return 0; - } - } else { - if ( temp[tmp_buf_size-1] == 0 ) { - buffer_full = 1; - } else { - buffer_full = 0; - } - } - - /* keep track of line numbers */ - if (lineno != 0){ - (*lineno)++; - } - - - /* Determine wether to copy the line to the output, or - save it in the hold buffer */ - - if ( line_p > line+1 && *(line_p-1) == '\n' && temp[0] == ' ') { - - /* If the last line ( in the 'line' string ) ends in a '\n' - and the current line begins with a ' ', then the current line - is a continuation line, so append it. */ - - /* back up the pointer to erase the continuation characters */ - line_p--; - icalmemory_append_string(&line,&line_p,&buf_size,&(temp[1])); - - hold = 0; - buffer_full= 0; - - } else if (buffer_full == 1) { - - /* The last line that was read filled up the read - buffer. Append it and read again */ - - icalmemory_append_string(&line,&line_p,&buf_size,temp); - - hold = 0; - - } else if (break_flag != 1 ){ - /* Nope -- the line was not a continuation line. - Save the line for the next call */ - - hold =1; - break; - } else { - break; - } - } - - /* Erase the final newline */ - if ( line_p > line+1 && *(line_p-1) == '\n') { - - *(line_p-1) = '\0'; - } - - output_line = icalmemory_tmp_copy(line); - icalmemory_free_buffer(line); - - return output_line; -} -#endif - -void insert_error(icalcomponent* comp, char* text, - char* message, icalparameter_xlicerrortype type) -{ - char temp[1024]; - - if (strlen(text) > 256) { - sprintf(temp,"%s: \'%256s...\'",message,text); - } else { - sprintf(temp,"%s: \'%s\'",message,text); - } - - icalcomponent_add_property - (comp, - icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype(type), - 0)); -} - -icalcomponent* icalparser_parse(char* (*line_gen_func)(char *s, size_t size, void* d)) -{ - - char *line = 0; - char *p; - char *str; - char *end; - int lineno = 0; - - int vcount = 0; - - icalcomponent *root_component = 0; - icalcomponent *tail = 0; - icalproperty *prop; - icalvalue *value; - - icalvalue_kind value_kind; - - pvl_list components = pvl_newlist(); - - do { - - value_kind = ICAL_NO_VALUE; - - /* Get a single property line, from a property name through a - newline */ - if (line!=0){ - free(line); - } - - line = icalparser_get_line(line_gen_func,&lineno); - - if (line == 0){ - continue; - } - - end = 0; - - str = icalparser_get_prop_name(line, &end); - - if (str == 0){ - tail = pvl_data(pvl_tail(components)); - - if (tail){ - insert_error(tail,line, - "Got a data line, but could not find a property name or component begin tag", - ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); - } - tail = 0; - continue; - } - -/********************************************************************** - * Handle begin and end of components - **********************************************************************/ - - - /* If the property name is BEGIN or END, we are actually - starting or ending a new component */ - - if(strcmp(str,"BEGIN") == 0){ - icalcomponent *c; ; - - str = icalparser_get_next_value(end,&end, value_kind); - - c = icalcomponent_new_from_string(str); - - if (c == 0){ - c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT); - insert_error(c,str,"Parse error in component name", - ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); - } - - pvl_push(components,c); - - continue; - } else if (strcmp(str,"END") == 0 ) { - - str = icalparser_get_next_value(end,&end, value_kind); - - root_component = pvl_pop(components); - - tail = pvl_data(pvl_tail(components)); - - if(tail != 0){ - icalcomponent_add_component(tail,root_component); - } - - tail = 0; - continue; - } - - - /* There is no point in continuing if we have not seen a - component yet */ - - if(pvl_data(pvl_tail(components)) == 0){ - continue; - } - - -/********************************************************************** - * Handle property names - **********************************************************************/ - /* At this point, the property name really is a property name, - (Not a component name) so make a new property and add it to - the component */ - - prop = icalproperty_new_from_string(str); - - if (prop != 0){ - tail = pvl_data(pvl_tail(components)); - - icalcomponent_add_property(tail, prop); - - /* Set the value kind for the default for this type of - property. This may be re-set by a VALUE parameter */ - value_kind = - icalenum_property_kind_to_value_kind( - icalproperty_isa(prop)); - } else { - icalcomponent* tail = pvl_data(pvl_tail(components)); - - insert_error(tail,str,"Parse error in property name", - ICAL_XLICERRORTYPE_PROPERTYPARSEERROR); - - tail = 0; - continue; - } - -/********************************************************************** - * Handle parameter values - **********************************************************************/ - - /* Now, add any parameters to the last property */ - - p = 0; - while(1) { - - if (*(end-1) == ':'){ - /* if the last seperator was a ":" and the value is a - URL, icalparser_get_next_parameter will find the - ':' in the URL, so better break now. */ - break; - } - - str = icalparser_get_next_parameter(end,&end); - - if (str != 0){ - char* name; - char* pvalue; - icalparameter *param = 0; - icalparameter_kind kind; - - tail = pvl_data(pvl_tail(components)); - - name = icalparser_get_param_name(str,&pvalue); - - if (name == 0){ - insert_error(tail, str, "Can't parse parameter name", - ICAL_XLICERRORTYPE_PARAMETERPARSEERROR); - tail = 0; - break; - } - - kind = icalenum_string_to_parameter_kind(name); - if (kind != ICAL_NO_PARAMETER){ - param = icalparameter_new_from_string(kind,pvalue); - } else { - - /* Error. Failed to parse the parameter*/ - insert_error(tail, str, "Can't parse parameter name", - ICAL_XLICERRORTYPE_PARAMETERPARSEERROR); - tail = 0; - continue; - } - - if (param == 0){ - insert_error(tail,str,"Can't parse parameter value", - ICAL_XLICERRORTYPE_PARAMETERPARSEERROR); - - tail = 0; - continue; - } - - /* If it is a VALUE parameter, set the kind of value*/ - if (icalparameter_isa(param)==ICAL_VALUE_PARAMETER){ - - value_kind = (icalvalue_kind) - icalparameter_get_value(param); - - if (value_kind == ICAL_NO_VALUE){ - - /* Ooops, could not parse the value of the - parameter ( it was not one of the defined - values ), so reset the value_kind */ - - icalcomponent* tail - = pvl_data(pvl_tail(components)); - - insert_error( - tail, str, - "Got a VALUE parameter with an unknown type", - ICAL_XLICERRORTYPE_PARAMETERPARSEERROR); - icalparameter_free(param); - - value_kind = - icalenum_property_kind_to_value_kind( - icalproperty_isa(prop)); - - icalparameter_free(param); - tail = 0; - continue; - } - } - - /* Everything is OK, so add the parameter */ - icalproperty_add_parameter(prop,param); - tail = 0; - - } else { - /* If we did not get a param string, go on to looking - for a value */ - break; - } - } - -/********************************************************************** - * Handle values - **********************************************************************/ - - /* Look for values. If there are ',' characters in the values, - then there are multiple values, so clone the current - parameter and add one part of the value to each clone */ - - vcount=0; - while(1) { - str = icalparser_get_next_value(end,&end, value_kind); - - if (str != 0){ - - if (vcount > 0){ - /* Actually, only clone after the second value */ - icalproperty* clone = icalproperty_new_clone(prop); - tail = pvl_data(pvl_tail(components)); - - icalcomponent_add_property(tail, clone); - prop = clone; - tail = 0; - } - - value = icalvalue_new_from_string(value_kind, str); - - /* Don't add properties without value */ - if (value == 0){ - char temp[1024]; - - icalproperty_kind prop_kind = icalproperty_isa(prop); - tail = pvl_data(pvl_tail(components)); - - sprintf(temp,"Can't parse as %s value in %s property. Removing entire property", - icalenum_value_kind_to_string(value_kind), - icalenum_property_kind_to_string(prop_kind)); - - insert_error(tail, str, temp, - ICAL_XLICERRORTYPE_VALUEPARSEERROR); - - /* Remove the troublesome property */ - icalcomponent_remove_property(tail,prop); - icalproperty_free(prop); - prop = 0; - tail = 0; - break; - - } else { - vcount++; - icalproperty_set_value(prop, value); - } - - - } else { - - break; - } - } - - } while( !feof(stdin) && line !=0 ); - - - if (pvl_data(pvl_tail(components)) == 0){ - /* A nice, clean exit */ - pvl_free(components); - free(line); - return root_component; - } - - /* Clear off any component that may be left in the list */ - /* This will happen if some components did not have an "END" tag*/ - - while((tail=pvl_data(pvl_tail(components))) != 0){ - - insert_error(tail," ", - "Missing END tag for this component. Closing component at end of input.", - ICAL_XLICERRORTYPE_COMPONENTPARSEERROR); - - - root_component = pvl_pop(components); - tail=pvl_data(pvl_tail(components)); - - if(tail != 0){ - icalcomponent_add_component(tail,root_component); - } - } - - free(line); - return root_component; -} - -char* string_line_generator_pos=0; -char* string_line_generator_str; -char* string_line_generator(char *out, size_t buf_size, void *d) -{ - char *n; - - if(string_line_generator_pos==0){ - string_line_generator_pos=string_line_generator_str; - } - - /* If the pointer is at the end of the string, we are done */ - if (*string_line_generator_pos ==0){ - return 0; - } - - n = strchr(string_line_generator_pos,'\n'); - - /* If no newline, take the rest of the string, and leave the - pointer at the \0 */ - - if (n == 0) { - n = string_line_generator_pos + strlen(string_line_generator_pos); - } else { - n++; - } - - strncpy(out,string_line_generator_pos,(n-string_line_generator_pos)); - - *(out+(n-string_line_generator_pos)) = '\0'; - - string_line_generator_pos = n; - - return out; - -} - -void _test_string_line_generator(char* str) -{ - char *line; - int lineno=0; - string_line_generator_str = str; - string_line_generator_pos = 0; - - while((line = icalparser_get_line(string_line_generator,&lineno))){ - printf("#%d: %s\n",lineno,line); - } - - - string_line_generator_pos = 0; - string_line_generator_str = 0; -} - - - -icalcomponent* icalparser_parse_string(char* str) -{ - - icalcomponent *c; - - string_line_generator_str = str; - string_line_generator_pos = 0; - c = icalparser_parse(string_line_generator); - string_line_generator_pos = 0; - string_line_generator_str = 0; - - return c; - -} diff --git a/libical/src/libical/icalparser.h b/libical/src/libical/icalparser.h deleted file mode 100644 index 9e47e38bfb..0000000000 --- a/libical/src/libical/icalparser.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalparser.h - CREATOR: eric 20 April 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalparser.h - -======================================================================*/ - - -#ifndef ICALPARSER_H -#define ICALPARSER_H - -#include "ical.h" -#include /* For FILE* */ - -/*********************************************************************** - * Message oriented parsing. icalparser_parse takes a string that - * holds the text ( in RFC 2445 format ) and returns a pointer to an - * icalcomponent. The caller owns the memory. line_gen_func is a - * pointer to a function that returns one content line per invocation - **********************************************************************/ - -icalcomponent* icalparser_parse(char* (*line_gen_func)()); - -/* Parse directly from a string */ -icalcomponent* icalparser_parse_string(char* str); - -/* icalparser_flex_input is the routine that is called from the macro - YYINPUT in the flex lexer. */ -int icalparser_flex_input(char* buf, int max_size); -void icalparser_clear_flex_input(); - -/*********************************************************************** - * Line-oriented parsing. - * - * Create a new parser via icalparse_new_parser, then add ines one at - * a time with icalparse_add_line(). After adding the last line, call - * icalparse_close() to return the parsed component. - ***********************************************************************/ - -/* These are not implemented yet */ -typedef void* icalparser; -icalparser icalparse_new_parser(); -void icalparse_add_line(icalparser* parser ); -icalcomponent* icalparse_close(icalparser* parser); - -/*********************************************************************** - * Parser support functions - ***********************************************************************/ - -/* Use the flex/bison parser to turn a string into a value type */ -icalvalue* icalparser_parse_value(icalvalue_kind kind, char* str, icalcomponent** errors); - -char* icalparser_get_line(char* (*line_gen_func)(char *s, size_t size, void *d), int *lineno); - - - -/* a line_gen_function that returns lines from a string */ - - -#endif /* !ICALPARSE_H */ diff --git a/libical/src/libical/icalproperty.c b/libical/src/libical/icalproperty.c deleted file mode 100644 index 3dd761b1f8..0000000000 --- a/libical/src/libical/icalproperty.c +++ /dev/null @@ -1,3084 +0,0 @@ -/* -*- Mode: C -*- */ - -/*====================================================================== - FILE: icalproperty.c - CREATOR: eric 28 April 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalproperty.c - -======================================================================*/ - -#include /* For strdup, rindex */ -#include -#include -#include -#include /* for printf */ -#include /* for va_list, va_start, etc. */ - -#include "ical.h" -#include "pvl.h" -#include "icalenums.h" -#include "icalerror.h" -#include "icalmemory.h" - -/* Private routines for icalproperty */ -void icalvalue_set_parent(icalvalue* value, - icalproperty* property); -icalproperty* icalvalue_get_parent(icalvalue* value); - -void icalparameter_set_parent(icalparameter* param, - icalproperty* property); -icalproperty* icalparameter_get_parent(icalparameter* value); - - -void icalproperty_set_x_name(icalproperty* prop, char* name); - -struct icalproperty_impl -{ - char id[5]; - icalproperty_kind kind; - char* x_name; - pvl_list parameters; - pvl_elem parameter_iterator; - icalvalue* value; - icalcomponent *parent; -}; - -void icalproperty_add_parameters(struct icalproperty_impl *impl,va_list args) -{ - - void* vp; - - while((vp = va_arg(args, void*)) != 0) { - - if (icalvalue_isa_value(vp) != 0 ){ - } else if (icalparameter_isa_parameter(vp) != 0 ){ - - icalproperty_add_parameter((icalproperty*)impl, - (icalparameter*)vp); - } else { - abort(); - } - - } - - -} - -struct icalproperty_impl* -icalproperty_new_impl (icalproperty_kind kind) -{ - struct icalproperty_impl* prop; - - if ( ( prop = (struct icalproperty_impl*) - malloc(sizeof(struct icalproperty_impl))) == 0) { - errno = ENOMEM; - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - - strcpy(prop->id,"prop"); - - prop->kind = kind; - prop->parameters = pvl_newlist(); - prop->parameter_iterator = 0; - prop->value = 0; - prop->x_name = 0; - prop->parent = 0; - - return prop; -} - - -icalproperty* -icalproperty_new (icalproperty_kind kind) -{ - icalproperty *prop = (icalproperty*)icalproperty_new_impl(kind); - - return prop; -} - - -icalproperty* -icalproperty_new_clone(icalproperty* prop) -{ - struct icalproperty_impl *old = (struct icalproperty_impl*)prop; - struct icalproperty_impl *new = icalproperty_new_impl(old->kind); - pvl_elem p; - - icalerror_check_arg_rz((prop!=0),"Prop"); - icalerror_check_arg_rz((old!=0),"old"); - icalerror_check_arg_rz((new!=0),"new"); - - if (old->value !=0) { - new->value = icalvalue_new_clone(old->value); - } - - if (old->x_name != 0) { - - new->x_name = strdup(old->x_name); - - if (new->x_name == 0) { - icalproperty_free(new); - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - } - - for(p=pvl_head(old->parameters);p != 0; p = pvl_next(p)){ - icalparameter *param = icalparameter_new_clone(pvl_data(p)); - - if (param == 0){ - icalproperty_free(new); - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - - pvl_push(new->parameters,param); - - } - - return new; - -} - -/* This one works a little differently from the other *_from_string - routines; the string input is the name of the property, not the - data associated with the property, as it is in - icalvalue_from_string. All of the parsing associated with - properties is driven by routines in icalparse.c */ - -icalproperty* icalproperty_new_from_string(char* str) -{ - icalproperty_kind kind; - - icalerror_check_arg_rz( (str!=0),"str"); - - kind = icalenum_string_to_property_kind(str); - - if (kind == ICAL_NO_PROPERTY){ - - if( str[0] == 'X' && str[1] == '-'){ - icalproperty *p = icalproperty_new(ICAL_X_PROPERTY); - icalproperty_set_x_name(p,str); - return p; - } else { - icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR); - return 0; - } - - } else { - return icalproperty_new(kind); - } -} - -void -icalproperty_free (icalproperty* prop) -{ - struct icalproperty_impl *p; - - icalparameter* param; - - icalerror_check_arg_re((prop!=0),"prop",ICAL_BADARG_ERROR); - - p = (struct icalproperty_impl*)prop; - -#ifdef ICAL_FREE_ON_LIST_IS_ERROR - icalerror_assert( (p->parent ==0),"Tried to free a property that is still attached to a component. "); - -#else - if(p->parent !=0){ - return; - } -#endif - - if (p->value != 0){ - icalvalue_set_parent(p->value,0); - icalvalue_free(p->value); - } - - while( (param = pvl_pop(p->parameters)) != 0){ - icalparameter_free(param); - } - - pvl_free(p->parameters); - - if (p->x_name != 0) { - free(p->x_name); - } - - p->kind = ICAL_NO_PROPERTY; - p->parameters = 0; - p->parameter_iterator = 0; - p->value = 0; - p->x_name = 0; - p->id[0] = 'X'; - - free(p); - -} - - -char* -icalproperty_as_ical_string (icalproperty* prop) -{ - icalparameter *param; - - /* Create new buffer that we can append names, parameters and a - value to, and reallocate as needed. Later, this buffer will be - copied to a icalmemory_tmp_buffer, which is managed internally - by libical, so it can be given to the caller without fear of - the caller forgetting to free it */ - - char* property_name = 0; - size_t buf_size = 1024; - char* buf = icalmemory_new_buffer(buf_size); - char* buf_ptr = buf; - icalvalue* value; - char *out_buf; - - struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; - - icalerror_check_arg_rz( (prop!=0),"prop"); - - /* Append property name */ - - if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){ - property_name = impl->x_name; - } else { - property_name = icalenum_property_kind_to_string(impl->kind); - } - - if (property_name == 0 ) { - icalerror_warn("Got a property of an unknown kind."); - icalmemory_free_buffer(buf); - return 0; - - } - - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n"); - - /* Append parameters */ - for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER); - param != 0; - param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) { - - char* kind_string = icalparameter_as_ical_string(param); - - if (kind_string == 0 ) { - char temp[1024]; - sprintf(temp, "Got a parameter of unknown kind in %s property",property_name); - icalerror_warn(temp); - continue; - } - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;"); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string); - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n"); - - } - - /* Append value */ - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, " :"); - - value = icalproperty_get_value(prop); - - if (value != 0){ - icalmemory_append_string(&buf, &buf_ptr, &buf_size, - icalvalue_as_ical_string(icalproperty_get_value(prop))); - } else { - icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value"); - - } - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n"); - - /* Now, copy the buffer to a tmp_buffer, which is safe to give to - the caller without worring about de-allocating it. */ - - - out_buf = icalmemory_tmp_buffer(strlen(buf)+1); - strcpy(out_buf, buf); - - icalmemory_free_buffer(buf); - - return out_buf; -} - - - -icalproperty_kind -icalproperty_isa (icalproperty* property) -{ - struct icalproperty_impl *p = (struct icalproperty_impl*)property; - - if(property != 0){ - return p->kind; - } - - return ICAL_NO_PROPERTY; -} - -int -icalproperty_isa_property (void* property) -{ - struct icalproperty_impl *impl = (struct icalproperty_impl*)property; - - icalerror_check_arg_rz( (property!=0), "property"); - - if (strcmp(impl->id,"prop") == 0) { - return 1; - } else { - return 0; - } -} - - -void -icalproperty_add_parameter (icalproperty* prop,icalparameter* parameter) -{ - struct icalproperty_impl *p = (struct icalproperty_impl*)prop; - - icalerror_check_arg_rv( (prop!=0),"prop"); - icalerror_check_arg_rv( (parameter!=0),"parameter"); - - pvl_push(p->parameters, parameter); - -} - - -void -icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind) -{ - icalerror_check_arg_rv((prop!=0),"prop"); - - assert(0); /* This routine is not implemented */ -} - - -int -icalproperty_count_parameters (icalproperty* prop) -{ - struct icalproperty_impl *p = (struct icalproperty_impl*)prop; - - if(prop != 0){ - return pvl_count(p->parameters); - } - - icalerror_set_errno(ICAL_USAGE_ERROR); - return -1; -} - - -icalparameter* -icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind) -{ - struct icalproperty_impl *p = (struct icalproperty_impl*)prop; - - icalerror_check_arg_rz( (prop!=0),"prop"); - - p->parameter_iterator = pvl_head(p->parameters); - - if (p->parameter_iterator == 0) { - return 0; - } - - return (icalparameter*) pvl_data(p->parameter_iterator); -} - - -icalparameter* -icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind) -{ - struct icalproperty_impl *p = (struct icalproperty_impl*)prop; - icalerror_check_arg_rz( (prop!=0),"prop"); - - if (p->parameter_iterator == 0 ) { - return 0; - } - - p->parameter_iterator = pvl_next(p->parameter_iterator); - - if (p->parameter_iterator == 0 ) { - return 0; - } - - return (icalparameter*) pvl_data(p->parameter_iterator); -} - -void -icalproperty_set_value (icalproperty* prop, icalvalue* value) -{ - struct icalproperty_impl *p = (struct icalproperty_impl*)prop; - - icalerror_check_arg_rv((prop !=0),"prop"); - icalerror_check_arg_rv((value !=0),"value"); - - if (p->value != 0){ - icalvalue_set_parent(p->value,0); - icalvalue_free(p->value); - p->value = 0; - } - - p->value = value; - - icalvalue_set_parent(value,prop); -} - - -icalvalue* -icalproperty_get_value (icalproperty* prop) -{ - struct icalproperty_impl *p = (struct icalproperty_impl*)prop; - - icalerror_check_arg_rz( (prop!=0),"prop"); - - return p->value; -} - - -void icalproperty_set_x_name(icalproperty* prop, char* name) -{ - struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; - - icalerror_check_arg_rv( (name!=0),"name"); - icalerror_check_arg_rv( (prop!=0),"prop"); - - if (impl->x_name != 0) { - free(impl->x_name); - } - - impl->x_name = strdup(name); - - if(impl->x_name == 0){ - icalerror_set_errno(ICAL_ALLOCATION_ERROR); - } - -} - -char* icalproperty_get_x_name(icalproperty* prop){ - - struct icalproperty_impl *impl = (struct icalproperty_impl*)prop; - - icalerror_check_arg_rz( (prop!=0),"prop"); - - return impl->x_name; -} - - -void icalproperty_set_parent(icalproperty* property, - icalcomponent* component) -{ - struct icalproperty_impl *impl = (struct icalproperty_impl*)property; - - icalerror_check_arg_rv( (property!=0),"property"); - - impl->parent = component; -} - -icalcomponent* icalproperty_get_parent(icalproperty* property) -{ - struct icalproperty_impl *impl = (struct icalproperty_impl*)property; - - icalerror_check_arg_rv( (property!=0),"property"); - - return impl->parent; -} - - -/* Everything below this line is machine generated. Do not edit. */ - -/* METHOD */ - -icalproperty* icalproperty_new_method(icalproperty_method v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_METHOD_PROPERTY); - - - icalproperty_set_method((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_method(icalproperty_method v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_METHOD_PROPERTY); - - - icalproperty_set_method((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_method(icalproperty* prop, icalproperty_method v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_method(v); - - icalproperty_set_value(prop,value); - -} - -icalproperty_method icalproperty_get_method(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_method(value); -} - -/* LAST-MODIFIED */ - -icalproperty* icalproperty_new_lastmodified(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LASTMODIFIED_PROPERTY); - - - icalproperty_set_lastmodified((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LASTMODIFIED_PROPERTY); - - - icalproperty_set_lastmodified((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetime(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetime(value); -} - -/* UID */ - -icalproperty* icalproperty_new_uid(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_uid((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_uid(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_uid((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_uid(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_uid(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* PRODID */ - -icalproperty* icalproperty_new_prodid(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_prodid((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_prodid(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_prodid((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_prodid(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_prodid(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* STATUS */ - -icalproperty* icalproperty_new_status(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_STATUS_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_status((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_status(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_STATUS_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_status((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_status(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_status(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* DESCRIPTION */ - -icalproperty* icalproperty_new_description(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_description((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_description(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_description((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_description(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_description(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* DURATION */ - -icalproperty* icalproperty_new_duration(struct icaldurationtype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DURATION_PROPERTY); - - - icalproperty_set_duration((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DURATION_PROPERTY); - - - icalproperty_set_duration((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_duration(v); - - icalproperty_set_value(prop,value); - -} - -struct icaldurationtype icalproperty_get_duration(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_duration(value); -} - -/* CATEGORIES */ - -icalproperty* icalproperty_new_categories(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_categories((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_categories(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_categories((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_categories(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_categories(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* VERSION */ - -icalproperty* icalproperty_new_version(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_version((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_version(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_version((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_version(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_version(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* TZOFFSETFROM */ - -icalproperty* icalproperty_new_tzoffsetfrom(int v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETFROM_PROPERTY); - - - icalproperty_set_tzoffsetfrom((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETFROM_PROPERTY); - - - icalproperty_set_tzoffsetfrom((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_utcoffset(v); - - icalproperty_set_value(prop,value); - -} - -int icalproperty_get_tzoffsetfrom(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_utcoffset(value); -} - -/* RRULE */ - -icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RRULE_PROPERTY); - - - icalproperty_set_rrule((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RRULE_PROPERTY); - - - icalproperty_set_rrule((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_recur(v); - - icalproperty_set_value(prop,value); - -} - -struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_recur(value); -} - -/* ATTENDEE */ - -icalproperty* icalproperty_new_attendee(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_attendee((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_attendee(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_attendee((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_attendee(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_caladdress(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_attendee(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_caladdress(value); -} - -/* CONTACT */ - -icalproperty* icalproperty_new_contact(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_contact((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_contact(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_contact((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_contact(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_contact(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* RELATED-TO */ - -icalproperty* icalproperty_new_relatedto(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_relatedto((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_relatedto(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_relatedto((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_relatedto(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_relatedto(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* ORGANIZER */ - -icalproperty* icalproperty_new_organizer(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_organizer((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_organizer(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_organizer((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_organizer(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_caladdress(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_organizer(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_caladdress(value); -} - -/* COMMENT */ - -icalproperty* icalproperty_new_comment(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_comment((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_comment(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_comment((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_comment(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_comment(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* TRIGGER */ - -icalproperty* icalproperty_new_trigger(union icaltriggertype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRIGGER_PROPERTY); - - - icalproperty_set_trigger((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_trigger(union icaltriggertype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRIGGER_PROPERTY); - - - icalproperty_set_trigger((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_trigger(icalproperty* prop, union icaltriggertype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_trigger(v); - - icalproperty_set_value(prop,value); - -} - -union icaltriggertype icalproperty_get_trigger(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_trigger(value); -} - -/* X-LIC-ERROR */ - -icalproperty* icalproperty_new_xlicerror(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_xlicerror((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_xlicerror(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_xlicerror((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_xlicerror(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_xlicerror(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* CLASS */ - -icalproperty* icalproperty_new_class(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_class((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_class(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_class((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_class(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_class(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* TZOFFSETTO */ - -icalproperty* icalproperty_new_tzoffsetto(int v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETTO_PROPERTY); - - - icalproperty_set_tzoffsetto((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_tzoffsetto(int v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETTO_PROPERTY); - - - icalproperty_set_tzoffsetto((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_tzoffsetto(icalproperty* prop, int v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_utcoffset(v); - - icalproperty_set_value(prop,value); - -} - -int icalproperty_get_tzoffsetto(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_utcoffset(value); -} - -/* TRANSP */ - -icalproperty* icalproperty_new_transp(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_transp((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_transp(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_transp((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_transp(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_transp(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* SEQUENCE */ - -icalproperty* icalproperty_new_sequence(int v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SEQUENCE_PROPERTY); - - - icalproperty_set_sequence((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_sequence(int v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SEQUENCE_PROPERTY); - - - icalproperty_set_sequence((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_sequence(icalproperty* prop, int v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_integer(v); - - icalproperty_set_value(prop,value); - -} - -int icalproperty_get_sequence(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_integer(value); -} - -/* LOCATION */ - -icalproperty* icalproperty_new_location(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_location((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_location(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_location((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_location(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_location(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* REQUEST-STATUS */ - -icalproperty* icalproperty_new_requeststatus(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REQUESTSTATUS_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_requeststatus((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_requeststatus(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REQUESTSTATUS_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_requeststatus((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_requeststatus(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_requeststatus(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* EXDATE */ - -icalproperty* icalproperty_new_exdate(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXDATE_PROPERTY); - - - icalproperty_set_exdate((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXDATE_PROPERTY); - - - icalproperty_set_exdate((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetimedate(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_exdate(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetimedate(value); -} - -/* TZID */ - -icalproperty* icalproperty_new_tzid(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_tzid((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_tzid(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_tzid((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_tzid(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_tzid(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* RESOURCES */ - -icalproperty* icalproperty_new_resources(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_resources((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_resources(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_resources((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_resources(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_resources(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* TZURL */ - -icalproperty* icalproperty_new_tzurl(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_tzurl((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_tzurl(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_tzurl((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_tzurl(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_uri(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_tzurl(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_uri(value); -} - -/* REPEAT */ - -icalproperty* icalproperty_new_repeat(int v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REPEAT_PROPERTY); - - - icalproperty_set_repeat((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_repeat(int v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REPEAT_PROPERTY); - - - icalproperty_set_repeat((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_repeat(icalproperty* prop, int v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_integer(v); - - icalproperty_set_value(prop,value); - -} - -int icalproperty_get_repeat(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_integer(value); -} - -/* PRIORITY */ - -icalproperty* icalproperty_new_priority(int v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRIORITY_PROPERTY); - - - icalproperty_set_priority((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_priority(int v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRIORITY_PROPERTY); - - - icalproperty_set_priority((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_priority(icalproperty* prop, int v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_integer(v); - - icalproperty_set_value(prop,value); - -} - -int icalproperty_get_priority(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_integer(value); -} - -/* FREEBUSY */ - -icalproperty* icalproperty_new_freebusy(struct icalperiodtype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_FREEBUSY_PROPERTY); - - - icalproperty_set_freebusy((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_FREEBUSY_PROPERTY); - - - icalproperty_set_freebusy((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_period(v); - - icalproperty_set_value(prop,value); - -} - -struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_period(value); -} - -/* DTSTART */ - -icalproperty* icalproperty_new_dtstart(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTART_PROPERTY); - - - icalproperty_set_dtstart((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTART_PROPERTY); - - - icalproperty_set_dtstart((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetimedate(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_dtstart(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetimedate(value); -} - -/* RECURRENCE-ID */ - -icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RECURRENCEID_PROPERTY); - - - icalproperty_set_recurrenceid((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RECURRENCEID_PROPERTY); - - - icalproperty_set_recurrenceid((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetimedate(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetimedate(value); -} - -/* SUMMARY */ - -icalproperty* icalproperty_new_summary(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_summary((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_summary(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_summary((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_summary(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_summary(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* DTEND */ - -icalproperty* icalproperty_new_dtend(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTEND_PROPERTY); - - - icalproperty_set_dtend((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTEND_PROPERTY); - - - icalproperty_set_dtend((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetimedate(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_dtend(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetimedate(value); -} - -/* TZNAME */ - -icalproperty* icalproperty_new_tzname(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_tzname((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_tzname(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_tzname((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_tzname(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_tzname(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* RDATE */ - -icalproperty* icalproperty_new_rdate(struct icalperiodtype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RDATE_PROPERTY); - - - icalproperty_set_rdate((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_rdate(struct icalperiodtype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RDATE_PROPERTY); - - - icalproperty_set_rdate((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_rdate(icalproperty* prop, struct icalperiodtype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetimeperiod(v); - - icalproperty_set_value(prop,value); - -} - -struct icalperiodtype icalproperty_get_rdate(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetimeperiod(value); -} - -/* URL */ - -icalproperty* icalproperty_new_url(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_url((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_url(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_url((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_url(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_uri(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_url(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_uri(value); -} - -/* ATTACH */ - -icalproperty* icalproperty_new_attach(struct icalattachtype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); - - - icalproperty_set_attach((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); - - - icalproperty_set_attach((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_attach(v); - - icalproperty_set_value(prop,value); - -} - -struct icalattachtype icalproperty_get_attach(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_attach(value); -} - -/* X-LIC-CLUSTERCOUNT */ - -icalproperty* icalproperty_new_xlicclustercount(int v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); - - - icalproperty_set_xlicclustercount((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_xlicclustercount(int v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); - - - icalproperty_set_xlicclustercount((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_xlicclustercount(icalproperty* prop, int v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_integer(v); - - icalproperty_set_value(prop,value); - -} - -int icalproperty_get_xlicclustercount(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_integer(value); -} - -/* EXRULE */ - -icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY); - - - icalproperty_set_exrule((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY); - - - icalproperty_set_exrule((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_recur(v); - - icalproperty_set_value(prop,value); - -} - -struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_recur(value); -} - -/* QUERY */ - -icalproperty* icalproperty_new_query(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_query((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_query(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_query((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_query(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_query(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_query(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_query(value); -} - -/* PERCENT-COMPLETE */ - -icalproperty* icalproperty_new_percentcomplete(int v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY); - - - icalproperty_set_percentcomplete((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_percentcomplete(int v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY); - - - icalproperty_set_percentcomplete((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_percentcomplete(icalproperty* prop, int v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_integer(v); - - icalproperty_set_value(prop,value); - -} - -int icalproperty_get_percentcomplete(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_integer(value); -} - -/* CALSCALE */ - -icalproperty* icalproperty_new_calscale(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_calscale((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_calscale(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_calscale((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_calscale(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_calscale(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} - -/* CREATED */ - -icalproperty* icalproperty_new_created(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CREATED_PROPERTY); - - - icalproperty_set_created((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CREATED_PROPERTY); - - - icalproperty_set_created((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_created(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetime(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_created(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetime(value); -} - -/* GEO */ - -icalproperty* icalproperty_new_geo(struct icalgeotype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_GEO_PROPERTY); - - - icalproperty_set_geo((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_GEO_PROPERTY); - - - icalproperty_set_geo((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_geo(v); - - icalproperty_set_value(prop,value); - -} - -struct icalgeotype icalproperty_get_geo(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_geo(value); -} - -/* COMPLETED */ - -icalproperty* icalproperty_new_completed(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMPLETED_PROPERTY); - - - icalproperty_set_completed((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMPLETED_PROPERTY); - - - icalproperty_set_completed((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetime(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_completed(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetime(value); -} - -/* DTSTAMP */ - -icalproperty* icalproperty_new_dtstamp(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTAMP_PROPERTY); - - - icalproperty_set_dtstamp((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTAMP_PROPERTY); - - - icalproperty_set_dtstamp((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetime(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetime(value); -} - -/* DUE */ - -icalproperty* icalproperty_new_due(struct icaltimetype v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DUE_PROPERTY); - - - icalproperty_set_due((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DUE_PROPERTY); - - - icalproperty_set_due((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_due(icalproperty* prop, struct icaltimetype v) -{ - icalvalue *value; - - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_datetimedate(v); - - icalproperty_set_value(prop,value); - -} - -struct icaltimetype icalproperty_get_due(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_datetimedate(value); -} - -/* ACTION */ - -icalproperty* icalproperty_new_action(char* v) -{ - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ACTION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_action((icalproperty*)impl,v); - - return (icalproperty*)impl; -} - -icalproperty* icalproperty_vanew_action(char* v, ...) -{ - va_list args; - struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ACTION_PROPERTY); - icalerror_check_arg_rz( (v!=0),"v"); - - - icalproperty_set_action((icalproperty*)impl,v); - - va_start(args,v); - icalproperty_add_parameters(impl, args); - va_end(args); - - return (icalproperty*)impl; -} - -void icalproperty_set_action(icalproperty* prop, char* v) -{ - icalvalue *value; - - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_arg_rv( (prop!=0),"prop"); - - value = icalvalue_new_text(v); - - icalproperty_set_value(prop,value); - -} - -char* icalproperty_get_action(icalproperty* prop) -{ - icalvalue *value; - icalerror_check_arg( (prop!=0),"prop"); - - value = icalproperty_get_value(prop); - - return icalvalue_get_text(value); -} diff --git a/libical/src/libical/icalproperty.h b/libical/src/libical/icalproperty.h deleted file mode 100644 index 2cd28fe179..0000000000 --- a/libical/src/libical/icalproperty.h +++ /dev/null @@ -1,368 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalderivedproperties.{c,h} - CREATOR: eric 09 May 1999 - - $Id$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - - -#ifndef ICALPROPERTY_H -#define ICALPROPERTY_H - -#include - -typedef void icalproperty; - -icalproperty* icalproperty_new(icalproperty_kind kind); - -icalproperty* icalproperty_new_clone(icalproperty * prop); - -icalproperty* icalproperty_new_from_string(char* str); - -char* icalproperty_as_ical_string(icalproperty* prop); - -void icalproperty_free(icalproperty* prop); - -icalproperty_kind icalproperty_isa(icalproperty* property); -int icalproperty_isa_property(void* property); - -void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter); - -void icalproperty_remove_parameter(icalproperty* prop, - icalparameter_kind kind); - -int icalproperty_count_parameters(icalproperty* prop); - -/* Iterate through the parameters */ -icalparameter* icalproperty_get_first_parameter(icalproperty* prop, - icalparameter_kind kind); -icalparameter* icalproperty_get_next_parameter(icalproperty* prop, - icalparameter_kind kind); -/* Access the value of the property */ -void icalproperty_set_value(icalproperty* prop, icalvalue* value); -icalvalue* icalproperty_get_value(icalproperty* prop); - -/* Deal with X properties */ - -void icalproperty_set_x_name(icalproperty* prop, char* name); -char* icalproperty_get_x_name(icalproperty* prop); - - -/* Everything below this line is machine generated. Do not edit. */ - -/* METHOD */ -icalproperty* icalproperty_new_method(icalproperty_method v); -icalproperty* icalproperty_vanew_method(icalproperty_method v, ...); -void icalproperty_set_method(icalproperty* prop, icalproperty_method v); -icalproperty_method icalproperty_get_method(icalproperty* prop); - -/* LAST-MODIFIED */ -icalproperty* icalproperty_new_lastmodified(struct icaltimetype v); -icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...); -void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop); - -/* UID */ -icalproperty* icalproperty_new_uid(char* v); -icalproperty* icalproperty_vanew_uid(char* v, ...); -void icalproperty_set_uid(icalproperty* prop, char* v); -char* icalproperty_get_uid(icalproperty* prop); - -/* PRODID */ -icalproperty* icalproperty_new_prodid(char* v); -icalproperty* icalproperty_vanew_prodid(char* v, ...); -void icalproperty_set_prodid(icalproperty* prop, char* v); -char* icalproperty_get_prodid(icalproperty* prop); - -/* STATUS */ -icalproperty* icalproperty_new_status(char* v); -icalproperty* icalproperty_vanew_status(char* v, ...); -void icalproperty_set_status(icalproperty* prop, char* v); -char* icalproperty_get_status(icalproperty* prop); - -/* DESCRIPTION */ -icalproperty* icalproperty_new_description(char* v); -icalproperty* icalproperty_vanew_description(char* v, ...); -void icalproperty_set_description(icalproperty* prop, char* v); -char* icalproperty_get_description(icalproperty* prop); - -/* DURATION */ -icalproperty* icalproperty_new_duration(struct icaldurationtype v); -icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...); -void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v); -struct icaldurationtype icalproperty_get_duration(icalproperty* prop); - -/* CATEGORIES */ -icalproperty* icalproperty_new_categories(char* v); -icalproperty* icalproperty_vanew_categories(char* v, ...); -void icalproperty_set_categories(icalproperty* prop, char* v); -char* icalproperty_get_categories(icalproperty* prop); - -/* VERSION */ -icalproperty* icalproperty_new_version(char* v); -icalproperty* icalproperty_vanew_version(char* v, ...); -void icalproperty_set_version(icalproperty* prop, char* v); -char* icalproperty_get_version(icalproperty* prop); - -/* TZOFFSETFROM */ -icalproperty* icalproperty_new_tzoffsetfrom(int v); -icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...); -void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v); -int icalproperty_get_tzoffsetfrom(icalproperty* prop); - -/* RRULE */ -icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v); -icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...); -void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v); -struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop); - -/* ATTENDEE */ -icalproperty* icalproperty_new_attendee(char* v); -icalproperty* icalproperty_vanew_attendee(char* v, ...); -void icalproperty_set_attendee(icalproperty* prop, char* v); -char* icalproperty_get_attendee(icalproperty* prop); - -/* CONTACT */ -icalproperty* icalproperty_new_contact(char* v); -icalproperty* icalproperty_vanew_contact(char* v, ...); -void icalproperty_set_contact(icalproperty* prop, char* v); -char* icalproperty_get_contact(icalproperty* prop); - -/* RELATED-TO */ -icalproperty* icalproperty_new_relatedto(char* v); -icalproperty* icalproperty_vanew_relatedto(char* v, ...); -void icalproperty_set_relatedto(icalproperty* prop, char* v); -char* icalproperty_get_relatedto(icalproperty* prop); - -/* ORGANIZER */ -icalproperty* icalproperty_new_organizer(char* v); -icalproperty* icalproperty_vanew_organizer(char* v, ...); -void icalproperty_set_organizer(icalproperty* prop, char* v); -char* icalproperty_get_organizer(icalproperty* prop); - -/* COMMENT */ -icalproperty* icalproperty_new_comment(char* v); -icalproperty* icalproperty_vanew_comment(char* v, ...); -void icalproperty_set_comment(icalproperty* prop, char* v); -char* icalproperty_get_comment(icalproperty* prop); - -/* TRIGGER */ -icalproperty* icalproperty_new_trigger(union icaltriggertype v); -icalproperty* icalproperty_vanew_trigger(union icaltriggertype v, ...); -void icalproperty_set_trigger(icalproperty* prop, union icaltriggertype v); -union icaltriggertype icalproperty_get_trigger(icalproperty* prop); - -/* X-LIC-ERROR */ -icalproperty* icalproperty_new_xlicerror(char* v); -icalproperty* icalproperty_vanew_xlicerror(char* v, ...); -void icalproperty_set_xlicerror(icalproperty* prop, char* v); -char* icalproperty_get_xlicerror(icalproperty* prop); - -/* CLASS */ -icalproperty* icalproperty_new_class(char* v); -icalproperty* icalproperty_vanew_class(char* v, ...); -void icalproperty_set_class(icalproperty* prop, char* v); -char* icalproperty_get_class(icalproperty* prop); - -/* TZOFFSETTO */ -icalproperty* icalproperty_new_tzoffsetto(int v); -icalproperty* icalproperty_vanew_tzoffsetto(int v, ...); -void icalproperty_set_tzoffsetto(icalproperty* prop, int v); -int icalproperty_get_tzoffsetto(icalproperty* prop); - -/* TRANSP */ -icalproperty* icalproperty_new_transp(char* v); -icalproperty* icalproperty_vanew_transp(char* v, ...); -void icalproperty_set_transp(icalproperty* prop, char* v); -char* icalproperty_get_transp(icalproperty* prop); - -/* SEQUENCE */ -icalproperty* icalproperty_new_sequence(int v); -icalproperty* icalproperty_vanew_sequence(int v, ...); -void icalproperty_set_sequence(icalproperty* prop, int v); -int icalproperty_get_sequence(icalproperty* prop); - -/* LOCATION */ -icalproperty* icalproperty_new_location(char* v); -icalproperty* icalproperty_vanew_location(char* v, ...); -void icalproperty_set_location(icalproperty* prop, char* v); -char* icalproperty_get_location(icalproperty* prop); - -/* REQUEST-STATUS */ -icalproperty* icalproperty_new_requeststatus(char* v); -icalproperty* icalproperty_vanew_requeststatus(char* v, ...); -void icalproperty_set_requeststatus(icalproperty* prop, char* v); -char* icalproperty_get_requeststatus(icalproperty* prop); - -/* EXDATE */ -icalproperty* icalproperty_new_exdate(struct icaltimetype v); -icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...); -void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_exdate(icalproperty* prop); - -/* TZID */ -icalproperty* icalproperty_new_tzid(char* v); -icalproperty* icalproperty_vanew_tzid(char* v, ...); -void icalproperty_set_tzid(icalproperty* prop, char* v); -char* icalproperty_get_tzid(icalproperty* prop); - -/* RESOURCES */ -icalproperty* icalproperty_new_resources(char* v); -icalproperty* icalproperty_vanew_resources(char* v, ...); -void icalproperty_set_resources(icalproperty* prop, char* v); -char* icalproperty_get_resources(icalproperty* prop); - -/* TZURL */ -icalproperty* icalproperty_new_tzurl(char* v); -icalproperty* icalproperty_vanew_tzurl(char* v, ...); -void icalproperty_set_tzurl(icalproperty* prop, char* v); -char* icalproperty_get_tzurl(icalproperty* prop); - -/* REPEAT */ -icalproperty* icalproperty_new_repeat(int v); -icalproperty* icalproperty_vanew_repeat(int v, ...); -void icalproperty_set_repeat(icalproperty* prop, int v); -int icalproperty_get_repeat(icalproperty* prop); - -/* PRIORITY */ -icalproperty* icalproperty_new_priority(int v); -icalproperty* icalproperty_vanew_priority(int v, ...); -void icalproperty_set_priority(icalproperty* prop, int v); -int icalproperty_get_priority(icalproperty* prop); - -/* FREEBUSY */ -icalproperty* icalproperty_new_freebusy(struct icalperiodtype v); -icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...); -void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v); -struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop); - -/* DTSTART */ -icalproperty* icalproperty_new_dtstart(struct icaltimetype v); -icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...); -void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_dtstart(icalproperty* prop); - -/* RECURRENCE-ID */ -icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v); -icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...); -void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop); - -/* SUMMARY */ -icalproperty* icalproperty_new_summary(char* v); -icalproperty* icalproperty_vanew_summary(char* v, ...); -void icalproperty_set_summary(icalproperty* prop, char* v); -char* icalproperty_get_summary(icalproperty* prop); - -/* DTEND */ -icalproperty* icalproperty_new_dtend(struct icaltimetype v); -icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...); -void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_dtend(icalproperty* prop); - -/* TZNAME */ -icalproperty* icalproperty_new_tzname(char* v); -icalproperty* icalproperty_vanew_tzname(char* v, ...); -void icalproperty_set_tzname(icalproperty* prop, char* v); -char* icalproperty_get_tzname(icalproperty* prop); - -/* RDATE */ -icalproperty* icalproperty_new_rdate(struct icalperiodtype v); -icalproperty* icalproperty_vanew_rdate(struct icalperiodtype v, ...); -void icalproperty_set_rdate(icalproperty* prop, struct icalperiodtype v); -struct icalperiodtype icalproperty_get_rdate(icalproperty* prop); - -/* URL */ -icalproperty* icalproperty_new_url(char* v); -icalproperty* icalproperty_vanew_url(char* v, ...); -void icalproperty_set_url(icalproperty* prop, char* v); -char* icalproperty_get_url(icalproperty* prop); - -/* ATTACH */ -icalproperty* icalproperty_new_attach(struct icalattachtype v); -icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...); -void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v); -struct icalattachtype icalproperty_get_attach(icalproperty* prop); - -/* X-LIC-CLUSTERCOUNT */ -icalproperty* icalproperty_new_xlicclustercount(int v); -icalproperty* icalproperty_vanew_xlicclustercount(int v, ...); -void icalproperty_set_xlicclustercount(icalproperty* prop, int v); -int icalproperty_get_xlicclustercount(icalproperty* prop); - -/* EXRULE */ -icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v); -icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...); -void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v); -struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop); - -/* QUERY */ -icalproperty* icalproperty_new_query(char* v); -icalproperty* icalproperty_vanew_query(char* v, ...); -void icalproperty_set_query(icalproperty* prop, char* v); -char* icalproperty_get_query(icalproperty* prop); - -/* PERCENT-COMPLETE */ -icalproperty* icalproperty_new_percentcomplete(int v); -icalproperty* icalproperty_vanew_percentcomplete(int v, ...); -void icalproperty_set_percentcomplete(icalproperty* prop, int v); -int icalproperty_get_percentcomplete(icalproperty* prop); - -/* CALSCALE */ -icalproperty* icalproperty_new_calscale(char* v); -icalproperty* icalproperty_vanew_calscale(char* v, ...); -void icalproperty_set_calscale(icalproperty* prop, char* v); -char* icalproperty_get_calscale(icalproperty* prop); - -/* CREATED */ -icalproperty* icalproperty_new_created(struct icaltimetype v); -icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...); -void icalproperty_set_created(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_created(icalproperty* prop); - -/* GEO */ -icalproperty* icalproperty_new_geo(struct icalgeotype v); -icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...); -void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v); -struct icalgeotype icalproperty_get_geo(icalproperty* prop); - -/* COMPLETED */ -icalproperty* icalproperty_new_completed(struct icaltimetype v); -icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...); -void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_completed(icalproperty* prop); - -/* DTSTAMP */ -icalproperty* icalproperty_new_dtstamp(struct icaltimetype v); -icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...); -void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop); - -/* DUE */ -icalproperty* icalproperty_new_due(struct icaltimetype v); -icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...); -void icalproperty_set_due(icalproperty* prop, struct icaltimetype v); -struct icaltimetype icalproperty_get_due(icalproperty* prop); - -/* ACTION */ -icalproperty* icalproperty_new_action(char* v); -icalproperty* icalproperty_vanew_action(char* v, ...); -void icalproperty_set_action(icalproperty* prop, char* v); -char* icalproperty_get_action(icalproperty* prop); -#endif ICALPROPERTY_H diff --git a/libical/src/libical/icalrestriction.c b/libical/src/libical/icalrestriction.c deleted file mode 100644 index 9393b3ea34..0000000000 --- a/libical/src/libical/icalrestriction.c +++ /dev/null @@ -1,1582 +0,0 @@ -/* -*- Mode: C -*- */ -/* ====================================================================== - File: icalrestriction.c - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - - ======================================================================*/ - -#include "icalenums.h" -#include "icalrestriction.h" - -/* Define the structs for the restrictions. these data are filled out -in machine generated code below */ - -typedef int (*restriction_func)(icalcomponent* comp); - -typedef struct icalrestriction_property_record { - icalproperty_method method; - icalcomponent_kind component; - icalproperty_kind property; - icalrestriction_kind restriction; - restriction_func function; -} icalrestriction_property_record; - - -typedef struct icalrestriction_component_record { - icalproperty_method method; - icalcomponent_kind component; - icalcomponent_kind subcomponent; - icalrestriction_kind restriction; - restriction_func function; -} icalrestriction_component_record; - -icalrestriction_component_record icalrestriction_component_records[]; -icalrestriction_property_record icalrestriction_property_records[]; - -/* The each row gives the result of comparing a restriction against a - count. The columns in each row represent 0,1,2+. '-1' indicates - 'invalid, 'don't care' or 'needs more analysis' */ - -char compare_map[ICAL_RESTRICTION_UNKNOWN+1][3] = { - { 1, 1, 1},/*ICAL_RESTRICTION_NONE*/ - { 1, 0, 0},/*ICAL_RESTRICTION_ZERO*/ - { 0, 1, 0},/*ICAL_RESTRICTION_ONE*/ - { 1, 1, 1},/*ICAL_RESTRICTION_ZEROPLUS*/ - { 0, 1, 1},/*ICAL_RESTRICTION_ONEPLUS*/ - { 1, 1, 0},/*ICAL_RESTRICTION_ZEROORONE*/ - { 1, 1, 0},/*ICAL_RESTRICTION_ONEEXCLUSIVE*/ - { 1, 1, 0},/*ICAL_RESTRICTION_ONEMUTUAL*/ - { 1, 1, 1} /*ICAL_RESTRICTION_UNKNOWN*/ -}; - -char restr_string_map[ICAL_RESTRICTION_UNKNOWN+1][60] = { - "unknown number",/*ICAL_RESTRICTION_NONE*/ - "0",/*ICAL_RESTRICTION_ZERO*/ - "1",/*ICAL_RESTRICTION_ONE*/ - "zero or more",/*ICAL_RESTRICTION_ZEROPLUS*/ - "one or more" ,/*ICAL_RESTRICTION_ONEPLUS*/ - "zero or more",/*ICAL_RESTRICTION_ZEROORONE*/ - "zero or one, exclusive with another property",/*ICAL_RESTRICTION_ONEEXCLUSIVE*/ - "zero or one, mutual with another property",/*ICAL_RESTRICTION_ONEMUTUAL*/ - "unknown number" /*ICAL_RESTRICTION_UNKNOWN*/ -}; - - -int -icalrestriction_compare(icalrestriction_kind restr, int count){ - - if ( restr < ICAL_RESTRICTION_NONE || restr > ICAL_RESTRICTION_UNKNOWN - || count < 0){ - return -1; - } - - if (count > 2) { - count = 2; - } - - return compare_map[restr][count]; - -} - -int icalrestriction_check_component(icalproperty_method method, - icalcomponent* comp) -{ - icalproperty_kind kind; - icalcomponent_kind comp_kind; - icalrestriction_kind restr; - int count; - int compare; - int valid = 1; - - comp_kind = icalcomponent_isa(comp); - - /* Check all of the properties in this component */ - - for(kind = ICAL_ANY_PROPERTY+1; kind != ICAL_NO_PROPERTY; kind++){ - count = icalcomponent_count_properties(comp, kind); - - restr = icalrestriction_get_property_restriction(method, - comp_kind, - kind); - - - if(restr == ICAL_RESTRICTION_ONEEXCLUSIVE ) { - /* HACK. Treat this as a 0/1 restriction */ - restr = ICAL_RESTRICTION_ZEROORONE; - compare = icalrestriction_compare(restr,count); - } else if (restr == ICAL_RESTRICTION_ONEMUTUAL ) { - /* HACK. Treat this as a 0/1 restriction */ - restr = ICAL_RESTRICTION_ZEROORONE; - compare = icalrestriction_compare(restr,count); - } else { - compare = icalrestriction_compare(restr,count); - } - - assert(compare != -1); - - - if (compare == 0){ - char temp[1024]; - - sprintf(temp, "Failed iTIP restrictions for property %s. Expected %s instances of the property and got %d", - icalenum_property_kind_to_string(kind), - restr_string_map[restr], count); - - icalcomponent_add_property - (comp, - icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP), - 0)); - } - - - valid = valid && compare; - } - - - - return valid; - - -} - -int icalrestriction_check(icalcomponent* outer_comp) -{ - icalcomponent_kind comp_kind; - icalproperty_method method; - icalcomponent* inner_comp; - icalproperty *method_prop; - int valid; - - icalerror_check_arg_rz( (outer_comp!=0), "outer comp"); - - - /* Get the Method value from the outer component */ - - comp_kind = icalcomponent_isa(outer_comp); - - if (comp_kind != ICAL_VCALENDAR_COMPONENT){ - icalerror_set_errno(ICAL_BADARG_ERROR); - return 0; - } - - method_prop = icalcomponent_get_first_property(outer_comp, - ICAL_METHOD_PROPERTY); - - if (method_prop == 0){ - method = ICAL_METHOD_NONE; - } else { - method = icalproperty_get_method(method_prop); - } - - - /* Check the VCALENDAR wrapper */ - valid = icalrestriction_check_component(ICAL_METHOD_NONE,outer_comp); - - - /* Now check the inner components */ - - for(inner_comp= icalcomponent_get_first_component(outer_comp, - ICAL_ANY_COMPONENT); - inner_comp != 0; - inner_comp= icalcomponent_get_next_component(outer_comp, - ICAL_ANY_COMPONENT)){ - - valid = valid && icalrestriction_check_component(method,inner_comp); - - } - - - return valid; - -} - -icalrestriction_kind -icalrestriction_get_property_restriction(icalproperty_method method, - icalcomponent_kind component, - icalproperty_kind property) -{ - int i; - - for(i = 0; - icalrestriction_property_records[i].restriction != ICAL_RESTRICTION_NONE; - i++){ - - if (method == icalrestriction_property_records[i].method && - component == icalrestriction_property_records[i].component && - property == icalrestriction_property_records[i].property ){ - return icalrestriction_property_records[i].restriction; - } - } - - return ICAL_RESTRICTION_UNKNOWN; -} - -icalrestriction_kind -icalrestriction_get_component_restriction(icalproperty_method method, - icalcomponent_kind component, - icalcomponent_kind subcomponent) -{ - - int i; - - for(i = 0; - icalrestriction_component_records[i].restriction != ICAL_RESTRICTION_NONE; - i++){ - - if (method == icalrestriction_component_records[i].method && - component == icalrestriction_component_records[i].component && - subcomponent == icalrestriction_component_records[i].subcomponent ){ - return icalrestriction_component_records[i].restriction; - } - } - - return ICAL_RESTRICTION_UNKNOWN; -} - -/* Everything below this line is machine generated. Do not edit. */ -icalrestriction_property_record icalrestriction_property_records[] = { - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE} -}; -icalrestriction_component_record icalrestriction_component_records[] = { - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO}, - {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE} -}; diff --git a/libical/src/libical/icalrestriction.h b/libical/src/libical/icalrestriction.h deleted file mode 100644 index ca4beeea7b..0000000000 --- a/libical/src/libical/icalrestriction.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalrestriction.h - CREATOR: eric 24 April 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalrestriction.h - - Contributions from: - Graham Davison (g.m.davison@computer.org) - - -======================================================================*/ - -#include "ical.h" - -#ifndef ICALRESTRICTION_H -#define ICALRESTRICTION_H - -/* These must stay in this order for icalrestriction_compare to work */ -typedef enum icalrestriction_kind { - ICAL_RESTRICTION_NONE=0, /* 0 */ - ICAL_RESTRICTION_ZERO, /* 1 */ - ICAL_RESTRICTION_ONE, /* 2 */ - ICAL_RESTRICTION_ZEROPLUS, /* 3 */ - ICAL_RESTRICTION_ONEPLUS, /* 4 */ - ICAL_RESTRICTION_ZEROORONE, /* 5 */ - ICAL_RESTRICTION_ONEEXCLUSIVE, /* 6 */ - ICAL_RESTRICTION_ONEMUTUAL, /* 7 */ - ICAL_RESTRICTION_UNKNOWN /* 8 */ -} icalrestriction_kind; - -int -icalrestriction_compare(icalrestriction_kind restr, int count); - -icalrestriction_kind -icalrestriction_get_property_restriction(icalproperty_method method, - icalcomponent_kind component, - icalproperty_kind property); - -icalrestriction_kind -icalrestriction_get_component_restriction(icalproperty_method method, - icalcomponent_kind component, - icalcomponent_kind subcomponent); - -int -icalrestriction_is_parameter_allowed(icalproperty_kind property, - icalparameter_kind parameter); - -int icalrestriction_check(icalcomponent* comp); - - -#endif /* !ICALRESTRICTION_H */ - - - diff --git a/libical/src/libical/icaltypes.c b/libical/src/libical/icaltypes.c deleted file mode 100644 index 14daa2915d..0000000000 --- a/libical/src/libical/icaltypes.c +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icaltypes.c - CREATOR: eric 16 May 1999 - - $Id$ - $Locker$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icaltypes.c - - ======================================================================*/ - -#include "icaltypes.h" -#include "icalerror.h" -#include /* for malloc */ -#include /* for errno */ -#include /* for strdup */ -#include -#include /* for SHRT_MAX */ - -void* -icalattachtype_get_data (struct icalattachtype* type); - -struct icalattachtype* -icalattachtype_new() -{ - struct icalattachtype* v; - - if ( ( v = (struct icalattachtype*) - malloc(sizeof(struct icalattachtype))) == 0) { - errno = ENOMEM; - return 0; - } - - v->refcount = 1; - - v->binary = 0; - v->owns_binary = 0; - - v->base64 = 0; - v->owns_base64 = 0; - - v->url = 0; - - return v; -} - - -void -icalattachtype_free(struct icalattachtype* v) -{ - icalerror_check_arg( (v!=0),"v"); - - v->refcount--; - - if (v->refcount <= 0){ - - if (v->base64 != 0 && v->owns_base64 != 0){ - free(v->base64); - } - - if (v->binary != 0 && v->owns_binary != 0){ - free(v->binary); - } - - if (v->url != 0){ - free(v->url); - } - - free(v); - } -} - -void icalattachtype_add_reference(struct icalattachtype* v) -{ - icalerror_check_arg( (v!=0),"v"); - v->refcount++; -} - -void icalattachtype_set_url(struct icalattachtype* v, char* url) -{ - icalerror_check_arg( (v!=0),"v"); - - if (v->url != 0){ - free (v->url); - } - - v->url = strdup(url); - - /* HACK This routine should do something if strdup returns NULL */ - -} - -char* icalattachtype_get_url(struct icalattachtype* v) -{ - icalerror_check_arg( (v!=0),"v"); - return v->url; -} - -void icalattachtype_set_base64(struct icalattachtype* v, char* base64, - int owns) -{ - icalerror_check_arg( (v!=0),"v"); - - v->base64 = base64; - v->owns_base64 = !(owns != 0 ); - -} - -char* icalattachtype_get_base64(struct icalattachtype* v) -{ - icalerror_check_arg( (v!=0),"v"); - return v->base64; -} - -void icalattachtype_set_binary(struct icalattachtype* v, char* binary, - int owns) -{ - icalerror_check_arg( (v!=0),"v"); - - v->binary = binary; - v->owns_binary = !(owns != 0 ); - -} - -void* icalattachtype_get_binary(struct icalattachtype* v) -{ - icalerror_check_arg( (v!=0),"v"); - return v->binary; -} - - - -time_t -icalperiodtype_duration (struct icalperiodtype period); - - -time_t -icalperiodtype_end (struct icalperiodtype period); - -struct icaltimetype -icaltimetype_from_timet(time_t v, int date) -{ - struct icaltimetype tt; - struct tm t; - time_t tm = time(&v); - -/* HACK Does not properly consider timezone */ - t = *(gmtime(&tm)); - - tt.second = t.tm_sec; - tt.minute = t.tm_min; - tt.hour = t.tm_hour; - tt.day = t.tm_mday; - tt.month = t.tm_mon + 1; - tt.year = t.tm_year+ 1900; - - tt.is_utc = 1; - tt.is_date = date; - - return tt; -} - -/* From Russel Steinthal */ -time_t icaldurationtype_as_timet(struct icaldurationtype dur) -{ - return (time_t) (dur.seconds + - (60 * dur.minutes) + - (60 * 60 * dur.hours) + - (60 * 60 * 24 * dur.days) + - (60 * 60 * 24 * 7 * dur.weeks)); -} - - -void icalrecurrencetype_clear(struct icalrecurrencetype *recur) -{ - memset(recur,ICAL_RECURRENCE_ARRAY_MAX_BYTE, - sizeof(struct icalrecurrencetype)); - - recur->week_start = ICAL_NO_WEEKDAY; - recur->freq = ICAL_NO_RECURRENCE; - recur->interval = 0; - recur->until.year = 0; - recur->count = 0; -} diff --git a/libical/src/libical/icaltypes.h b/libical/src/libical/icaltypes.h deleted file mode 100644 index c33e8acd7d..0000000000 --- a/libical/src/libical/icaltypes.h +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icaltypes.h - CREATOR: eric 20 March 1999 - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icaltypes.h - -======================================================================*/ - -#ifndef ICALTYPES_H -#define ICALTYPES_H - -#include -#include "icalenums.h" /* for recurrence enums */ - -/* This type type should probably be an opaque type... */ -struct icalattachtype -{ - void* binary; - int owns_binary; - - char* base64; - int owns_base64; - - char* url; - - int refcount; - -}; - -/* converts base64 to binary, fetches url and stores as binary, or - just returns data */ - -struct icalattachtype* icalattachtype_new(); -void icalattachtype_add_reference(struct icalattachtype* v); -void icalattachtype_free(struct icalattachtype* v); - -void icalattachtype_set_url(struct icalattachtype* v, char* url); -char* icalattachtype_get_url(struct icalattachtype* v); - -void icalattachtype_set_base64(struct icalattachtype* v, char* base64, - int owns); -char* icalattachtype_get_base64(struct icalattachtype* v); - -void icalattachtype_set_binary(struct icalattachtype* v, char* binary, - int owns); -void* icalattachtype_get_binary(struct icalattachtype* v); - -struct icalgeotype -{ - float lat; - float lon; -}; - -struct icaltimetype -{ - int year; - int month; - int day; - int hour; - int minute; - int second; - - int is_utc; /* 1-> time is in UTC timezone */ - - int is_date; /* 1 -> interpret this as date. */ -}; - -struct icaltimetype icaltimetype_from_timet(time_t v, int is_date); - - -/* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of - the values and fields in struct icalrecurrencetype */ - - -struct icalrecurrencetype -{ - icalrecurrencetype_frequency freq; - - - /* until and count are mutually exclusive. */ - struct icaltimetype until; - int count; - - short interval; - - icalrecurrencetype_weekday week_start; - - /* The BY* parameters can each take a list of values. Here I - * assume that the list of values will not be larger than the - * range of the value -- that is, the client will not name a - * value more than once. - - * Each of the lists is terminated with the value SHRT_MAX - * unless the the list is full. */ - - short by_second[61]; - short by_minute[61]; - short by_hour[25]; - short by_day[8]; - short by_month_day[32]; - short by_year_day[367]; - short by_week_no[54]; - short by_month[13]; - short by_set_pos[367]; -}; - - -void icalrecurrencetype_clear(struct icalrecurrencetype *r); - -struct icaldurationtype -{ - unsigned int days; - unsigned int weeks; - unsigned int hours; - unsigned int minutes; - unsigned int seconds; -}; - -struct icaldurationtype icaldurationtype_from_timet(time_t t); -time_t icaldurationtype_as_timet(struct icaldurationtype duration); - -/* Return the next occurance of 'r' after the time specified by 'after' */ -struct icaltimetype icalrecurrencetype_next_occurance( - struct icalrecurrencetype *r, - struct icaltimetype *after); - - -struct icalperiodtype -{ - struct icaltimetype start; /* Must be absolute */ - struct icaltimetype end; /* Must be absolute */ - struct icaldurationtype duration; -}; - -time_t icalperiodtype_duration(struct icalperiodtype period); -time_t icalperiodtype_end(struct icalperiodtype period); - -union icaltriggertype -{ - struct icaltimetype time; - struct icaldurationtype duration; -}; - -struct icalrequestsstatustype { - - short minor; - short major; - -}; - - -#endif /* !ICALTYPES_H */ diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c deleted file mode 100644 index 1ed83a0c6e..0000000000 --- a/libical/src/libical/icalvalue.c +++ /dev/null @@ -1,2043 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalvalue.c - CREATOR: eric 02 May 1999 - - $Id$ - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalvalue.c - - Contributions from: - Graham Davison (g.m.davison@computer.org) - - -======================================================================*/ - - -#include "ical.h" -#include "icalerror.h" -#include "icalmemory.h" -#include "icalparser.h" -#include "icalenums.h" - -#include /* for malloc */ -#include /* for sprintf */ -#include /* For memset, others */ -#include -#include /* for mktime */ -#include /* for atoi and atof */ -#include /* for SHRT_MAX */ - -#if _MAC_OS_ -#include "strdup.h" -#endif - -void print_datetime_to_string(char* str, struct icaltimetype *data); -void print_date_to_string(char* str, struct icaltimetype *data); -void print_time_to_string(char* str, struct icaltimetype *data); -void print_recur_to_string(char* str, struct icaltimetype *data); - -struct icalvalue_impl { - icalvalue_kind kind; - char id[5]; - int size; - icalproperty* parent; - - union data { - struct icalattachtype v_attach; - /* void *v_binary; */ /* use v_attach */ - char *v_string; - /*char *v_text;*/ - /*char *v_caladdress;*/ - /*char *v_uri;*/ - float v_float; - int v_int; - /*int v_boolean;*/ - /*int v_integer;*/ - struct icaldurationtype v_duration; - /*int v_utcoffset;*/ - - struct icalperiodtype v_period; - /*struct icalperiodtype v_datetimeperiod;*/ - struct icalgeotype v_geo; - /*time_t v_time;*/ - struct icaltimetype v_time; - /*struct icaltimetype v_date;*/ - /*struct icaltimetype v_datetime;*/ - /*struct icaltimetype v_datetimedate;*/ - - /* struct icalrecurrencetype was once a value in this - union, but it contributes 2000 bytes to every*/ - - struct icalrecurrencetype *v_recur; - union icaltriggertype v_trigger; - icalproperty_method v_method; - - } data; -}; - -struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind){ - - struct icalvalue_impl* v; - - if ( ( v = (struct icalvalue_impl*) - malloc(sizeof(struct icalvalue_impl))) == 0) { - errno = ENOMEM; - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - - strcpy(v->id,"val"); - - v->kind = kind; - v->size = 0; - v->parent = 0; - memset(&(v->data),0,sizeof(v->data)); - - return v; - -} - - - -icalvalue* -icalvalue_new (icalvalue_kind kind) -{ - return (icalvalue*)icalvalue_new_impl(kind); -} - -icalvalue* icalvalue_new_clone(icalvalue* value){ - - struct icalvalue_impl* new; - struct icalvalue_impl* old = (struct icalvalue_impl*)value; - - new = icalvalue_new_impl(old->kind); - - if (new == 0){ - return 0; - } - - - strcpy(new->id, old->id); - new->kind = old->kind; - new->size = old->size; - - switch (new->kind){ - - /* The contents of the attach value may or may not be owned by the - * library. */ - case ICAL_ATTACH_VALUE: - case ICAL_BINARY_VALUE: - { - /* HACK ugh. I don't feel like impleenting this */ - } - - case ICAL_TEXT_VALUE: - case ICAL_CALADDRESS_VALUE: - case ICAL_URI_VALUE: - { - if (old->data.v_string != 0) { - new->data.v_string=strdup(old->data.v_string); - - if ( new->data.v_string == 0 ) { - return 0; - } - - } - break; - } - case ICAL_RECUR_VALUE: - { - if(old->data.v_recur != 0){ - new->data.v_recur = malloc(sizeof(struct icalrecurrencetype)); - - if(new->data.v_recur == 0){ - return 0; - } - - memcpy( new->data.v_recur, old->data.v_recur, - sizeof(struct icalrecurrencetype)); - } - break; - } - - default: - { - /* all of the other types are stored as values, not - pointers, so we can just copy the whole structure. */ - - new->data = old->data; - } - } - - return new; -} - -icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,char* str,icalproperty** error) -{ - - icalvalue *value = 0; - - icalerror_check_arg_rz(str!=0,"str"); - - if (error != 0){ - *error = 0; - } - - switch (kind){ - - case ICAL_ATTACH_VALUE: - { - /* HACK */ - value = 0; - - if (error != 0){ - char temp[1024]; - sprintf(temp,"ATTACH Values are not implemented"); - *error = icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_VALUEPARSEERROR), - 0); - } - - icalerror_warn("Parsing ATTACH properties is unimplmeneted"); - break; - } - - case ICAL_BINARY_VALUE: - { - /* HACK */ - value = 0; - - if (error != 0){ - char temp[1024]; - sprintf(temp,"BINARY Values are not implemented"); - *error = icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_VALUEPARSEERROR), - 0); - } - - icalerror_warn("Parsing BINARY values is unimplmeneted"); - break; - } - - case ICAL_BOOLEAN_VALUE: - { - /* HACK */ - value = 0; - - if (error != 0){ - char temp[1024]; - sprintf(temp,"BOOLEAN Values are not implemented"); - *error = icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_VALUEPARSEERROR), - 0); - } - - icalerror_warn("Parsing BOOLEAN values is unimplmeneted"); - break; - } - - case ICAL_INTEGER_VALUE: - { - value = icalvalue_new_integer(atoi(str)); - break; - } - - case ICAL_FLOAT_VALUE: - { - value = icalvalue_new_float(atof(str)); - break; - } - - case ICAL_UTCOFFSET_VALUE: - { - value = icalparser_parse_value(kind,str,(icalcomponent*)0); - break; - } - - case ICAL_TEXT_VALUE: - { - value = icalvalue_new_text(str); - break; - } - - case ICAL_CALADDRESS_VALUE: - { - value = icalvalue_new_caladdress(str); - break; - } - - case ICAL_URI_VALUE: - { - value = icalvalue_new_uri(str); - break; - } - - case ICAL_METHOD_VALUE: - { - icalproperty_method method = icalenum_string_to_method(str); - value = icalvalue_new_method(method); - } - case ICAL_GEO_VALUE: - { - value = 0; - /* HACK */ - - if (error != 0){ - char temp[1024]; - sprintf(temp,"GEO Values are not implemented"); - *error = icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_VALUEPARSEERROR), - 0); - } - - /*icalerror_warn("Parsing GEO properties is unimplmeneted");*/ - - break; - } - - case ICAL_RECUR_VALUE: - case ICAL_DATE_VALUE: - case ICAL_DATETIME_VALUE: - case ICAL_DATETIMEDATE_VALUE: - case ICAL_DATETIMEPERIOD_VALUE: - case ICAL_TIME_VALUE: - case ICAL_DURATION_VALUE: - case ICAL_PERIOD_VALUE: - case ICAL_TRIGGER_VALUE: - { - value = icalparser_parse_value(kind,str,error); - break; - } - - default: - { - - if (error != 0 ){ - char temp[1024]; - - if (strlen(str) > 265) { - sprintf(temp,"Unknown type for \'%256s...\'",str); - } else { - sprintf(temp,"Unknown type for \'%s\'",str); - - } - - *error = icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_VALUEPARSEERROR), - 0); - } - - icalerror_warn("icalvalue_new_from_string got an unknown value type"); - value=0; - } - } - - - if (error != 0 && *error == 0 && value == 0){ - char temp[1024]; - - if (strlen(str) > 265) { - sprintf(temp,"Failed to parse value: \'%256s...\'",str); - } else { - sprintf(temp,"Failed to parse value: \'%s\'",str); - - } - - *error = icalproperty_vanew_xlicerror( - temp, - icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_VALUEPARSEERROR), - 0); - } - - - return value; - -} - -icalvalue* icalvalue_new_from_string(icalvalue_kind kind,char* str) -{ - return icalvalue_new_from_string_with_error(kind,str,(icalproperty*)0); -} - - - -void -icalvalue_free (icalvalue* value) -{ - struct icalvalue_impl* v = (struct icalvalue_impl*)value; - - icalerror_check_arg_rv((value != 0),"value"); - -#ifdef ICAL_FREE_ON_LIST_IS_ERROR - icalerror_assert( (v->parent ==0),"This value is still attached to a property"); - -#else - if(v->parent !=0){ - return; - } -#endif - - - switch (v->kind){ - case ICAL_BINARY_VALUE: - case ICAL_ATTACH_VALUE: { - /* HACK ugh. This will be tough to implement */ - } - case ICAL_TEXT_VALUE: - case ICAL_CALADDRESS_VALUE: - case ICAL_URI_VALUE: - { - if (v->data.v_string != 0) { - free(v->data.v_string); - v->data.v_string = 0; - } - break; - } - case ICAL_RECUR_VALUE: - { - if(v->data.v_recur != 0){ - free(v->data.v_recur); - v->data.v_recur = 0; - } - break; - } - - default: - { - /* Nothing to do */ - } - } - - v->kind = ICAL_NO_VALUE; - v->size = 0; - v->parent = 0; - memset(&(v->data),0,sizeof(v->data)); - v->id[0] = 'X'; - free(v); -} - -int -icalvalue_is_valid (icalvalue* value) -{ - /*struct icalvalue_impl* v = (struct icalvalue_impl*)value;*/ - - if(value == 0){ - return 0; - } - - return 1; -} - -char* icalvalue_binary_as_ical_string(icalvalue* value) { - - char* data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_binary(value); - - str = (char*)icalmemory_tmp_buffer(60); - sprintf(str,"icalvalue_binary_as_ical_string is not implemented yet"); - - return str; -} - - -char* icalvalue_int_as_ical_string(icalvalue* value) { - - int data; - char* str = (char*)icalmemory_tmp_buffer(2); - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_integer(value); - - sprintf(str,"%d",data); - - return str; -} - -char* icalvalue_utcoffset_as_ical_string(icalvalue* value) -{ - int data,h,m,s; - char sign; - char* str = (char*)icalmemory_tmp_buffer(9); - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_utcoffset(value); - - if (abs(data) == data){ - sign = '+'; - } else { - sign = '-'; - } - - h = data/3600; - m = (data - (h*3600))/ 60; - s = (data - (h*3600) - (m*60)); - - sprintf(str,"%c%02d%02d%02d",sign,abs(h),abs(m),abs(s)); - - return str; -} - -char* icalvalue_string_as_ical_string(icalvalue* value) { - - char* data; - char* str = 0; - icalerror_check_arg_rz( (value!=0),"value"); - data = ((struct icalvalue_impl*)value)->data.v_string; - - str = (char*)icalmemory_tmp_buffer(strlen(data)+1); - - strcpy(str,data); - - return str; -} - - -char* icalvalue_recur_as_ical_string(icalvalue* value) -{ - char* str; - char *str_p; - size_t buf_sz = 200; - char temp[20]; - int i,j; - struct icalvalue_impl *impl = (struct icalvalue_impl*)value; - struct icalrecurrencetype *recur = impl->data.v_recur; - - struct { char* str; short* array; short limit; } map[] = - { - {";BYSECOND=",recur->by_second,60}, - {";BYMINUTE=",recur->by_minute,60}, - {";BYHOUR=",recur->by_hour,24}, - {";BYDAY=",recur->by_day,7}, - {";BYMONTHDAY=",recur->by_month_day,31}, - {";BYYEARDAY=",recur->by_year_day,366}, - {";BYWEEKNO=",recur->by_week_no,52}, - {";BYMONTH=",recur->by_month,12}, - {";BYSETPOS=",recur->by_set_pos,366}, - {0,0,0}, - }; - - icalerror_check_arg_rz((value != 0),"value"); - - if(recur->freq == ICAL_NO_RECURRENCE){ - return 0; - } - - str = (char*)icalmemory_tmp_buffer(buf_sz); - str_p = str; - - icalmemory_append_string(&str,&str_p,&buf_sz,"FREQ="); - icalmemory_append_string(&str,&str_p,&buf_sz, - icalenum_recurrence_to_string(recur->freq)); - - if(recur->until.year != 0){ - - temp[0] = 0; - print_datetime_to_string(temp,&(recur->until)); - - icalmemory_append_string(&str,&str_p,&buf_sz,";UNTIL="); - icalmemory_append_string(&str,&str_p,&buf_sz, temp); - } - - if(recur->count != 0){ - sprintf(temp,"%d",recur->count); - icalmemory_append_string(&str,&str_p,&buf_sz,";COUNT="); - icalmemory_append_string(&str,&str_p,&buf_sz, temp); - } - - if(recur->interval != 0){ - sprintf(temp,"%d",recur->interval); - icalmemory_append_string(&str,&str_p,&buf_sz,";INTERVAL="); - icalmemory_append_string(&str,&str_p,&buf_sz, temp); - } - - for(j =0; map[j].str != 0; j++){ - short* array = map[j].array; - short limit = map[j].limit; - - /* Skip unused arrays */ - if( array[0] != ICAL_RECURRENCE_ARRAY_MAX ) { - - icalmemory_append_string(&str,&str_p,&buf_sz,map[j].str); - - for(i=0; i< limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX; - i++){ - if (j == 3) { /* BYDAY */ - icalmemory_append_string(&str,&str_p,&buf_sz, - icalenum_weekday_to_string(array[i])); - } else { - sprintf(temp,"%d",array[i]); - icalmemory_append_string(&str,&str_p,&buf_sz, temp); - } - - if( (i+1)data.v_string)+1; - - str_p = str = (char*)icalmemory_new_buffer(buf_sz); - - if (str_p == 0){ - return 0; - } - - for(p=((struct icalvalue_impl*)value)->data.v_string; *p!=0; p++){ - - switch(*p){ - case '\n': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\n"); - line_length+=3; - break; - } - - case '\t': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\t"); - line_length+=3; - break; - } - case '\r': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\r"); - line_length+=3; - break; - } - case '\b': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\b"); - line_length+=3; - break; - } - case '\f': { - icalmemory_append_string(&str,&str_p,&buf_sz,"\\f"); - line_length+=3; - break; - } - - case ';': - case ',':{ - icalmemory_append_char(&str,&str_p,&buf_sz,'\\'); - icalmemory_append_char(&str,&str_p,&buf_sz,*p); - line_length+=3; - break; - } - - case '"':{ - icalmemory_append_char(&str,&str_p,&buf_sz,'\\'); - icalmemory_append_char(&str,&str_p,&buf_sz,*p); - line_length+=3; - break; - } - - default: { - icalmemory_append_char(&str,&str_p,&buf_sz,*p); - line_length++; - } - } - - if (line_length > 65 && *p == ' '){ - icalmemory_append_string(&str,&str_p,&buf_sz,"\n "); - line_length=0; - } - - - if (line_length > 75){ - icalmemory_append_string(&str,&str_p,&buf_sz,"\n "); - line_length=0; - } - - } - - /* Assume the last character is not a '\0' and add one. We could - check *str_p != 0, but that would be an uninitialized memory - read. */ - - - icalmemory_append_char(&str,&str_p,&buf_sz,'\0'); - - rtrn = icalmemory_tmp_copy(str); - - icalmemory_free_buffer(str); - - return rtrn; -} - - -char* icalvalue_attach_as_ical_string(icalvalue* value) { - - struct icalattachtype a; - char * str; - - icalerror_check_arg_rz( (value!=0),"value"); - - a = icalvalue_get_attach(value); - - if (a.binary != 0) { - return icalvalue_binary_as_ical_string(value); - } else if (a.base64 != 0) { - str = (char*)icalmemory_tmp_buffer(strlen(a.base64)+1); - strcpy(str,a.base64); - return str; - } else if (a.url != 0){ - return icalvalue_string_as_ical_string(value); - } else { - icalerrno = ICAL_MALFORMEDDATA_ERROR; - return 0; - } -} - -void append_duration_segment(char** buf, char** buf_ptr, size_t* buf_size, - char* sep, unsigned int value) { - - char digits[256]; /* HACK: large hardcoded limit */ - - sprintf(digits,"%d",value); - - icalmemory_append_string(buf, buf_ptr, buf_size, digits); - icalmemory_append_string(buf, buf_ptr, buf_size, sep); - -} - -char* icalvalue_duration_as_ical_string(icalvalue* value) { - - struct icaldurationtype data; - char *buf, *output_line; - size_t buf_size = 256; - char* buf_ptr = 0; - - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_duration(value); - - buf = (char*)icalmemory_new_buffer(buf_size); - buf_ptr = buf; - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "P"); - - - if (data.weeks != 0 ) { - append_duration_segment(&buf, &buf_ptr, &buf_size, "W", data.weeks); - } - - if (data.days != 0 ) { - append_duration_segment(&buf, &buf_ptr, &buf_size, "D", data.days); - } - - if (data.hours != 0 || data.minutes != 0 || data.seconds != 0) { - - icalmemory_append_string(&buf, &buf_ptr, &buf_size, "T"); - - if (data.hours != 0 ) { - append_duration_segment(&buf, &buf_ptr, &buf_size, "H", data.hours); - } - if (data.minutes != 0 ) { - append_duration_segment(&buf, &buf_ptr, &buf_size, "M", data.minutes); - } - if (data.seconds != 0 ) { - append_duration_segment(&buf, &buf_ptr, &buf_size, "S", data.seconds); - } - - } - - output_line = icalmemory_tmp_copy(buf); - icalmemory_free_buffer(buf); - - return output_line; - - -} - -void print_time_to_string(char* str, struct icaltimetype *data) -{ - char temp[20]; - - if (data->is_utc == 1){ - sprintf(temp,"%02d%02d%02dZ",data->hour,data->minute,data->second); - } else { - sprintf(temp,"%02d%02d%02d",data->hour,data->minute,data->second); - } - - strcat(str,temp); -} - - -char* icalvalue_time_as_ical_string(icalvalue* value) { - - struct icaltimetype data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_time(value); - - str = (char*)icalmemory_tmp_buffer(8); - - str[0] = 0; - print_time_to_string(str,&data); - - return str; -} - -void print_date_to_string(char* str, struct icaltimetype *data) -{ - char temp[20]; - - sprintf(temp,"%04d%02d%02d",data->year,data->month,data->day); - - strcat(str,temp); -} - -char* icalvalue_date_as_ical_string(icalvalue* value) { - - struct icaltimetype data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_date(value); - - str = (char*)icalmemory_tmp_buffer(9); - - str[0] = 0; - print_date_to_string(str,&data); - - return str; -} - -void print_datetime_to_string(char* str, struct icaltimetype *data) -{ - print_date_to_string(str,data); - strcat(str,"T"); - print_time_to_string(str,data); - -} - -char* icalvalue_datetime_as_ical_string(icalvalue* value) { - - struct icaltimetype data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_date(value); - - str = (char*)icalmemory_tmp_buffer(20); - - str[0] = 0; - - print_datetime_to_string(str,&data); - - return str; - -} - - -char* icalvalue_datetimedate_as_ical_string(icalvalue* value) { - - struct icaltimetype data; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_datetime(value); - - if (data.is_date == 1){ - return icalvalue_date_as_ical_string(value); - } else { - return icalvalue_datetime_as_ical_string(value); - } -} - - -char* icalvalue_float_as_ical_string(icalvalue* value) { - - float data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_float(value); - - str = (char*)icalmemory_tmp_buffer(15); - - sprintf(str,"%f",data); - - return str; -} - -char* icalvalue_geo_as_ical_string(icalvalue* value) { - - struct icalgeotype data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - - data = icalvalue_get_geo(value); - - str = (char*)icalmemory_tmp_buffer(25); - - sprintf(str,"%f;%f",data.lat,data.lon); - - return str; -} - -char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) { - - struct icalperiodtype data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_datetimeperiod(value); - - str = (char*)icalmemory_tmp_buffer(60); - - if( data.end.second == -1){ - /* This is a DATE-TIME value, since there is no end value */ - icalvalue *v= icalvalue_new_datetime(data.start); - - strcpy(str,icalvalue_datetime_as_ical_string(v)); - - free(v); - - } else { - icalvalue *v1 = icalvalue_new_datetime(data.start); - icalvalue *v2 = icalvalue_new_datetime(data.end); - - sprintf(str,"%s/%s", - icalvalue_datetime_as_ical_string(v1), - icalvalue_datetime_as_ical_string(v2) - ); - - free(v1); - free(v2); - - } - - return str; -} - -char* icalvalue_period_as_ical_string(icalvalue* value) { - - struct icalperiodtype data; - char* str; - icalvalue *s,*e; - - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_period(value); - - str = (char*)icalmemory_tmp_buffer(60); - - s = icalvalue_new_datetime(data.start); - - if (data.end.second != -1){ - /* use the end date */ - e = icalvalue_new_datetime(data.end); - - sprintf(str,"%s/%s", - icalvalue_datetime_as_ical_string(s), - icalvalue_datetime_as_ical_string(e) - ); - - - } else { - /* use the duration */ - e = icalvalue_new_duration(data.duration); - - sprintf(str,"%s/%s", - icalvalue_datetime_as_ical_string(s), - icalvalue_duration_as_ical_string(e) - ); - - } - - icalvalue_free(e); - icalvalue_free(s); - return str; -} - -char* icalvalue_trigger_as_ical_string(icalvalue* value) { - - union icaltriggertype data; - char* str; - icalerror_check_arg_rz( (value!=0),"value"); - data = icalvalue_get_trigger(value); - - str = (char*)icalmemory_tmp_buffer(60); - sprintf(str,"icalvalue_trigger_as_ical_string is not implemented yet"); - - return str; -} - -char* -icalvalue_as_ical_string (icalvalue* value) -{ - struct icalvalue_impl* v = (struct icalvalue_impl*)value; - - v=v; - - if(value == 0){ - return 0; - } - - switch (v->kind){ - - case ICAL_ATTACH_VALUE: - return icalvalue_attach_as_ical_string(value); - - case ICAL_BINARY_VALUE: - return icalvalue_binary_as_ical_string(value); - - case ICAL_BOOLEAN_VALUE: - case ICAL_INTEGER_VALUE: - return icalvalue_int_as_ical_string(value); - - case ICAL_UTCOFFSET_VALUE: - return icalvalue_utcoffset_as_ical_string(value); - - case ICAL_TEXT_VALUE: - return icalvalue_text_as_ical_string(value); - - case ICAL_URI_VALUE: - case ICAL_CALADDRESS_VALUE: - return icalvalue_string_as_ical_string(value); - - case ICAL_DATE_VALUE: - return icalvalue_date_as_ical_string(value); - case ICAL_DATETIME_VALUE: - return icalvalue_datetime_as_ical_string(value); - case ICAL_DATETIMEDATE_VALUE: - return icalvalue_datetimedate_as_ical_string(value); - case ICAL_DURATION_VALUE: - return icalvalue_duration_as_ical_string(value); - case ICAL_TIME_VALUE: - return icalvalue_time_as_ical_string(value); - - case ICAL_PERIOD_VALUE: - return icalvalue_period_as_ical_string(value); - case ICAL_DATETIMEPERIOD_VALUE: - return icalvalue_datetimeperiod_as_ical_string(value); - - case ICAL_FLOAT_VALUE: - return icalvalue_float_as_ical_string(value); - - case ICAL_GEO_VALUE: - return icalvalue_geo_as_ical_string(value); - - case ICAL_RECUR_VALUE: - return icalvalue_recur_as_ical_string(value); - - case ICAL_TRIGGER_VALUE: - return icalvalue_trigger_as_ical_string(value); - - case ICAL_METHOD_VALUE: - return icalenum_method_to_string(v->data.v_method); - - case ICAL_NO_VALUE: - default: - { - return 0; - } - } -} - - -icalvalue_kind -icalvalue_isa (icalvalue* value) -{ - struct icalvalue_impl* v = (struct icalvalue_impl*)value; - - if(value == 0){ - return ICAL_NO_VALUE; - } - - return v->kind; -} - - -int -icalvalue_isa_value (void* value) -{ - struct icalvalue_impl *impl = (struct icalvalue_impl *)value; - - icalerror_check_arg_rz( (value!=0), "value"); - - if (strcmp(impl->id,"val") == 0) { - return 1; - } else { - return 0; - } -} - - -icalparameter_xliccomparetype -icalvalue_compare(icalvalue* a, icalvalue *b) -{ - struct icalvalue_impl *impla = (struct icalvalue_impl *)a; - struct icalvalue_impl *implb = (struct icalvalue_impl *)b; - - icalerror_check_arg_rz( (a!=0), "a"); - icalerror_check_arg_rz( (b!=0), "b"); - - /* Not the same type; they can only be unequal */ - if (icalvalue_isa(a) != icalvalue_isa(b)){ - return ICAL_XLICCOMPARETYPE_NOTEQUAL; - } - - switch (icalvalue_isa(a)){ - - case ICAL_ATTACH_VALUE: - case ICAL_BINARY_VALUE: - - case ICAL_BOOLEAN_VALUE: - { - if (icalvalue_get_boolean(a) == icalvalue_get_boolean(b)){ - return ICAL_XLICCOMPARETYPE_EQUAL; - } else { - return ICAL_XLICCOMPARETYPE_NOTEQUAL; - } - } - - case ICAL_FLOAT_VALUE: - { - if (impla->data.v_float > implb->data.v_float){ - return ICAL_XLICCOMPARETYPE_GREATER; - } else if (impla->data.v_float < implb->data.v_float){ - return ICAL_XLICCOMPARETYPE_LESS; - } else { - return ICAL_XLICCOMPARETYPE_EQUAL; - } - } - - case ICAL_INTEGER_VALUE: - case ICAL_UTCOFFSET_VALUE: - { - if (impla->data.v_int > implb->data.v_int){ - return ICAL_XLICCOMPARETYPE_GREATER; - } else if (impla->data.v_int < implb->data.v_int){ - return ICAL_XLICCOMPARETYPE_LESS; - } else { - return ICAL_XLICCOMPARETYPE_EQUAL; - } - } - - case ICAL_TEXT_VALUE: - case ICAL_URI_VALUE: - case ICAL_CALADDRESS_VALUE: - case ICAL_TRIGGER_VALUE: - case ICAL_DATE_VALUE: - case ICAL_DATETIME_VALUE: - case ICAL_DATETIMEDATE_VALUE: - case ICAL_DURATION_VALUE: - case ICAL_TIME_VALUE: - case ICAL_DATETIMEPERIOD_VALUE: - { - int r; - - r = strcmp(icalvalue_as_ical_string(a), - icalvalue_as_ical_string(b)); - - if (r > 0) { - return ICAL_XLICCOMPARETYPE_GREATER; - } else if (r < 0){ - return ICAL_XLICCOMPARETYPE_LESS; - } else { - return 0; - } - - - } - - case ICAL_METHOD_VALUE: - { - if (icalvalue_get_method(a) == icalvalue_get_method(b)){ - return ICAL_XLICCOMPARETYPE_EQUAL; - } else { - return ICAL_XLICCOMPARETYPE_NOTEQUAL; - } - - } - case ICAL_PERIOD_VALUE: - case ICAL_GEO_VALUE: - case ICAL_RECUR_VALUE: - case ICAL_NO_VALUE: - default: - { - icalerror_warn("Comparison not implemented for value type"); - return ICAL_XLICCOMPARETYPE_REGEX+1; /* HACK */ - } - } - -} - -void icalvalue_set_parent(icalvalue* value, - icalproperty* property) -{ - struct icalvalue_impl* v = (struct icalvalue_impl*)value; - - v->parent = property; - -} - -icalproperty* icalvalue_get_parent(icalvalue* value) -{ - struct icalvalue_impl* v = (struct icalvalue_impl*)value; - - - return v->parent; -} - - - -/* Recur is a special case, so it is not auto generated */ -icalvalue* -icalvalue_new_recur (struct icalrecurrencetype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE); - - icalvalue_set_recur((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_RECUR_VALUE); - - impl = (struct icalvalue_impl*)value; - - if (impl->data.v_recur != 0){ - free(impl->data.v_recur); - impl->data.v_recur = 0; - } - - impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype)); - - if (impl->data.v_recur == 0){ - icalerror_set_errno(ICAL_ALLOCATION_ERROR); - return; - } else { - memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype)); - } - -} - -struct icalrecurrencetype -icalvalue_get_recur(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_RECUR_VALUE); - - return *(((struct icalvalue_impl*)value)->data.v_recur); -} - - - - -/* The remaining interfaces are 'new', 'set' and 'get' for each of the value - types */ - - -/* Everything below this line is machine generated. Do not edit. */ - -icalvalue* -icalvalue_new_attach (struct icalattachtype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ATTACH_VALUE); - - - icalvalue_set_attach((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_attach(icalvalue* value, struct icalattachtype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_ATTACH_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_attach = v; -} - -struct icalattachtype -icalvalue_get_attach(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_ATTACH_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_attach; -} - - -icalvalue* -icalvalue_new_binary (char* v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE); - - icalerror_check_arg_rz( (v!=0),"v"); - - icalvalue_set_binary((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_binary(icalvalue* value, char* v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_value_type(value, ICAL_BINARY_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_string = strdup(v); - - if (impl->data.v_string == 0){ - errno = ENOMEM; - } - -} - -char* -icalvalue_get_binary(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_BINARY_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_string; -} - - -icalvalue* -icalvalue_new_boolean (int v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BOOLEAN_VALUE); - - - icalvalue_set_boolean((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_boolean(icalvalue* value, int v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_int = v; -} - -int -icalvalue_get_boolean(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_int; -} - - -icalvalue* -icalvalue_new_caladdress (char* v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE); - - icalerror_check_arg_rz( (v!=0),"v"); - - icalvalue_set_caladdress((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_caladdress(icalvalue* value, char* v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_string = strdup(v); - - if (impl->data.v_string == 0){ - errno = ENOMEM; - } - -} - -char* -icalvalue_get_caladdress(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_string; -} - - -icalvalue* -icalvalue_new_date (struct icaltimetype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE); - - - icalvalue_set_date((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_date(icalvalue* value, struct icaltimetype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_DATE_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_time = v; -} - -struct icaltimetype -icalvalue_get_date(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_DATE_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_time; -} - - -icalvalue* -icalvalue_new_datetime (struct icaltimetype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIME_VALUE); - - - icalvalue_set_datetime((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_DATETIME_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_time = v; -} - -struct icaltimetype -icalvalue_get_datetime(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_DATETIME_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_time; -} - - -icalvalue* -icalvalue_new_datetimedate (struct icaltimetype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEDATE_VALUE); - - - icalvalue_set_datetimedate((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_datetimedate(icalvalue* value, struct icaltimetype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_DATETIMEDATE_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_time = v; -} - -struct icaltimetype -icalvalue_get_datetimedate(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_DATETIMEDATE_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_time; -} - - -icalvalue* -icalvalue_new_datetimeperiod (struct icalperiodtype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE); - - - icalvalue_set_datetimeperiod((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_datetimeperiod(icalvalue* value, struct icalperiodtype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_period = v; -} - -struct icalperiodtype -icalvalue_get_datetimeperiod(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_period; -} - - -icalvalue* -icalvalue_new_duration (struct icaldurationtype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DURATION_VALUE); - - - icalvalue_set_duration((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_DURATION_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_duration = v; -} - -struct icaldurationtype -icalvalue_get_duration(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_DURATION_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_duration; -} - - -icalvalue* -icalvalue_new_float (float v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE); - - - icalvalue_set_float((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_float(icalvalue* value, float v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_FLOAT_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_float = v; -} - -float -icalvalue_get_float(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_FLOAT_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_float; -} - - -icalvalue* -icalvalue_new_geo (struct icalgeotype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE); - - - icalvalue_set_geo((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_geo(icalvalue* value, struct icalgeotype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_GEO_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_geo = v; -} - -struct icalgeotype -icalvalue_get_geo(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_GEO_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_geo; -} - - -icalvalue* -icalvalue_new_integer (int v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_INTEGER_VALUE); - - - icalvalue_set_integer((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_integer(icalvalue* value, int v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_INTEGER_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_int = v; -} - -int -icalvalue_get_integer(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_INTEGER_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_int; -} - - -icalvalue* -icalvalue_new_method (icalproperty_method v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE); - - - icalvalue_set_method((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_method(icalvalue* value, icalproperty_method v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_METHOD_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_method = v; -} - -icalproperty_method -icalvalue_get_method(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_METHOD_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_method; -} - - -icalvalue* -icalvalue_new_period (struct icalperiodtype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE); - - - icalvalue_set_period((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_period(icalvalue* value, struct icalperiodtype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_PERIOD_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_period = v; -} - -struct icalperiodtype -icalvalue_get_period(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_PERIOD_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_period; -} - - -icalvalue* -icalvalue_new_text (char* v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE); - - icalerror_check_arg_rz( (v!=0),"v"); - - icalvalue_set_text((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_text(icalvalue* value, char* v) -{ - struct icalvalue_impl* impl; - char *p,*d; - - icalerror_check_arg_rv( (value!=0),"value"); - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_value_type(value, ICAL_TEXT_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_string = malloc(strlen(v)+1); - - if (impl->data.v_string == 0){ - errno = ENOMEM; - return; - } - - for(d=impl->data.v_string,p=v; *p!=0; p++){ - - if (*p == '\\') { - p++; - - if (p == 0){ - break; - } - - switch(*p){ - case 'n': { - *d='\n';d++; - break; - } - - case '\\': { - *d='\\';d++; - break; - } - - case 't': { - *d='\n';d++; - break; - } - case 'r': { - *d='\r';d++; - break; - } - case 'b': { - *d='\b';d++; - break; - } - case 'f': { - *d='\f';d++; - break; - } - - case ';': - case ',':{ - *d=*p;d++; - break; - } - - case '"':{ - *d='\"';d++; - break; - } - } - } else { - *d=*p;d++; - } - } - *d='\0'; - -} - -char* -icalvalue_get_text(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_TEXT_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_string; -} - - -icalvalue* -icalvalue_new_time (struct icaltimetype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TIME_VALUE); - - - icalvalue_set_time((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_time(icalvalue* value, struct icaltimetype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_TIME_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_time = v; -} - -struct icaltimetype -icalvalue_get_time(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_TIME_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_time; -} - - -icalvalue* -icalvalue_new_trigger (union icaltriggertype v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE); - - - icalvalue_set_trigger((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_trigger(icalvalue* value, union icaltriggertype v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_TRIGGER_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_trigger = v; -} - -union icaltriggertype -icalvalue_get_trigger(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_TRIGGER_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_trigger; -} - - -icalvalue* -icalvalue_new_uri (char* v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE); - - icalerror_check_arg_rz( (v!=0),"v"); - - icalvalue_set_uri((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_uri(icalvalue* value, char* v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_value_type(value, ICAL_URI_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_string = strdup(v); - - if (impl->data.v_string == 0){ - errno = ENOMEM; - } - -} - -char* -icalvalue_get_uri(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_URI_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_string; -} - - -icalvalue* -icalvalue_new_utcoffset (int v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_UTCOFFSET_VALUE); - - - icalvalue_set_utcoffset((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_utcoffset(icalvalue* value, int v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - - icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_int = v; -} - -int -icalvalue_get_utcoffset(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_int; -} - - -icalvalue* -icalvalue_new_query (char* v) -{ - struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE); - - icalerror_check_arg_rz( (v!=0),"v"); - - icalvalue_set_query((icalvalue*)impl,v); - - return (icalvalue*)impl; -} - -void -icalvalue_set_query(icalvalue* value, char* v) -{ - struct icalvalue_impl* impl; - - icalerror_check_arg_rv( (value!=0),"value"); - icalerror_check_arg_rv( (v!=0),"v"); - - icalerror_check_value_type(value, ICAL_QUERY_VALUE); - - impl = (struct icalvalue_impl*)value; - impl->data.v_string = strdup(v); - - if (impl->data.v_string == 0){ - errno = ENOMEM; - } - -} - -char* -icalvalue_get_query(icalvalue* value) -{ - icalerror_check_arg( (value!=0),"value"); - icalerror_check_value_type(value, ICAL_QUERY_VALUE); - - return ((struct icalvalue_impl*)value)->data.v_string; -} - diff --git a/libical/src/libical/icalvalue.h b/libical/src/libical/icalvalue.h deleted file mode 100644 index b5a2e6da9e..0000000000 --- a/libical/src/libical/icalvalue.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalvalue.h - CREATOR: eric 20 March 1999 - - - $Id$ - $Locker$ - - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalvalue.h - - ======================================================================*/ - -#ifndef ICALVALUE_H -#define ICALVALUE_H - -#include -#include "icalenums.h" -#include "icaltypes.h" - -typedef void icalvalue; - -icalvalue* icalvalue_new(icalvalue_kind kind); - -icalvalue* icalvalue_new_clone(icalvalue* value); - -icalvalue* icalvalue_new_from_string(icalvalue_kind kind, char* str); - -void icalvalue_free(icalvalue* value); - -int icalvalue_is_valid(icalvalue* value); - -char* icalvalue_as_ical_string(icalvalue* value); - -icalvalue_kind icalvalue_isa(icalvalue* value); - -int icalvalue_isa_value(void*); - -icalparameter_xliccomparetype -icalvalue_compare(icalvalue* a, icalvalue *b); - -/* Everything below this line is machine generated. Do not edit. */ -/* ATTACH # Non-std */ -icalvalue* icalvalue_new_attach(struct icalattachtype v); -struct icalattachtype icalvalue_get_attach(icalvalue* value); -void icalvalue_set_attach(icalvalue* value, struct icalattachtype v); - -/* BINARY */ -icalvalue* icalvalue_new_binary(char* v); -char* icalvalue_get_binary(icalvalue* value); -void icalvalue_set_binary(icalvalue* value, char* v); - -/* BOOLEAN */ -icalvalue* icalvalue_new_boolean(int v); -int icalvalue_get_boolean(icalvalue* value); -void icalvalue_set_boolean(icalvalue* value, int v); - -/* CAL-ADDRESS */ -icalvalue* icalvalue_new_caladdress(char* v); -char* icalvalue_get_caladdress(icalvalue* value); -void icalvalue_set_caladdress(icalvalue* value, char* v); - -/* DATE */ -icalvalue* icalvalue_new_date(struct icaltimetype v); -struct icaltimetype icalvalue_get_date(icalvalue* value); -void icalvalue_set_date(icalvalue* value, struct icaltimetype v); - -/* DATE-TIME */ -icalvalue* icalvalue_new_datetime(struct icaltimetype v); -struct icaltimetype icalvalue_get_datetime(icalvalue* value); -void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v); - -/* DATE-TIME-DATE # Non-std */ -icalvalue* icalvalue_new_datetimedate(struct icaltimetype v); -struct icaltimetype icalvalue_get_datetimedate(icalvalue* value); -void icalvalue_set_datetimedate(icalvalue* value, struct icaltimetype v); - -/* DATE-TIME-PERIOD # Non-std */ -icalvalue* icalvalue_new_datetimeperiod(struct icalperiodtype v); -struct icalperiodtype icalvalue_get_datetimeperiod(icalvalue* value); -void icalvalue_set_datetimeperiod(icalvalue* value, struct icalperiodtype v); - -/* DURATION */ -icalvalue* icalvalue_new_duration(struct icaldurationtype v); -struct icaldurationtype icalvalue_get_duration(icalvalue* value); -void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v); - -/* FLOAT */ -icalvalue* icalvalue_new_float(float v); -float icalvalue_get_float(icalvalue* value); -void icalvalue_set_float(icalvalue* value, float v); - -/* GEO # Non-std */ -icalvalue* icalvalue_new_geo(struct icalgeotype v); -struct icalgeotype icalvalue_get_geo(icalvalue* value); -void icalvalue_set_geo(icalvalue* value, struct icalgeotype v); - -/* INTEGER */ -icalvalue* icalvalue_new_integer(int v); -int icalvalue_get_integer(icalvalue* value); -void icalvalue_set_integer(icalvalue* value, int v); - -/* METHOD # Non-std */ -icalvalue* icalvalue_new_method(icalproperty_method v); -icalproperty_method icalvalue_get_method(icalvalue* value); -void icalvalue_set_method(icalvalue* value, icalproperty_method v); - -/* PERIOD */ -icalvalue* icalvalue_new_period(struct icalperiodtype v); -struct icalperiodtype icalvalue_get_period(icalvalue* value); -void icalvalue_set_period(icalvalue* value, struct icalperiodtype v); - -/* RECUR */ -icalvalue* icalvalue_new_recur(struct icalrecurrencetype v); -struct icalrecurrencetype icalvalue_get_recur(icalvalue* value); -void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v); - -/* TEXT */ -icalvalue* icalvalue_new_text(char* v); -char* icalvalue_get_text(icalvalue* value); -void icalvalue_set_text(icalvalue* value, char* v); - -/* TIME */ -icalvalue* icalvalue_new_time(struct icaltimetype v); -struct icaltimetype icalvalue_get_time(icalvalue* value); -void icalvalue_set_time(icalvalue* value, struct icaltimetype v); - -/* TRIGGER # Non-std */ -icalvalue* icalvalue_new_trigger(union icaltriggertype v); -union icaltriggertype icalvalue_get_trigger(icalvalue* value); -void icalvalue_set_trigger(icalvalue* value, union icaltriggertype v); - -/* URI */ -icalvalue* icalvalue_new_uri(char* v); -char* icalvalue_get_uri(icalvalue* value); -void icalvalue_set_uri(icalvalue* value, char* v); - -/* UTC-OFFSET */ -icalvalue* icalvalue_new_utcoffset(int v); -int icalvalue_get_utcoffset(icalvalue* value); -void icalvalue_set_utcoffset(icalvalue* value, int v); - -/* QUERY */ -icalvalue* icalvalue_new_query(char* v); -char* icalvalue_get_query(icalvalue* value); -void icalvalue_set_query(icalvalue* value, char* v); - -#endif ICALVALUE_H diff --git a/libical/src/libical/icalvcal.h b/libical/src/libical/icalvcal.h deleted file mode 100644 index 3a1098e6c2..0000000000 --- a/libical/src/libical/icalvcal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalvcal.h - CREATOR: eric 13 January 2000 - - - $Id$ - $Locker$ - - (C) COPYRIGHT 2000 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - -======================================================================*/ - -#ifndef ICALVCAL_H -#define ICALVCAL_H - -VCalObject* icalvcal_new_vcal_from_ical(icalcomponent* component); -icalcomponent* icalvcal_new_ical_from_vcal(VCalObject* vcal); - - -#endif /* !ICALVCAL_H */ - - - diff --git a/libical/src/libical/locking.c b/libical/src/libical/locking.c deleted file mode 100644 index 0376bc2bec..0000000000 --- a/libical/src/libical/locking.c +++ /dev/null @@ -1,143 +0,0 @@ - -/* - I Stole this from: - http://www.cis.temple.edu/~ingargio/old/cis307s96/readings/rwlockexample.html - - CIS 307: An example using Read/Write File Locks - [fcntl.h], [fcntl.c], [fcntlmain.c] - -In Stevens "Advanced Programming in the Unix Environment" we see ways to use -the Unix service fcntl to lock portions of a file for reading and writing in -the manner stated in the Reader and Writer problem [any number of readers at -a time, but writers must operate alone]. Here we have three files that adapt -and use the code from Stevens: - -*fcntl.h: Specification of the locking functions. -*fcntl.c: Implementation of the locking functions. -*fcntlmain.c: Driver that does a simple test of the locking functions. - -WARNING: A file lock request which is blocked can be interrupted by a -signal. In this case the lock operation returns EINTR. Thus we may think we -got a lock when we really don't. A solution is to block signals when -locking. Another solution is to test the value returned by the lock -operation and relock if the value is EINTR. Another solution, which we adopt -here, is to do nothing about it. - -/* fcntl.c -- Defines mutexes in terms of read/write locks on files. - * (code is mostly from Stevens: Advanced Programming in the - * Unix environment. See from page 367 on. - * filerwlock, filerwlockCreate, filerwlockDelete, - * filerwreadlock, filerwlongreadlock, filerwlongunlock, - * filerwlockUnlock - */ - -#include -#include -#include -#include - -int lock_reg(int, int, int, off_t, int, off_t); - -#define read_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLK, F_RDLCK, offset, whence, len) - -#define readw_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLKW, F_RDLCK, offset, whence, len) - -#define write_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLK, F_WRLCK, offset, whence, len) - -#define writew_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLKW, F_WRLCK, offset, whence, len) - -#define un_lock(fd, offset, whence, len) \ - lock_reg(fd, F_SETLK, F_UNLCK, offset, whence, len) - -pid_t lock_test(int, int , off_t , int , off_t ); - -#define is_readlock(fd, offset, whence, len) \ - lock_test(fd, F_RDLCK, offset, whence, len) - -#define is_writelock(fd, offset, whence, len) \ - lock_test(fd, F_WRLCK, offset, whence, len) - -int lock_reg(int fd, int cmd, int type, off_t offset, int whence, off_t len) -{ - struct flock lock; - lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */ - lock.l_start = offset; /* byte offset relative to l_whence */ - lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ - lock.l_len = len; /* #bytes (0 means to EOF) */ - return (fcntl(fd, cmd, &lock)); -} - -pid_t lock_test(int fd, int type, off_t offset, int whence, off_t len) -{ - struct flock lock; - lock.l_type = type; /* F_RDLCK or F_WRLCK */ - lock.l_start = offset; /* byte offset relative to l_whence */ - lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */ - lock.l_len = len; /* #bytes (0 means to EOF) */ - if (fcntl(fd,F_GETLK,&lock) < 0){ - perror("fcntl"); exit(1);} - if (lock.l_type == F_UNLCK) - return (0); /* false, region is not locked by another process */ - return (lock.l_pid); /* true, return pid of lock owner */ -} - -typedef struct { - int fd; - int n;} filerwlock; - -/* Create N read/write locks and returns the id of this cluster of locks. */ -filerwlock * filerwlockCreate(char *filename, int n) { - filerwlock *fl = (filerwlock *)malloc(sizeof(filerwlock)); - if (((fl->fd) = open(filename, O_RDWR | O_CREAT | O_TRUNC, S_IWUSR)) < 0) { - perror("open"); - exit(1);} - fl->n = n; - return fl; - } - -/* Delete the cluster of read/write locks associated with fl. */ -int filerwlockDelete(filerwlock *fl) { - if (close(fl->fd) < 0) { - perror("close"); - exit(1);} - return free(fl); - } - -/* Given the read/write lock cluster fl, lock its ith element */ -int filerwreadlock(filerwlock *fl, int i) { - if ((i < 0) | (i >= fl->n)) { - printf("filerwlockLock needs i in range 0 .. %d\n", (fl->n)-1); - exit(0);} - readw_lock(fl->fd, i, SEEK_SET, 1); - } - -int filerwwritelock(filerwlock *fl, int i) { - if ((i < 0) | (i >= fl->n)) { - printf("filerwlockLock needs i in range 0 .. %d\n", (fl->n)-1); - exit(0);} - writew_lock(fl->fd, i, SEEK_SET, 1); - } - -/* Given the lock cluster fl, unlock its ith element */ -int filerwunlock(filerwlock *fl, int i){ - - if ((i < 0) | (i >= fl->n)) { - printf("filerwlockUnlock needs i in range 0 .. %d\n", (fl->n)-1); - exit(0);} - un_lock(fl->fd, i, SEEK_SET, 1); - } - -/* Given the lock cluster fl, it read locks all its elements */ -int filerwlongreadlock(filerwlock *fl) { - readw_lock(fl->fd, 0, SEEK_SET, fl->n); -} - -/* Given the lock cluster fl, it unlocks all its elements */ -int filerwlongunlock(filerwlock *fl) { - un_lock(fl->fd, 0, SEEK_SET, fl->n); -} - diff --git a/libical/src/libical/pvl.c b/libical/src/libical/pvl.c deleted file mode 100644 index b88272a6a0..0000000000 --- a/libical/src/libical/pvl.c +++ /dev/null @@ -1,764 +0,0 @@ -/*====================================================================== - FILE: pvl.c - CREATOR: eric November, 1995 - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. -======================================================================*/ - -#include "pvl.h" -#include -#include -#include - - - -/* - struct pvl_list_t - - The list structure. This is the hanlde for the entire list - - This type is also private. Use pvl_list instead - - */ - -typedef struct pvl_list_t -{ - int MAGIC; /* Magic Identifier */ - struct pvl_elem_t *head; /* Head of list */ - struct pvl_elem_t *tail; /* Tail of list */ - int count; /* Number of items in the list */ - struct pvl_elem_t *p; /* Pointer used for iterators */ -} pvl_list_t; - - - - -/* This global is incremented for each call to pvl_new_element(); it gives each - * list a unique identifer */ - -int pvl_elem_count = 0; -int pvl_list_count = 0; - - -/*---------------------------------------------------------------------- - Function: pvl_list pvl_newlist() - - Purpose: - - Creates a new list, clears the pointers and assigns a magic number - - Returns: - - Pointer to the new list - 0 if there is no available memory. - *----------------------------------------------------------------------*/ - -pvl_list -pvl_newlist() -{ - struct pvl_list_t *L; - - if ( ( L = (struct pvl_list_t*)malloc(sizeof(struct pvl_list_t))) == 0) - { - errno = ENOMEM; - return 0; - } - - L->MAGIC = pvl_list_count; - pvl_list_count++; - L->head = 0; - L->tail = 0; - L->count = 0; - L->p = 0; - - return L; -} - -void -pvl_free(pvl_list l) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - - pvl_clear(l); - - free(L); -} - -/*---------------------------------------------------------------------- - Function: pvl_new_element(void *d, struct pvl_elem_t *next,struct pvl_elem_t *prior) - - Purpose: - Creates a new list element, assigns a magic number, and assigns - the next and previous pointers. - - Passing in the next and previous points may seem odd, but it allos the user - to set them while keeping the internal data hidden. In nearly all cases, - the user is the pvl library itself. - - Parameters: - - d The data item to be stored in the list - next Pointer value to assign to the member "next" - prior Pointer value to assign to the member "prior" - - Returns: - - A pointer to the new element. - 0 if there is no memory available. - - *----------------------------------------------------------------------*/ - -pvl_elem -pvl_new_element(void *d, pvl_elem next,pvl_elem prior) -{ - struct pvl_elem_t *E; - - if ( ( E = (struct pvl_elem_t*)malloc(sizeof(struct pvl_elem_t))) == 0) - { - errno = ENOMEM; - return 0; - } - - E->MAGIC = pvl_elem_count++; - E->d = d; - E->next = next; - E->prior = prior; - - return (pvl_elem)E; -} - -/*---------------------------------------------------------------------- - Function: pvl_unshift(pvl_list l,void *d) - - Purpose: - - Add a new element to the from of the list - - Parameters: - - l The list to add the item to - d Pointer to the item to add - - Returns: - *----------------------------------------------------------------------*/ - -void -pvl_unshift(pvl_list l,void *d) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - struct pvl_elem_t *E = pvl_new_element(d,L->head,0); - - if (E->next != 0) - { - /* Link the head node to it */ - E->next->prior = E; - } - - /* move the head */ - L->head = E; - - /* maybe move the tail */ - - if (L->tail == 0) - { - L->tail = E; - } - - L->count++; -} - -/*---------------------------------------------------------------------- - Function: pvl_shift(pvl_list l) - - Purpose: - - Remove an element from the front of the list - - Parameters: - - l The list to operate on - - Returns: - *----------------------------------------------------------------------*/ - -void* -pvl_shift(pvl_list l) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - - if (L->head == 0) - { - return 0; - } - - return pvl_remove(l,(void*)L->head); - -} - -/*---------------------------------------------------------------------- - Function: void pvl_push(pvl_list l,void *d) - - Purpose: - - Add a new item to the tail of the list - - Paramters: - - l The list to operate on - d Pointer to the item to add - - Returns: - *----------------------------------------------------------------------*/ - -void -pvl_push(pvl_list l,void *d) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - struct pvl_elem_t *E = pvl_new_element(d,0,L->tail); - - /* These are done in pvl_new_element - E->next = 0; - E->prior = L->tail; - */ - - if (L->tail != 0) - { - L->tail->next = E; - } - - if (L->head == 0) - { - L->head = E; - } - - L->tail = E; - - L->count++; - -} - -/*---------------------------------------------------------------------- - Function: void* pvl_pop(pvl_list l) - - Purpose: - - Remove an element from the tail of the list - - Paramters: - - l The list to operate on - - Returns: - *----------------------------------------------------------------------*/ - -void* -pvl_pop(pvl_list l) -{ - - struct pvl_list_t *L = (struct pvl_list_t *)l; - - if ( L->tail == 0) - { - return 0; - } - - return pvl_remove(l,(void*) L->tail);; - -} - - -/*---------------------------------------------------------------------- - Function: void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d) - - Purpose: - - Add a new item to a list that is ordered by a comparison function. - This routine assumes that the list is properly ordered. - - l The list to operate on - f Pointer to a comparison function - d Pointer to data to pass to the comparison function - - Returns: - - void - - *----------------------------------------------------------------------*/ - -void -pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - - struct pvl_elem_t *P; - - L->count++; - - /* Empty list, add to head */ - - if(L->head == 0) - { - pvl_unshift(l,d); - return; - } - - /* smaller than head, add to head */ - - if ( ((*f)(d,L->head->d)) < 0) - { - pvl_unshift(l,d); - return; - } - - /* larger than tail, add to tail */ - if ( (*f)(d,L->tail->d) > 0) - { - pvl_push(l,d); - return; - } - - - /* Search for the first element that is smaller, and add before it */ - - for (P=L->head; P != 0; P = P->next) - { - if ( (*f)(P->d,d) > 0) - { - pvl_insert_before(l,P,d); - return; - } - } - - /* badness, choke */ - - assert(0); - -} - -/*---------------------------------------------------------------------- - Function: void pvl_insert_after(pvl_list l,pvl_elem p,void *d) - - Purpose: - - Add a new item after the referenced element. - - Parameters: - - l The list to operate on - p The list element to add the item after - d Pointer to the item to add. - - Returns: - - void - - *----------------------------------------------------------------------*/ - -void -pvl_insert_after(pvl_list l,pvl_elem p,void *d) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - struct pvl_elem_t *P = (struct pvl_elem_t *)p; - struct pvl_elem_t *E = 0; - - L->count++; - - if (P == 0) - { - pvl_unshift(l,d); - return; - } - - if ( P == L->tail) - { - E = pvl_new_element(d,0,P); - L->tail = E; - E->prior->next = E; - } - else - { - E = pvl_new_element(d,P->next,P); - E->next->prior = E; - E->prior->next = E; - } -} - -/*---------------------------------------------------------------------- - Function: void pvl_insert_before(pvl_list l,pvl_elem p,void *d) - - Purpose: - - Add an item after a referenced item - - Parameters: - - l The list to operate on - p The list element to add the item before - d Pointer to the data to be added. - - Returns: - *----------------------------------------------------------------------*/ - -void -pvl_insert_before(pvl_list l,pvl_elem p,void *d) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - struct pvl_elem_t *P = (struct pvl_elem_t *)p; - struct pvl_elem_t *E = 0; - - L->count++; - - if (P == 0) - { - pvl_unshift(l,d); - return; - } - - if ( P == L->head) - { - E = pvl_new_element(d,P,0); - E->next->prior = E; - L->head = E; - } - else - { - E = pvl_new_element(d,P,P->prior); - E->prior->next = E; - E->next->prior = E; - } -} - -/*---------------------------------------------------------------------- - Function: void pvl_remove(pvl_list l,pvl_elem e) - - Purpose: - - Remove the referenced item from the list - - This routine will free the element, but not the data item that the - element contains. - - Parameters: - - l The list to operate on - e The element to remove. - - Returns: - *----------------------------------------------------------------------*/ - -void* -pvl_remove(pvl_list l,pvl_elem e) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - struct pvl_elem_t *E = (struct pvl_elem_t *)e; - void* data; - - if (E == L->head) - { - if (E->next != 0) - { - E->next->prior = 0; - L->head = E->next; - } else { - /* E Also points to tail -> only one element in list */ - L->tail = 0; - L->head = 0; - } - } - else if (E == L->tail) - { - if (E->prior != 0) - { - E->prior->next = 0; - L->tail = E->prior; - } else { - /* E points to the head, so it was the last element */ - /* This case should be taken care of in the previous clause */ - L->head = 0; - L->tail = 0; - } - } - else - { - E->prior->next = E->next; - E->next->prior = E->prior; - } - - - L->count--; - - data = E->d; - - free(E); - - return data; - -} - -/*---------------------------------------------------------------------- - Function: pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v) - - Purpose: - - Return a pointer to data that satisfies a function - - This routine will interate through the entire list and call the - find function for each item. It will break and return a pointer to the - data that causes the find function to return 1. - - Parameters: - - l The list to operate on - f Pointer to the find function - v Pointer to constant data to pass into the function - - Returns: - - Pointer to the element that the find function found. - - *----------------------------------------------------------------------*/ - -pvl_elem -pvl_find(pvl_list l,pvl_findf f,void* v) -{ - pvl_elem e; - - for (e=pvl_head(l); e!= 0; e = pvl_next(e)) - { - if ( (*f)(((struct pvl_elem_t *)e)->d,v) == 1) - { - /* Save this elem for a call to find_next */ - ((struct pvl_list_t *)l)->p = e; - return e; - } - } - - return 0; - -} -/*---------------------------------------------------------------------- - Function: void* pvl_find_next(pvl_list l,pvl_findf f,void* v) - - Purpose: - - Like pvl_find(), but continues the search where the last find() or - find_next() left off - - Parameters: - - l The list to operate on - f Pointer to the find function - v Pointer to constant data to pass into the function - - Returns: - - Pointer to the element that the find function found. - - *----------------------------------------------------------------------*/ - -pvl_elem -pvl_find_next(pvl_list l,pvl_findf f,void* v) -{ - - pvl_elem e; - - for (e=pvl_head(l); e!= 0; e = pvl_next(e)) - { - if ( (*f)(((struct pvl_elem_t *)e)->d,v) == 1) - { - /* Save this elem for a call to find_next */ - ((struct pvl_list_t *)l)->p = e; - return e; - } - } - - return 0; - -} - -/*---------------------------------------------------------------------- - Function: void pvl_clear(pvl_list l) - - Purpose: - - Remove the all the elements in the list. The does not free the data items - the elements hold. - - - Returns: - *----------------------------------------------------------------------*/ - -void -pvl_clear(pvl_list l) -{ - pvl_elem e = pvl_head(l); - pvl_elem next; - - if (e == 0) { - return; - } - - while(e != 0) - { - next = pvl_next(e); - pvl_remove(l,e); - e = next; - } -} - -/*---------------------------------------------------------------------- - Function: int pvl_count(pvl_list l) - - Purpose: - - Returns the number of items in the list. - - Returns: - *----------------------------------------------------------------------*/ - -int -pvl_count(pvl_list l) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - - return L->count; -} - - -/*---------------------------------------------------------------------- - Function: pvl_elem pvl_next(pvl_elem e) - - Purpose: - Returns a pointer to the given element - - Returns: - *----------------------------------------------------------------------*/ - -pvl_elem -pvl_next(pvl_elem e) -{ - struct pvl_elem_t *E = (struct pvl_elem_t *)e; - - if (E == 0){ - return 0; - } - - return (pvl_elem)E->next; -} - -/*---------------------------------------------------------------------- - Function: pvl_elem pvl_prior(pvl_elem e) - - Purpose: - - Returns a pointer to the element previous to the element given. - - Returns: - *----------------------------------------------------------------------*/ - -pvl_elem -pvl_prior(pvl_elem e) -{ - struct pvl_elem_t *E = (struct pvl_elem_t *)e; - - return (pvl_elem)E->prior; -} - -/*---------------------------------------------------------------------- - Function: pvl_elem pvl_head(pvl_list l ) - - Purpose: - - Returns a pointer to the first item in the list. - - Returns: - *----------------------------------------------------------------------*/ -pvl_elem -pvl_head(pvl_list l ) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - - return (pvl_elem)L->head; -} - -/*---------------------------------------------------------------------- - Function: pvl_elem pvl_tail(pvl_list l) - - Purpose: - - Returns a pointer to the last item in the list. - - Returns: - *----------------------------------------------------------------------*/ -pvl_elem -pvl_tail(pvl_list l) -{ - struct pvl_list_t *L = (struct pvl_list_t *)l; - return (pvl_elem)L->tail; -} - -/*---------------------------------------------------------------------- - Function: - - - Purpose: - - - Returns: - *----------------------------------------------------------------------*/ - -#ifndef PVL_USE_MACROS -void* -pvl_data(pvl_elem e) -{ - struct pvl_elem_t *E = (struct pvl_elem_t *)e; - - if ( e == 0){ - return 0; - } - - return E->d; -} -#endif - -/*---------------------------------------------------------------------- - Function: void pvl_apply(pvl_list l,pvl_applyf f, void *v) - - Purpose: - - Call a function for every item in the list. - - Paramters: - - l The list to operate on - f Pointer to the function to call - v Data to pass to the function on every iteration - - Returns: - - void - *----------------------------------------------------------------------*/ - -void -pvl_apply(pvl_list l,pvl_applyf f, void *v) -{ - pvl_elem e; - - for (e=pvl_head(l); e!= 0; e = pvl_next(e)) - { - (*f)(((struct pvl_elem_t *)e)->d,v); - } - -} diff --git a/libical/src/libical/pvl.h b/libical/src/libical/pvl.h deleted file mode 100644 index 8113f7495a..0000000000 --- a/libical/src/libical/pvl.h +++ /dev/null @@ -1,104 +0,0 @@ -/*====================================================================== - FILE: pvl.h - CREATOR: eric November, 1995 - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - -======================================================================*/ - -/* - struct pvl_elem_t - - This type is private. Always use pvl_elem instead - - */ - -#ifndef __PVL_H__ -#define __PVL_H__ - -typedef void* pvl_list; -typedef void* pvl_elem; - -typedef struct pvl_elem_t -{ - int MAGIC; /* Magic Identifier */ - void *d; /* Pointer to data user is storing */ - struct pvl_elem_t *next; /* Next element */ - struct pvl_elem_t *prior; /* prior element */ -} pvl_elem_t; - - - -/* This global is incremented for each call to pvl_new_element(); it gives each - * list a unique identifer */ - -extern int pvl_elem_count; -extern int pvl_list_count; - -/* Create new lists or elements */ -pvl_elem pvl_new_element(void* d, pvl_elem next,pvl_elem prior); -pvl_list pvl_newlist(); -void pvl_free(pvl_list); - -/* Add, remove, or get the head of the list */ -void pvl_unshift(pvl_list l,void *d); -void* pvl_shift(pvl_list l); -pvl_elem pvl_head(pvl_list); - -/* Add, remove or get the tail of the list */ -void pvl_push(pvl_list l,void *d); -void* pvl_pop(pvl_list l); -pvl_elem pvl_tail(pvl_list); - -/* Insert elements in random places */ -typedef int (*pvl_comparef)(void* a, void* b); /* a, b are of the data type*/ -void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d); -void pvl_insert_after(pvl_list l,pvl_elem e,void *d); -void pvl_insert_before(pvl_list l,pvl_elem e,void *d); - -/* Remove an element, or clear the entire list */ -void* pvl_remove(pvl_list,pvl_elem); /* Remove element, return data */ -void pvl_clear(pvl_list); /* Remove all elements, de-allocate all data */ - -int pvl_count(pvl_list); - -/* Navagate the list */ -pvl_elem pvl_next(pvl_elem e); -pvl_elem pvl_prior(pvl_elem e); - -/* get the data in the list */ -#ifndef PVL_USE_MACROS -void* pvl_data(pvl_elem); -#else -#define pvl_data(x) x==0 ? 0 : ((struct pvl_elem_t *)x)->d; -#endif - - -/* Find an element for which a function returns true */ -typedef int (*pvl_findf)(void* a, void* b); /*a is list elem, b is other data*/ -pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v); -pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v); - -/* Pass each element in the list to a function */ -typedef void (*pvl_applyf)(void* a, void* b); /*a is list elem, b is other data*/ -void pvl_apply(pvl_list l,pvl_applyf f, void *v); - - -#endif /* __PVL_H__ */ - - - - - diff --git a/libical/src/libical/testlocks.c b/libical/src/libical/testlocks.c deleted file mode 100644 index d3e9e55cec..0000000000 --- a/libical/src/libical/testlocks.c +++ /dev/null @@ -1,70 +0,0 @@ -/* This is just a driver to test the filerwlock objects defined in fcntl.c */ -/* MAXCHILD processes are forked. They take turns in using LOCKSSIZE locks.*/ -/* I compiled the program as follows */ -/* cc fcntlmain.c fcntl.c -o fcntlmain */ -/* and then run the image fcntlmain. */ -/* Notice that after the program has run I find the file "mylock" in my */ -/* directory. Not very desirable. Perhaps there is a way to avoid that? */ - -#include -#include -#include "fcntl.h" - -#define LOCKFILE "mylock" -#define LOCKSSIZE 5 -#define MAXCHILD 4 - -void child (int self); - -pid_t cldrn[4]; -filerwlock *fl; - -int -main(void){ - int i; - - fl = filerwlockCreate(LOCKFILE, LOCKSSIZE); - - for (i=0;i < MAXCHILD; i++) { - if ((cldrn[i]=fork()) < 0) { - perror("fork"); - exit(1);} - if (cldrn[i]==0) - child(i); - } - for (i=0; i < MAXCHILD; i++) - wait(); - - filerwlockDelete(fl); - exit(0); -} - -void child (int self) { - int i, j; - char s[256]; - for (j=0; j<8; j++) { - - if (self == 0) { - filerwwritelock(fl,1); - } else if (self == (MAXCHILD-1)) { - filerwlongreadlock(fl); - } else { - filerwreadlock(fl,1); - } - - printf("Child %d starts to sleep on lock %d\n", self, 1); - - sleep(3); - - printf("Child %d ends sleep on lock %d\n", self, 1); - - if (self == (MAXCHILD-1)) { - filerwlongunlock(fl); - } else { - filerwunlock(fl,1); - } - - sleep(1); - } - exit(0); -} diff --git a/libical/src/libicalss/.cvsignore b/libical/src/libicalss/.cvsignore deleted file mode 100644 index 732c1577b6..0000000000 --- a/libical/src/libicalss/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -.deps -Makefile.in -*.lo -*.la -.libs \ No newline at end of file diff --git a/libical/src/libicalss/Makefile.am b/libical/src/libicalss/Makefile.am deleted file mode 100644 index a4fb8ad7ee..0000000000 --- a/libical/src/libicalss/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -noinst_LTLIBRARIES = libicalss.la - -libicalss_la_SOURCES = \ - icalcalendar.c \ - icalcalendar.h \ - icalcluster.c \ - icalcluster.h \ - icalcomponent.h \ - icalstore.c \ - icalstore.h - -INCLUDES = -I../libical/ \ No newline at end of file diff --git a/libical/src/libicalss/icalcalendar.c b/libical/src/libicalss/icalcalendar.c deleted file mode 100644 index 0933df1e31..0000000000 --- a/libical/src/libicalss/icalcalendar.c +++ /dev/null @@ -1,263 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalcalendar.c - CREATOR: eric 23 December 1999 - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - - ======================================================================*/ - - -#include "icalcalendar.h" -#include "icalcluster.h" -#include -#include /* For mkdir, stat */ -#include /* For mkdir */ -#include /* For mkdir */ -#include /* For mkdir, stat */ -#include /* for malloc */ -#include /* for strcat */ -#include - -#define BOOKED_DIR "booked" -#define INCOMING_FILE "incoming.ics" -#define PROP_FILE "properties.ics" -#define FBLIST_FILE "freebusy.ics" - -struct icalcalendar_impl -{ - char* dir; - icalcomponent* freebusy; - icalcomponent* properties; - icalstore* booked; - icalstore* incoming; -}; - -struct icalcalendar_impl* icalcalendar_new_impl() -{ - struct icalcalendar_impl* impl; - - if ( ( impl = (struct icalcalendar_impl*) - malloc(sizeof(struct icalcalendar_impl))) == 0) { - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - - return impl; -} - - -icalerrorenum icalcalendar_create(struct icalcalendar_impl* impl) -{ - char path[PATH_MAX]; - struct stat sbuf; - int r; - - icalerror_check_arg_re((impl != 0),"impl",ICAL_BADARG_ERROR); - - path[0] = '\0'; - strcpy(path,impl->dir); - strcat(path,"/"); - strcat(path,BOOKED_DIR); - - r = stat(path,&sbuf); - - if( r != 0 && errno == ENOENT){ - - if(mkdir(path,0777)!=0){ - icalerror_set_errno(ICAL_FILE_ERROR); - return ICAL_FILE_ERROR; - } - } - - return ICAL_NO_ERROR; -} - -icalcalendar* icalcalendar_new(char* dir) -{ - struct icalcalendar_impl* impl; - - icalerror_check_arg_rz((dir != 0),"dir"); - - impl = icalcalendar_new_impl(); - - if (impl == 0){ - return 0; - } - - impl->dir = (char*)strdup(dir); - impl->freebusy = 0; - impl->properties = 0; - impl->booked = 0; - impl->incoming = 0; - - if (icalcalendar_create(impl) != ICAL_NO_ERROR){ - free(impl); - return 0; - } - - return impl; -} - -void icalcalendar_free(icalcalendar* calendar) -{ - - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - - if (impl->dir !=0){ - free(impl->dir); - } - - if (impl->freebusy !=0){ - icalcluster_free(impl->freebusy); - } - - if (impl->properties !=0){ - icalcluster_free(impl->properties); - } - - if (impl->booked !=0){ - icalstore_free(impl->booked); - } - - if (impl->incoming !=0){ - icalstore_free(impl->incoming); - } - - impl->dir = 0; - impl->freebusy = 0; - impl->properties = 0; - impl->booked = 0; - impl->incoming = 0; - - - free(impl); -} - - -int icalcalendar_lock(icalcalendar* calendar) -{ - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - icalerror_check_arg_rz((impl != 0),"impl"); - return 0; -} - -int icalcalendar_unlock(icalcalendar* calendar) -{ - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - icalerror_check_arg_rz((impl != 0),"impl"); - return 0; -} - -int icalcalendar_islocked(icalcalendar* calendar) -{ - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - icalerror_check_arg_rz((impl != 0),"impl"); - return 0; -} - -int icalcalendar_ownlock(icalcalendar* calendar) -{ - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - icalerror_check_arg_rz((impl != 0),"impl"); - return 0; -} - -icalstore* icalcalendar_get_booked(icalcalendar* calendar) -{ - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - char dir[PATH_MAX]; - - icalerror_check_arg_rz((impl != 0),"impl"); - - dir[0] = '\0'; - strcpy(dir,impl->dir); - strcat(dir,"/"); - strcat(dir,BOOKED_DIR); - - if (impl->booked == 0){ - icalerror_clear_errno(); - impl->booked = icalstore_new(dir); - assert(icalerrno == ICAL_NO_ERROR); - } - - return impl->booked; - -} - -icalcluster* icalcalendar_get_incoming(icalcalendar* calendar) -{ - char path[PATH_MAX]; - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - icalerror_check_arg_rz((impl != 0),"impl"); - - path[0] = '\0'; - strcpy(path,impl->dir); - strcat(path,"/"); - strcat(path,INCOMING_FILE); - - if (impl->properties == 0){ - impl->properties = icalcluster_new(path); - } - - return impl->properties; -} - -icalcluster* icalcalendar_get_properties(icalcalendar* calendar) -{ - char path[PATH_MAX]; - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - icalerror_check_arg_rz((impl != 0),"impl"); - - path[0] = '\0'; - strcpy(path,impl->dir); - strcat(path,"/"); - strcat(path,PROP_FILE); - - if (impl->properties == 0){ - impl->properties = icalcluster_new(path); - } - - return impl->properties; -} - -icalcluster* icalcalendar_get_freebusy(icalcalendar* calendar) -{ - char path[PATH_MAX]; - struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar; - icalerror_check_arg_rz((impl != 0),"impl"); - - path[0] = '\0'; - strcpy(path,impl->dir); - strcat(path,"/"); - strcat(path,FBLIST_FILE); - - - if (impl->freebusy == 0){ - impl->freebusy = icalcluster_new(path); - } - - return impl->freebusy; -} - - - - diff --git a/libical/src/libicalss/icalcalendar.h b/libical/src/libicalss/icalcalendar.h deleted file mode 100644 index 90e7b33c22..0000000000 --- a/libical/src/libicalss/icalcalendar.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalcalendar.h - CREATOR: eric 23 December 1999 - - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - -======================================================================*/ - -#ifndef ICALCALENDAR_H -#define ICALCALENDAR_H - -#include "ical.h" -#include "icalstore.h" -#include "icalcluster.h" - -/* icalcalendar - * Routines for storing calendar data in a file system. The calendar - * has two icalstores, one for incoming components and one for booked - * components. It also has interfaces to access the free/busy list - * and a list of calendar properties */ - -typedef void icalcalendar; - -icalcalendar* icalcalendar_new(char* dir); - -void icalcalendar_free(icalcalendar* calendar); - -int icalcalendar_lock(icalcalendar* calendar); - -int icalcalendar_unlock(icalcalendar* calendar); - -int icalcalendar_islocked(icalcalendar* calendar); - -int icalcalendar_ownlock(icalcalendar* calendar); - -icalstore* icalcalendar_get_booked(icalcalendar* calendar); - -icalcluster* icalcalendar_get_incoming(icalcalendar* calendar); - -icalcluster* icalcalendar_get_properties(icalcalendar* calendar); - -icalcluster* icalcalendar_get_freebusy(icalcalendar* calendar); - - -#endif /* !ICALCALENDAR_H */ - - - diff --git a/libical/src/libicalss/icalcluster.c b/libical/src/libicalss/icalcluster.c deleted file mode 100644 index c0160cc6c3..0000000000 --- a/libical/src/libicalss/icalcluster.c +++ /dev/null @@ -1,398 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalcluster.c - CREATOR: eric 23 December 1999 - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - - ======================================================================*/ - - -#include "icalcluster.h" -#include -#include /* For PATH_MAX */ -#include /* for stat */ -#include /* for stat, getpid */ -#include -#include - -struct icalcluster_impl { - char *path; - icalcomponent* cluster; - int changed; -}; - -icalcluster* icalcluster_new_impl() -{ - struct icalcluster_impl* comp; - - if ( ( comp = (struct icalcluster_impl*) - malloc(sizeof(struct icalcluster_impl))) == 0) { - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - errno = ENOMEM; - return 0; - } - - return comp; -} - -icalerrorenum icalcluster_create_cluster(char *path) -{ - - FILE* f; - int r; - icalcomponent *c; - struct icaltimetype tt; - - icalerror_clear_errno(); - - f = fopen(path,"w"); - - if (f == 0){ - icalerror_set_errno(ICAL_FILE_ERROR); - return ICAL_FILE_ERROR; - } - - /* Create the root component in the cluster. This component holds - all of the other components and stores a count of - components. */ - - memset(&tt,0,sizeof(struct icaltimetype)); - - c = icalcomponent_vanew( - ICAL_VCALENDAR_COMPONENT, - icalproperty_new_xlicclustercount(0), - icalproperty_new_dtstart(tt), /* dtstart of earliest comp */ - icalproperty_new_dtend(tt), /* dtend of latest comp, excl. recuring */ - 0 - ); - - if (c == 0){ - fclose(f); - icalerror_set_errno(ICAL_INTERNAL_ERROR); - return ICAL_INTERNAL_ERROR; - } - - - /* Write the base component to the file */ - r = fputs(icalcomponent_as_ical_string(c),f); - - fclose(f); - - icalcomponent_free(c); - - if (r == EOF){ - icalerror_set_errno(ICAL_FILE_ERROR); - return ICAL_FILE_ERROR; - } - - return ICAL_NO_ERROR; -} - -FILE* parser_file; /*HACK. Not Thread Safe */ -char* read_from_file(char *s, size_t size) -{ - char *c = fgets(s,size, parser_file); - return c; -} - -icalerrorenum icalcluster_load(icalcluster* cluster, char* path) -{ - struct icalcluster_impl *impl = (struct icalcluster_impl*)cluster; - icalerrorenum error; - errno = 0; - - icalerror_check_arg_rz((cluster!=0),"cluster"); - icalerror_check_arg_rz((path!=0),"path"); - - if(impl->path != 0 && strcmp(impl->path,path) == 0){ - /* Already have the right cluster, so return */ - return ICAL_NO_ERROR; - } - - error = icalcluster_commit(cluster); - - if (error != ICAL_NO_ERROR){ - icalerror_set_errno(error); - return error; - } - - free(impl->path); - - impl->path= (char*)strdup(path); - - parser_file = fopen(impl->path,"r"); - - /* HACK. Yeah, the following code is horrible....*/ - if (parser_file ==0 || errno != 0){ - - /* Try to create the cluster */ - error = icalcluster_create_cluster(path); - - if (error == ICAL_NO_ERROR){ - /* Try to open the parser again. */ - errno = 0; - parser_file = fopen(impl->path,"r"); - - if (parser_file ==0 || errno != 0){ - impl->cluster = 0; - icalerror_set_errno(ICAL_FILE_ERROR); - return ICAL_FILE_ERROR; - } - } else { - impl->cluster = 0; - icalerror_set_errno(error); /* Redundant, actually */ - return error; - } - } - - impl->cluster = icalparser_parse(read_from_file); - - fclose(parser_file); - - if (impl->cluster == 0){ - icalerror_set_errno(ICAL_PARSE_ERROR); - return ICAL_PARSE_ERROR; - } - - return ICAL_NO_ERROR; -} - - -icalcluster* icalcluster_new(char* path) -{ - struct icalcluster_impl *impl = icalcluster_new_impl(); - struct stat sbuf; - int createclusterfile = 0; - icalerrorenum error; - - icalerror_clear_errno(); - icalerror_check_arg_rz( (path!=0), "path"); - - if (impl == 0){ - return 0; - } - - /*impl->path = strdup(path); icalcluster_load does this */ - impl->changed = 0; - impl->cluster = 0; - impl->path = 0; - - /* Check if the path already exists and if it is a regular file*/ - if (stat(path,&sbuf) != 0){ - - /* A file by the given name does not exist, or there was - another error */ - - if (errno == ENOENT) { - /* It was because the file does not exist */ - createclusterfile = 1; - } else { - /* It was because of another error */ - icalerror_set_errno(ICAL_FILE_ERROR); - return 0; - } - } else { - /* A file by the given name exists, but is it a regular file */ - - if (!S_ISREG(sbuf.st_mode)){ - /* Nope, not a directory */ - icalerror_set_errno(ICAL_FILE_ERROR); - return 0; - } else { - /* Lets assume that it is a file of the right type */ - createclusterfile = 0; - } - } - - /* if cluster does not already exist, create it */ - - if (createclusterfile == 1) { - error = icalcluster_create_cluster(path); - - if (error != ICAL_NO_ERROR){ - icalerror_set_errno(error); - return 0; - } - } - - error = icalcluster_load(impl,path); - - if (error != ICAL_NO_ERROR){ - return 0; - } - - return impl; -} - -void icalcluster_free(icalcluster* cluster) -{ - struct icalcluster_impl *impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_rv((cluster!=0),"cluster"); - - if (impl->cluster != 0){ - icalcluster_commit(cluster); - icalcomponent_free(impl->cluster); - impl->cluster=0; - } - - if(impl->path != 0){ - free(impl->path); - impl->path = 0; - } - - free(impl); -} - -icalerrorenum icalcluster_commit(icalcluster* cluster) -{ - int ws; /* Size in char of file written to disk */ - FILE *f; - - struct icalcluster_impl *impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR); - - if (impl->changed != 0 ){ - /* write the cluster to disk */ - - /* Construct a filename and write out the file */ - - if ( (f = fopen(impl->path,"w")) != 0){ - - char* str = icalcomponent_as_ical_string(impl->cluster); - - ws = fwrite(str,sizeof(char),strlen(str),f); - - if ( ws < strlen(str)){ - fclose(f); - return ICAL_FILE_ERROR; - } - - fclose(f); - impl->changed = 0; - return ICAL_NO_ERROR; - } else { - icalerror_set_errno(ICAL_FILE_ERROR); - return ICAL_FILE_ERROR; - } - - } - - return ICAL_NO_ERROR; -} - -void icalcluster_mark(icalcluster* cluster){ - - struct icalcluster_impl *impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_rv((impl!=0),"cluster"); - - impl->changed = 1; - -} - -icalcomponent* icalcluster_get_component(icalcluster* cluster){ - struct icalcluster_impl *impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR); - - return impl->cluster; -} - - -/* manipulate the components in the cluster */ - -icalerrorenum icalcluster_add_component(icalcluster *cluster, - icalcomponent* child) -{ - struct icalcluster_impl* impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_rv((cluster!=0),"cluster"); - icalerror_check_arg_rv((child!=0),"child"); - - icalcomponent_add_component(impl->cluster,child); - - icalcluster_mark(cluster); - - return ICAL_NO_ERROR; - -} - -icalerrorenum icalcluster_remove_component(icalcluster *cluster, - icalcomponent* child) -{ - struct icalcluster_impl* impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_rv((cluster!=0),"cluster"); - icalerror_check_arg_rv((child!=0),"child"); - - icalcomponent_remove_component(impl->cluster,child); - - icalcluster_mark(cluster); - - return ICAL_NO_ERROR; -} - -int icalcluster_count_components(icalcluster *cluster, - icalcomponent_kind kind) -{ - struct icalcluster_impl* impl = (struct icalcluster_impl*)cluster; - - if(cluster == 0){ - icalerror_set_errno(ICAL_BADARG_ERROR); - return -1; - } - - return icalcomponent_count_components(impl->cluster,kind); -} - -/* Iterate through components */ -icalcomponent* icalcluster_get_current_component (icalcluster* cluster) -{ - struct icalcluster_impl* impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_rz((cluster!=0),"cluster"); - - return icalcomponent_get_current_component(impl->cluster); -} - -icalcomponent* icalcluster_get_first_component(icalcluster* cluster, - icalcomponent_kind kind) -{ - struct icalcluster_impl* impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_rz((cluster!=0),"cluster"); - - return icalcomponent_get_first_component(impl->cluster,kind); -} - -icalcomponent* icalcluster_get_next_component(icalcluster* cluster, - icalcomponent_kind kind) -{ - struct icalcluster_impl* impl = (struct icalcluster_impl*)cluster; - - icalerror_check_arg_rz((cluster!=0),"cluster"); - - return icalcomponent_get_next_component(impl->cluster,kind); -} - diff --git a/libical/src/libicalss/icalcluster.h b/libical/src/libicalss/icalcluster.h deleted file mode 100644 index 05c3a4b144..0000000000 --- a/libical/src/libicalss/icalcluster.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalcluster.h - CREATOR: eric 23 December 1999 - - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - -======================================================================*/ - -#ifndef ICALCLUSTER_H -#define ICALCLUSTER_H - -#include "ical.h" - -typedef void icalcluster; - - -icalcluster* icalcluster_new(char* path); -void icalcluster_free(icalcluster* cluster); - - -/* Load a new file into the cluster */ -icalerrorenum icalcluster_load(icalcluster* cluster, char* path); - -/* Return a reference to the internal component. */ -icalcomponent* icalcluster_get_component(icalcluster* cluster); - -/* Mark the cluster as changed, so it will be written to disk when it - is freed*/ -void icalcluster_mark(icalcluster* cluster); - -/* Write the cluster data back to disk */ -icalerrorenum icalcluster_commit(icalcluster* cluster); - -/* manipulate the components in the cluster */ -icalerrorenum icalcluster_add_component(icalcomponent* parent, - icalcomponent* child); - -icalerrorenum icalcluster_remove_component(icalcomponent* parent, - icalcomponent* child); - -int icalcluster_count_components(icalcomponent* component, - icalcomponent_kind kind); - -/* Iterate through components */ -icalcomponent* icalcluster_get_current_component (icalcomponent* component); - -icalcomponent* icalcluster_get_first_component(icalcomponent* component, - icalcomponent_kind kind); -icalcomponent* icalcluster_get_next_component(icalcomponent* component, - icalcomponent_kind kind); - -#endif /* !ICALCLUSTER_H */ - - - diff --git a/libical/src/libicalss/icalcomponent.h b/libical/src/libicalss/icalcomponent.h deleted file mode 100644 index 9e0e9f5a9f..0000000000 --- a/libical/src/libicalss/icalcomponent.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalcomponent.h - CREATOR: eric 20 March 1999 - - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icalcomponent.h - -======================================================================*/ - -#ifndef ICALCOMPONENT_H -#define ICALCOMPONENT_H - -#include "icalproperty.h" -#include "icalvalue.h" -#include "icalenums.h" /* defines icalcomponent_kind */ - -typedef void icalcomponent; - -icalcomponent* icalcomponent_new(icalcomponent_kind kind); -icalcomponent* icalcomponent_new_clone(icalcomponent* component); -icalcomponent* icalcomponent_new_from_string(char* str); -icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...); -void icalcomponent_free(icalcomponent* component); - -char* icalcomponent_as_ical_string(icalcomponent* component); - -int icalcomponent_is_valid(icalcomponent* component); - -icalcomponent_kind icalcomponent_isa(icalcomponent* component); - -int icalcomponent_isa_component (void* component); - -/* - * Working with properties - */ - -void icalcomponent_add_property(icalcomponent* component, - icalproperty* property); - -void icalcomponent_remove_property(icalcomponent* component, - icalproperty* property); - -int icalcomponent_count_properties(icalcomponent* component, - icalproperty_kind kind); - -/* Iterate through the properties */ -icalproperty* icalcomponent_get_current_property(icalcomponent* component); - -icalproperty* icalcomponent_get_first_property(icalcomponent* component, - icalproperty_kind kind); -icalproperty* icalcomponent_get_next_property(icalcomponent* component, - icalproperty_kind kind); - -/* Return a null-terminated array of icalproperties*/ - -icalproperty** icalcomponent_get_properties(icalcomponent* component, - icalproperty_kind kind); - - -/* - * Working with components - */ - - -void icalcomponent_add_component(icalcomponent* parent, - icalcomponent* child); - -void icalcomponent_remove_component(icalcomponent* parent, - icalcomponent* child); - -int icalcomponent_count_components(icalcomponent* component, - icalcomponent_kind kind); - -/* Iterate through components */ -icalcomponent* icalcomponent_get_current_component (icalcomponent* component); - -icalcomponent* icalcomponent_get_first_component(icalcomponent* component, - icalcomponent_kind kind); -icalcomponent* icalcomponent_get_next_component(icalcomponent* component, - icalcomponent_kind kind); - -/* Return a null-terminated array of icalproperties*/ -icalproperty** icalcomponent_get_component(icalcomponent* component, - icalproperty_kind kind); - -/* Working with embedded error properties */ - -int icalcomponent_count_errors(icalcomponent* component); -void icalcomponent_strip_errors(icalcomponent* component); - - -/* Internal operations. You don't see these... */ -icalcomponent* icalcomponent_get_parent(icalcomponent* component); -void icalcomponent_set_parent(icalcomponent* component, - icalcomponent* parent); - -#endif /* !ICALCOMPONENT_H */ - - - diff --git a/libical/src/libicalss/icalstore.c b/libical/src/libicalss/icalstore.c deleted file mode 100644 index 5d1546f3b2..0000000000 --- a/libical/src/libicalss/icalstore.c +++ /dev/null @@ -1,817 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icalstore.c - CREATOR: eric 28 November 1999 - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - - ======================================================================*/ - - -/* - - icalstore manages a database of ical components and offers - interfaces for reading, writting and searching for components. - - icalstore groups components in to clusters based on their DTSTART - time -- all components that start in the same month are grouped - together in a single file. All files in a sotre are kept in a single - directory. ( If a component does not have DTSTART, the store uses - DTSTAMP or CREATE ) - - The primary interfaces are icalstore_first and icalstore_next. These - routine iterate through all of the components in the store, subject - to the current gauge. A gauge is an icalcomponent that is tested - against other componets for a match. If a gauge has been set with - icalstore_select, icalstore_first and icalstore_next will only - return componentes that match the gauge. - - The Store generated UIDs for all objects that are stored if they do - not already have a UID. The UID is the name of the cluster (month & - year as MMYYYY) plus a unique serial number. The serial number is - stored as a property of the cluster. - -*/ - -#include "ical.h" -#include "icalstore.h" -#include "pvl.h" -#include "icalerror.h" -#include "icalparser.h" -#include "icalcluster.h" - -#include "filelock.h" - -#include -#include /* for opendir() */ -#include -#include /* for opendir() */ -#include /* for stat */ -#include /* for stat, getpid */ -#include /* for clock() */ -#include /* for rand(), srand() */ -#include /* for uname */ -#include /* for strdup */ - - -struct icalstore_impl -{ - char* dir; - icalcomponent* gauge; - icalcluster* cluster; - int first_component; - pvl_list directory; - pvl_elem directory_iterator; -}; - -struct icalstore_impl* icalstore_new_impl() -{ - struct icalstore_impl* comp; - - if ( ( comp = (struct icalstore_impl*) - malloc(sizeof(struct icalstore_impl))) == 0) { - icalerror_set_errno(ICAL_NEWFAILED_ERROR); - return 0; - } - - return comp; -} - - - -void icalstore_lock_dir(char* dir) -{ -} - - -void icalstore_unlock_dir(char* dir) -{ -} - -/* Load the contents of the store directory into the store's internal directory list*/ -icalerrorenum icalstore_read_directory(struct icalstore_impl* impl) -{ - struct dirent *de; - DIR* dp; - char *str; - - dp = opendir(impl->dir); - - if ( dp == 0) { - icalerror_set_errno(ICAL_FILE_ERROR); - return ICAL_FILE_ERROR; - } - - /* clear contents of directory list */ - while((str = pvl_pop(impl->directory))){ - free(str); - } - - /* load all of the cluster names in the directory list */ - for(de = readdir(dp); - de != 0; - de = readdir(dp)){ - - /* Remove known directory names '.' and '..'*/ - if (strcmp(de->d_name,".") == 0 || - strcmp(de->d_name,"..") == 0 ){ - continue; - } - - pvl_push(impl->directory, (void*)strdup(de->d_name)); - } - - closedir(dp); - - return ICAL_NO_ERROR; -} - -icalstore* icalstore_new(char* dir) -{ - struct icalstore_impl *impl = icalstore_new_impl(); - struct stat sbuf; - - if (impl == 0){ - return 0; - } - - icalerror_check_arg_rz( (dir!=0), "dir"); - - if (stat(dir,&sbuf) != 0){ - icalerror_set_errno(ICAL_FILE_ERROR); - return 0; - } - - /* dir is not the name of a direectory*/ - if (!S_ISDIR(sbuf.st_mode)){ - icalerror_set_errno(ICAL_USAGE_ERROR); - return 0; - } - - icalstore_lock_dir(dir); - - impl = icalstore_new_impl(); - - if (impl ==0){ - icalerror_set_errno(ICAL_ALLOCATION_ERROR); - return 0; - } - - impl->directory = pvl_newlist(); - impl->directory_iterator = 0; - impl->dir = (char*)strdup(dir); - impl->gauge = 0; - impl->first_component = 0; - impl->cluster = 0; - - icalstore_read_directory(impl); - - return (icalstore*) impl; -} - -void icalstore_free(icalstore* s) -{ - struct icalstore_impl *impl = (struct icalstore_impl*)s; - char* str; - - icalstore_unlock_dir(impl->dir); - - if(impl->dir !=0){ - free(impl->dir); - } - - if(impl->gauge !=0){ - icalcomponent_free(impl->gauge); - } - - if(impl->cluster !=0){ - icalcluster_free(impl->cluster); - } - - while(impl->directory !=0 && (str=pvl_pop(impl->directory)) != 0){ - free(str); - } - - if(impl->directory != 0){ - pvl_free(impl->directory); - } - - impl->directory = 0; - impl->directory_iterator = 0; - impl->dir = 0; - impl->gauge = 0; - impl->first_component = 0; - - free(impl); - -} - -/* icalstore_next_uid_number updates a serial number in the Store - directory in a file called SEQUENCE */ - -int icalstore_next_uid_number(icalstore* store) -{ - struct icalstore_impl *impl = (struct icalstore_impl*)store; - char sequence = 0; - char temp[128]; - char filename[PATH_MAX]; - char *r; - FILE *f; - struct stat sbuf; - - icalerror_check_arg_rz( (store!=0), "store"); - - sprintf(filename,"%s/%s",impl->dir,"SEQUENCE"); - - /* Create the file if it does not exist.*/ - if (stat(filename,&sbuf) == -1 || !S_ISREG(sbuf.st_mode)){ - - f = fopen(filename,"w"); - if (f != 0){ - fprintf(f,"0"); - fclose(f); - } else { - icalerror_warn("Can't create SEQUENCE file in icalstore_next_uid_number"); - return 0; - } - - } - - if ( (f = fopen(filename,"r+")) != 0){ - - rewind(f); - r = fgets(temp,128,f); - - if (r == 0){ - sequence = 1; - } else { - sequence = atoi(temp)+1; - } - - rewind(f); - - fprintf(f,"%d",sequence); - - fclose(f); - - return sequence; - - } else { - icalerror_warn("Can't create SEQUENCE file in icalstore_next_uid_number"); - return 0; - } - -} - -icalerrorenum icalstore_next_cluster(icalstore* store) -{ - struct icalstore_impl *impl = (struct icalstore_impl*)store; - char path[PATH_MAX]; - - if (impl->directory_iterator == 0){ - icalerror_set_errno(ICAL_INTERNAL_ERROR); - return ICAL_INTERNAL_ERROR; - } - impl->directory_iterator = pvl_next(impl->directory_iterator); - - if (impl->directory_iterator == 0){ - /* There are no more clusters */ - impl->cluster = 0; - return ICAL_NO_ERROR; - } - - - sprintf(path,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator)); - - return icalcluster_load(impl->cluster,path); -} - -void icalstore_add_uid(icalstore* store, icalstore* comp) -{ - char uidstring[PATH_MAX]; - icalproperty *uid; - struct utsname unamebuf; - - icalerror_check_arg_rz( (store!=0), "store"); - icalerror_check_arg_rz( (comp!=0), "comp"); - - uid = icalcomponent_get_first_property(comp,ICAL_UID_PROPERTY); - - if (uid == 0) { - - uname(&unamebuf); - - sprintf(uidstring,"%d-%s",getpid(),unamebuf.nodename); - - uid = icalproperty_new_uid(uidstring); - icalcomponent_add_property(comp,uid); - } else { - - strcpy(uidstring,icalproperty_get_uid(uid)); - } -} - -icalerrorenum icalstore_add_component(icalstore* store, icalstore* comp) -{ - struct icalstore_impl *impl; - char clustername[PATH_MAX]; - icalproperty *dt, *count, *lm; - icalvalue *v; - struct icaltimetype tm; - icalerrorenum error = ICAL_NO_ERROR; - - impl = (struct icalstore_impl*)store; - icalerror_check_arg_rz( (store!=0), "store"); - icalerror_check_arg_rz( (comp!=0), "comp"); - - errno = 0; - - icalstore_add_uid(store,comp); - - /* Determine which cluster this object belongs in */ - - dt = icalcomponent_get_first_property(comp,ICAL_DTSTART_PROPERTY); - - if (dt == 0){ - dt = icalcomponent_get_first_property(comp,ICAL_DTSTAMP_PROPERTY); - } - - if (dt == 0){ - dt = icalcomponent_get_first_property(comp,ICAL_CREATED_PROPERTY); - } - - if (dt == 0){ - icalerror_warn("The component does not have a DTSTART, DTSTAMP or a CREATED property, so it cannot be added to the store"); - icalerror_set_errno(ICAL_BADARG_ERROR); - return ICAL_BADARG_ERROR; - } - - v = icalproperty_get_value(dt); - - tm = icalvalue_get_datetime(v); - - sprintf(clustername,"%s/%04d%02d",impl->dir,tm.year,tm.month); - - /* Load the cluster and insert the object */ - - if (impl->cluster == 0){ - impl->cluster = icalcluster_new(clustername); - - if (impl->cluster == 0){ - error = icalerrno; - } - } else { - error = icalcluster_load(impl->cluster, - clustername); - - } - - - if (error != ICAL_NO_ERROR){ - icalerror_set_errno(error); - return error; - } - - /* Update or add the LAST-MODIFIED property */ - - lm = icalcomponent_get_first_property(comp, - ICAL_LASTMODIFIED_PROPERTY); - - if (lm == 0){ - lm = icalproperty_new_lastmodified(icaltimetype_from_timet( time(0),1)); - icalcomponent_add_property(comp,lm); - } else { - icalproperty_set_lastmodified(comp,icaltimetype_from_timet( time(0),1)); - } - - - /* Add the component to the cluster */ - - icalcluster_add_component(impl->cluster,comp); - - - /* Increment the clusters count value */ - count = icalcomponent_get_first_property( - icalcluster_get_component(impl->cluster), - ICAL_XLICCLUSTERCOUNT_PROPERTY); - - if (count == 0){ - icalerror_set_errno(ICAL_INTERNAL_ERROR); - return ICAL_INTERNAL_ERROR; - } - - icalproperty_set_xlicclustercount(count, - icalproperty_get_xlicclustercount(count)+1); - - - icalcluster_mark(impl->cluster); - - return ICAL_NO_ERROR; -} - -/* Remove a component in the current cluster */ -icalerrorenum icalstore_remove_component(icalstore* store, icalstore* comp) -{ - struct icalstore_impl *impl = (struct icalstore_impl*)store; - icalproperty *count; - - icalerror_check_arg_re((store!=0),"store",ICAL_BADARG_ERROR); - icalerror_check_arg_re((comp!=0),"comp",ICAL_BADARG_ERROR); - icalerror_check_arg_re((impl->cluster!=0),"Cluster pointer",ICAL_USAGE_ERROR); - -/* HACK The following code should be used to ensure that the component -the caller is trying to remove is actually in the cluster, but it -resets the internal iterators, which immediately ends any loops over -the cluster the caller may have in progress - - for(c = icalcluster_get_first_component( - impl->cluster, - ICAL_ANY_COMPONENT); - c != 0; - c = icalcluster_get_next_component( - impl->cluster, - ICAL_ANY_COMPONENT)){ - - if (c == comp){ - found = 1; - } - - } - - if (found != 1){ - icalerror_warn("icalstore_remove_component: component is not part of current cluster"); - icalerror_set_errno(ICAL_USAGE_ERROR); - return ICAL_USAGE_ERROR; - } - -*/ - - icalcluster_remove_component(impl->cluster, - comp); - - icalcluster_mark(impl->cluster); - - /* Decrement the clusters count value */ - count = icalcomponent_get_first_property( - icalcluster_get_component(impl->cluster), - ICAL_XLICCLUSTERCOUNT_PROPERTY); - - if (count == 0){ - icalerror_set_errno(ICAL_INTERNAL_ERROR); - return ICAL_INTERNAL_ERROR; - } - - icalproperty_set_xlicclustercount(count, - icalproperty_get_xlicclustercount(count)-1); - - return ICAL_NO_ERROR; -} - -/* Convert a VQUERY component into a gauge */ -icalcomponent* icalstore_make_gauge(icalcomponent* query); - -/* icalstore_test compares a component against a gauge, and returns - true if the component passes the test - - The gauge is a VCALENDAR component that specifies how to test the - target components. The guage holds a collection of VEVENT, VTODO or - VJOURNAL sub-components. Each of the sub-components has a - collection of properties that are compared to corresponding - properties in the target component, according to the - X-LIC-COMPARETYPE parameters to the gauge's properties. - - When a gauge has several sub-components, the results of testing the - target against each of them is ORed together - the target - component will pass if it matches any of the sub-components in the - gauge. However, the results of matching the proeprties in a - sub-component are ANDed -- the target must match every property in - a gauge sub-component to match the sub-component. - - Here is an example: - - BEGIN:VCOMPONENT - BEGIN:VEVENT - DTSTART;X-LIC-COMPARETYPE=LESS:19981025T020000 - ORGANIZER;X-LIC-COMPARETYPE=EQUAL:mrbig@host.com - END:VEVENT - BEGIN:VEVENT - LOCATION;X-LIC-COMPARETYPE=EQUAL:McNary's Pub - END:VEVENT - END:VCALENDAR - - This gauge has two sub-components; one which will match a VEVENT - based on start time, and organizer, and another that matches based - on LOCATION. A target component will pass the test if it matched - either of the gauge. - - */ - -int icalstore_test(icalcomponent* comp, icalcomponent* gauge) -{ - int pass = 0,localpass = 0; - icalcomponent *c; - icalproperty *p; - icalcomponent *child; - - icalerror_check_arg_rz( (comp!=0), "comp"); - icalerror_check_arg_rz( (gauge!=0), "gauge"); - - for(c = icalcomponent_get_first_component(gauge,ICAL_ANY_COMPONENT); - c != 0; - c = icalcomponent_get_next_component(gauge,ICAL_ANY_COMPONENT)){ - - - /* Test properties. For each property in the gauge, search through - the component for a similar property. If one is found, compare - the two properties value with the comparison specified in the - gauge with the X-LIC-COMPARETYPE parameter */ - - for(p = icalcomponent_get_first_property(c,ICAL_ANY_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(c,ICAL_ANY_PROPERTY)){ - - icalproperty* targetprop; - icalparameter* compareparam; - icalparameter_xliccomparetype compare; - int rel; /* The realtionship between the gauge and target values.*/ - - /* Extract the comparison type from the gauge. If there is no - comparison type, assume that it is "EQUAL" */ - - compareparam = icalproperty_get_first_parameter( - p, - ICAL_XLICCOMPARETYPE_PARAMETER); - - if (compareparam!=0){ - compare = icalparameter_get_xliccomparetype(compareparam); - } else { - compare = ICAL_XLICCOMPARETYPE_EQUAL; - } - - /* Find a property in the component that has the same type as - the gauge property */ - - targetprop = icalcomponent_get_first_property(comp, - icalproperty_isa(p)); - - - if(targetprop == 0){ - continue; - } - - /* Compare the values of the gauge property and the target - property */ - - rel = icalvalue_compare(icalproperty_get_value(p), - icalproperty_get_value(targetprop)); - - /* Now see if the comparison is equavalent to the comparison - specified in the gauge */ - - if (rel == compare){ - localpass++; - } else if (compare == ICAL_XLICCOMPARETYPE_LESSEQUAL && - ( rel == ICAL_XLICCOMPARETYPE_LESS || - rel == ICAL_XLICCOMPARETYPE_EQUAL)) { - localpass++; - } else if (compare == ICAL_XLICCOMPARETYPE_GREATEREQUAL && - ( rel == ICAL_XLICCOMPARETYPE_GREATER || - rel == ICAL_XLICCOMPARETYPE_EQUAL)) { - localpass++; - } else if (compare == ICAL_XLICCOMPARETYPE_NOTEQUAL && - ( rel == ICAL_XLICCOMPARETYPE_GREATER || - rel == ICAL_XLICCOMPARETYPE_LESS)) { - pass++; - } else { - localpass = 0; - } - - pass += localpass; - } - - - /* test subcomponents. Look for a child component that has a - counterpart in the gauge. If one is found, recursively call - icalstore_test */ - - for(child = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT); - child != 0; - child = icalcomponent_get_next_component(comp,ICAL_ANY_COMPONENT)){ - - pass += icalstore_test(child,gauge); - - } - } - - return pass>0; - -} - -icalcomponent* icalstore_query(icalstore* store, icalstore* query); - - -icalcomponent* icalstore_fetch(icalstore* store, char* uid) -{ - icalcomponent *gauge; - icalcomponent *old_gauge; - icalcomponent *c; - struct icalstore_impl *impl = (struct icalstore_impl*)store; - - icalerror_check_arg_rz( (store!=0), "store"); - icalerror_check_arg_rz( (uid!=0), "uid"); - - gauge = - icalcomponent_vanew( - ICAL_VCALENDAR_COMPONENT, - icalcomponent_vanew( - ICAL_VEVENT_COMPONENT, - icalproperty_vanew_uid( - uid, - icalparameter_new_xliccomparetype( - ICAL_XLICCOMPARETYPE_EQUAL), - 0), - 0), - 0); - - old_gauge = impl->gauge; - impl->gauge = gauge; - - c= icalstore_get_first_component(store); - - impl->gauge = old_gauge; - - icalcomponent_free(gauge); - - return c; -} - - -int icalstore_has_uid(icalstore* store, char* uid) -{ - icalcomponent *c; - - icalerror_check_arg_rz( (store!=0), "store"); - icalerror_check_arg_rz( (uid!=0), "uid"); - - /* HACK. This is a temporary implementation. _has_uid should use a - database, and _fetch should use _has_uid, not the other way - around */ - c = icalstore_fetch(store,uid); - - return c!=0; - -} - - -icalerrorenum icalstore_select(icalstore* store, icalcomponent* gauge) -{ - struct icalstore_impl *impl = (struct icalstore_impl*)store; - - icalerror_check_arg_re( (store!=0), "store",ICAL_BADARG_ERROR); - icalerror_check_arg_re( (gauge!=0), "gauge",ICAL_BADARG_ERROR); - - if (!icalcomponent_is_valid(gauge)){ - return ICAL_BADARG_ERROR; - } - - impl->gauge = gauge; - - return ICAL_NO_ERROR; -} - - - -icalcomponent* icalstore_get_first_component(icalstore* store) -{ - struct icalstore_impl *impl = (struct icalstore_impl*)store; - icalerrorenum error; - char path[PATH_MAX]; - - error = icalstore_read_directory(impl); - - if (error != ICAL_NO_ERROR){ - icalerror_set_errno(error); - return 0; - } - - impl->directory_iterator = pvl_head(impl->directory); - - if (impl->directory_iterator == 0){ - icalerror_set_errno(error); - return 0; - } - - sprintf(path,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator)); - - if (impl->cluster == 0){ - impl->cluster = icalcluster_new(path); - - if (impl->cluster == 0){ - error = icalerrno; - } - } else { - error = icalcluster_load(impl->cluster,path); - - } - - if (error != ICAL_NO_ERROR){ - icalerror_set_errno(error); - return 0; - } - - impl->first_component = 1; - - return icalstore_get_next_component(store); -} - -icalcomponent* icalstore_get_next_component(icalstore* store) -{ - struct icalstore_impl *impl; - icalcomponent *c; - icalerrorenum error; - - icalerror_check_arg_rz( (store!=0), "store"); - - impl = (struct icalstore_impl*)store; - - if(impl->cluster == 0){ - - icalerror_warn("icalstore_get_next_component called with a NULL cluster (Caller must call icalstore_get_first_component first"); - icalerror_set_errno(ICAL_USAGE_ERROR); - return 0; - - } - - /* Set the component iterator for the following for loop */ - if (impl->first_component == 1){ - icalcluster_get_first_component( - impl->cluster, - ICAL_ANY_COMPONENT); - impl->first_component = 0; - } else { - icalcluster_get_next_component( - impl->cluster, - ICAL_ANY_COMPONENT); - } - - - while(1){ - /* Iterate through all of the objects in the cluster*/ - for( c = icalcluster_get_current_component( - impl->cluster); - c != 0; - c = icalcluster_get_next_component( - impl->cluster, - ICAL_ANY_COMPONENT)){ - - /* If there is a gauge defined and the component does not - pass the gauge, skip the rest of the loop */ - if (impl->gauge != 0 && icalstore_test(c,impl->gauge) == 0){ - continue; - } - - /* Either there is no gauge, or the component passed the - gauge, so return it*/ - - return c; - } - - /* Fell through the loop, so the component we want is not - in this cluster. Load a new cluster and try again.*/ - - error = icalstore_next_cluster(store); - - if(impl->cluster == 0 || error != ICAL_NO_ERROR){ - /* No more clusters */ - return 0; - } else { - c = icalcluster_get_first_component( - impl->cluster, - ICAL_ANY_COMPONENT); - } - } -} - - - - - - diff --git a/libical/src/libicalss/icalstore.h b/libical/src/libicalss/icalstore.h deleted file mode 100644 index 13e0a182b5..0000000000 --- a/libical/src/libicalss/icalstore.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C -*- */ -/*====================================================================== - FILE: icalstore.h - CREATOR: eric 28 November 1999 - - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - -======================================================================*/ - -#ifndef ICALSTORE_H -#define ICALSTORE_H - -#include "ical.h" -#include "icalerror.h" -typedef void icalstore; - -/* icalstore Routines for storing, fetching, and searching for ical - * objects in a database */ - -icalstore* icalstore_new(char* dir); - -void icalstore_free(icalstore* store); - -/* Add a new component to the store */ -icalerrorenum icalstore_add_component(icalstore* store, icalstore* comp); - -/* Remove a component from the store */ -icalerrorenum icalstore_remove_component(icalstore* store, icalstore* comp); - -/* Restrict the component returned by icalstore_first, _next to those - that pass the gauge */ -icalerrorenum icalstore_select(icalstore* store, icalcomponent* gauge); - -/* Return true if a component passes the gauge */ -int icalstore_test(icalcomponent* comp, icalcomponent* gauge); - -/* Clear the restrictions set by icalstore_select */ -void icalstore_clear(icalstore* store); - -/* Get a single component by uid */ -icalcomponent* icalstore_fetch(icalstore* store, char* uid); - -/* Return true of the store has an object with the given UID */ -int icalstore_has_uid(icalstore* store, char* uid); - -/* Return the first component in the store, or first that passes the gauge.*/ -icalcomponent* icalstore_get_first_component(icalstore* store); - -/* Return the next component in the store, or next that passes the gauge.*/ -icalcomponent* icalstore_get_next_component(icalstore* store); - - -int icalstore_next_uid_number(icalstore* store); - - -#endif /* !ICALSTORE_H */ - - - diff --git a/libical/src/pvl/Makefile b/libical/src/pvl/Makefile deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libical/src/test/.cvsignore b/libical/src/test/.cvsignore deleted file mode 100644 index a9aee21a41..0000000000 --- a/libical/src/test/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -usecases -copycluster -regression -icalparser -findobj diff --git a/libical/src/test/Makefile.in b/libical/src/test/Makefile.in deleted file mode 100644 index 5d3d5f709f..0000000000 --- a/libical/src/test/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -INCLUDES = -I . -I../libical -I../libicalss -CFLAGS = -Wall -g $(INCLUDES) -LIBS = -L../libical -L../libicalss -licalss -lical -CC = gcc -LD = ld - -all: usecases copycluster regression parser findobj - -parser: icaltestparser.o ../libical/libical.a ../libicalss/libicalss.a - $(CC) -o icalparser icaltestparser.o $(LIBS) - -copycluster: copycluster.o ../libical/libical.a ../libicalss/libicalss.a - $(CC) -o copycluster copycluster.o $(INCLUDES) $(LIBS) - -findobj: findobj.o ../libical/libical.a ../libicalss/libicalss.a - $(CC) -o findobj findobj.o $(INCLUDES) $(LIBS) - -regression: regression.o ../libical/libical.a ../libicalss/libicalss.a - $(CC) -o regression regression.o $(INCLUDES) $(LIBS) - -usecases: usecases.o ../libical/libical.a ../libicalss/libicalss.a - $(CC) -o usecases usecases.o $(INCLUDES) $(LIBS) - -clean: - -/bin/rm -f *.o - -/bin/rm -f \#* - -/bin/rm -f *~ Makefile.bak icalitip.tab.h icalitip.tab.c lex.yy.c - -/bin/rm -rf icalparser core regression usecases copycluster findobj - -ci: clean - ci -u *.c *.h - -depend: - @makedepend -Y $(INCLUDES) $(SOURCES) - -install: \ No newline at end of file diff --git a/libical/src/test/alice/booked/199706 b/libical/src/test/alice/booked/199706 deleted file mode 100644 index 8ad5c7d8b1..0000000000 --- a/libical/src/test/alice/booked/199706 +++ /dev/null @@ -1,317 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :13 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -COMMENT - :DUKES forfeit the game -SEQUENCE - :2 -UID - :0981234-1234234-23@example.com -DTSTAMP - :19970613T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ATTENDEE - ;PARTSTAT=ACCEPTED - :Mailto:B@example.com -ORGANIZER - :MAILTO:A@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970612T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -COMMENT - :Sorry -COMMENT - : I cannot change this meeting time -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -DTSTAMP - :19970614T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970611T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=ACCEPTED - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970614T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -ATTENDEE - ;PARTSTAT=DECLINED - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -COMMENT - :Sorry -COMMENT - : I will be out of town at that time. -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970614T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :A@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'Mailto' -ATTENDEE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -COMMENT - :Mr. B cannot attend. It's raining. Lets cancel. -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :1 -STATUS - :CANCELLED -DTSTAMP - :19970613T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :mailto:B@example.com -COMMENT - :You're off the hook for this meeting -UID - :calsrv.example.com-873970198738777@example.com -DTSTAMP - :19970613T193000Z -SEQUENCE - :1 -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :guid-1@host1.com -SEQUENCE - :0 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=MONTHLY\;BYMONTHDAY=1\;UNTIL=19980901T210000Z' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970601T210000Z -DTEND - :19970601T220000Z -LOCATION - :Conference Call -DTSTAMP - :19970526T083000Z -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :guid-1@host1.com -SEQUENCE - :0 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=MONTHLY\;BYMONTHDAY=1' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970601T210000Z -DTEND - :19970601T220000Z -DTSTAMP - :19970602T094000Z -LOCATION - :Conference Call -STATUS - :CONFIRMED -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PROPERTY_PARSE_ERROR - :Parse error in property name: 'FOO' -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -REQUEST-STATUS - :2.8\;Repeating event ignored. Scheduled as a single event\;RRULE -REQUEST-STATUS - :3.0\;Invalid Property Name\;FOO -UID - :guid-1@host1.com -SEQUENCE - :0 -DTSTAMP - :19970603T094000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -UID - : guid-1-12345@host1.com -DTSTAMP - :19970603T094000 -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -UID - :acme-12345@host1.com -DTSTAMP - :19970603T094000 -LAST-MODIFIED - :20000209T060028Z -END:VEVENT -END:VCALENDAR diff --git a/libical/src/test/alice/booked/199707 b/libical/src/test/alice/booked/199707 deleted file mode 100644 index c52d27aa91..0000000000 --- a/libical/src/test/alice/booked/199707 +++ /dev/null @@ -1,701 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :19 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -DTSTART - :19970701T200000Z -DTSTAMP - :19970611T190000Z -SUMMARY - :ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID - :0981234-1234234-23@example.com -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -DTSTAMP - :19970612T190000Z -DTSTART - :19970701T210000Z -DTEND - :19970701T230000Z -SEQUENCE - :1 -UID - :0981234-1234234-23@example.com -SUMMARY - :ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -ATTACH - :http://www.dukes.com/ -CATEGORIES - :SPORTS EVENT -CATEGORIES - :ENTERTAINMENT -CLASS - :PRIVATE -DESCRIPTION - :MIDWAY STADIUM\nBig time game. MUST see.\nExpected duration:2 hours\n -DTEND - ;TZID=America-Chicago - :19970701T180000 -DTSTART - ;TZID=America-Chicago - :19970702T160000 -DTSTAMP - :19970614T190000Z -STATUS - :CONFIRMED -LOCATION - :http://www.midwaystadium.com/ -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter value: 'VALUE=America-Chicago' -PRIORITY - :2 -RESOURCES - :SCOREBOARD -SEQUENCE - :3 -SUMMARY - :ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID - :0981234-1234234-23@example.com -RELATED-TO - :0981234-1234234-14@example.com -LAST-MODIFIED - :20000209T060027Z -BEGIN:VALARM -TRIGGER - :PT2H -ACTION - :DISPLAY -DESCRIPTION - :You should be leaving for the game now. -END:VALARM -BEGIN:VALARM -TRIGGER - :PT30M -ACTION - :AUDIO -END:VALARM -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -DTSTAMP - :19970614T190000Z -UID - :0981234-1234234-23@example.com -DTSTART - ;VALUE=DATE - :19970714 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=YEARLY\;INTERVAL=1' -SUMMARY - : Bastille Day -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - ;CN=BIG A - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - ;CN=B - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - ;CN=C - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - ;CN=Hal - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=FALSE - :conf_Big@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=ROOM' -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - :Mailto:E@example.com -DTSTAMP - :19970611T190000Z -DTSTART - :19970701T200000Z -DTEND - :19970701T200000Z -SUMMARY - :Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - ;CN=Hal - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - ;CUTYPE=ROOM - :Mailto:Conf@example.com -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - :Mailto:E@example.com -DTSTART - :19970701T180000Z -DTEND - :19970701T190000Z -SUMMARY - :Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :1 -DTSTAMP - :19970613T190000Z -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTART - :19970701T190000Z -DTEND - :19970701T200000Z -SUMMARY - :Discuss the Merits of the election results -LOCATION - :Green Conference Room -UID - :calsrv.example.com-873970198738777a@example.com -SEQUENCE - :0 -DTSTAMP - :19970611T190000Z -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTART - :19970701T160000Z -DTEND - :19970701T190000Z -DTSTAMP - :19970612T190000Z -SUMMARY - :Discuss the Merits of the election results -LOCATION - :Green Conference Room -COMMENT - :This time works much better and I think the big conference room is - too big -UID - :calsrv.example.com-873970198738777a@example.com -SEQUENCE - :0 -DTSTAMP - :19970611T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTAMP - :19970613T190000Z -DTSTART - :19970701T160000Z -DTEND - :19970701T190000Z -SUMMARY - :Discuss the Merits of the election results - changed to meet B's schedule -LOCATION - :Green Conference Room -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :1 -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -DTSTART - :19970701T180000Z -DTEND - :19970701T200000Z -SUMMARY - :Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -STATUS - :CONFIRMED -DTSTAMP - :19970611T190000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=DECLINED - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -SUMMARY - :Phone Conference -DTSTART - :19970701T180000Z -DTEND - :19970701T200000Z -DTSTAMP - :19970614T200000Z -COMMENT - :DELEGATE (ATTENDEE Mailto:E@example.com) DECLINED YOURINVITATION -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :CR_Big@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=ROOM' -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - :Mailto:E@example.com -DTSTAMP - :19970611T190000Z -DTSTART - :19970701T200000Z -DTEND - :19970701T203000Z -SUMMARY - :Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :2 -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:B@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'STATUS=ACCEPTED' -ATTENDEE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTAMP - :19970611T190000Z -DTSTART - :19970701T200000Z -DTEND - :19970701T203000Z -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=WEEKLY' -SUMMARY - :Phone Conference -UID - :123456@example.com -SEQUENCE - :1 -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :A@example.COM -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :B@example.fr -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :c@example.jp -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTAMP - :19970613T190030Z -DTSTART - ;TZID=America-SanJose - :19970701T140000 -DTEND - ;TZID=America-SanJose - :19970701T150000 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=WEEKLY\;INTERVAL=20\;WKST=SU\;BYDAY=TU' -RDATE - ;TZID=America-SanJose - :19970910T140000 -EXDATE - ;TZID=America-SanJose - :19970909T140000 -EXDATE - ;TZID=America-SanJose - :19971028T140000 -SUMMARY - :Weekly Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :guid-1@host1com -RECURRENCE-ID - :19970701T210000Z -SEQUENCE - :1 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970703T210000Z -DTEND - :19970703T220000Z -LOCATION - :Conference Call -DTSTAMP - :19970626T093000Z -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :guid-1@host1.com -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -RECURRENCE-ID - :19970801T210000Z -SEQUENCE - :2 -STATUS - :CANCELLED -DTSTAMP - :19970721T093000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :guid-1@host1.com -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -DTSTAMP - :19970721T103000Z -STATUS - :CANCELLED -SEQUENCE - :3 -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :4 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970715T210000Z -DTEND - :19970715T220000Z -LOCATION - :Conference Call -DTSTAMP - :19970629T093000Z -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :guid-1@host1.com -RECURRENCE-ID - :19970715T210000Z -SEQUENCE - :4 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;RSVP=TRUE - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970715T220000Z -DTEND - :19970715T230000Z -LOCATION - :Conference Call -COMMENT - :May we bump this by an hour? I have a conflict -DTSTAMP - :19970629T094000Z -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -END:VCALENDAR diff --git a/libical/src/test/alice/booked/199708 b/libical/src/test/alice/booked/199708 deleted file mode 100644 index 2db95cabcf..0000000000 --- a/libical/src/test/alice/booked/199708 +++ /dev/null @@ -1,45 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :1 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VEVENT -UID - :acme-12345@host1.com -SEQUENCE - :3 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=WEEKLY' -RDATE - ;VALUE=PERIOD - :19970819T210000Z/19970081T220000Z -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -DESCRIPTION - :IETF-C&S Conference Call -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970801T210000Z -DTEND - :19970801T220000Z -RECURRENCE-ID - :19970809T210000Z -DTSTAMP - :19970726T083000 -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060028Z -END:VEVENT -END:VCALENDAR diff --git a/libical/src/test/alice/booked/199709 b/libical/src/test/alice/booked/199709 deleted file mode 100644 index 30a4471bde..0000000000 --- a/libical/src/test/alice/booked/199709 +++ /dev/null @@ -1,58 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :1 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VEVENT -UID - :guid-1@host1.com -RECURRENCE-ID - :19970901T210000Z -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'THISANDFUTURE' -SEQUENCE - :3 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Discussion -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970901T210000Z -DTEND - :19970901T220000Z -LOCATION - :Building 32 -LOCATION - : Microsoft -LOCATION - : Seattle -LOCATION - : WA -DTSTAMP - :19970526T083000Z -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -END:VCALENDAR diff --git a/libical/src/test/alice/booked/199803 b/libical/src/test/alice/booked/199803 deleted file mode 100644 index 4b673d7ccc..0000000000 --- a/libical/src/test/alice/booked/199803 +++ /dev/null @@ -1,241 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :7 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :0 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'WKST=SU\;BYDAY=TU\;FREQ=WEEKLY' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980303T210000Z -DTEND - :19980303T220000Z -LOCATION - :The White Room -DTSTAMP - :19980301T093000Z -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :7 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'WKST=SU\;BYDAY=TH\;FREQ=WEEKLY' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980303T210000Z -DTEND - :19980303T220000Z -DTSTAMP - :19980303T193000Z -LOCATION - :The Usual conference room -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :7 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'WKST=SU\;BYDAY=TU' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980303T210000Z -DTEND - :19980303T220000Z -DTSTAMP - :19980303T193000Z -LOCATION - :The White Room -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :0 -RDATE - :19980304T180000Z -RDATE - :19980311T180000Z -RDATE - :19980318T180000Z -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980304T180000Z -DTEND - :19980304T200000Z -DTSTAMP - :19980303T193000Z -LOCATION - :Conference Room A -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :1 -RECURRENCE-ID - :19980311T180000Z -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980311T160000Z -DTEND - :19980311T180000Z -DTSTAMP - :19980306T193000Z -LOCATION - :The Small conference room -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :2 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980315T180000Z -DTEND - :19980315T200000Z -DTSTAMP - :19980307T193000Z -LOCATION - :Conference Room A -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :2 -RDATE - :19980304T180000Z -RDATE - :19980311T160000Z -RDATE - :19980315T180000Z -X-LIC-ERROR - ;X-LIC-ERRORTYPE=COMPONENT_PARSE_ERROR - :Got a data line\, but could not find a property name or component - begin tag: 'Error! Bookmark not defined.' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980304T180000Z -DTEND - :19980304T200000Z -DTSTAMP - :19980303T193000Z -LOCATION - :Conference Room A -STATUS - :CONFIRMED -LAST-MODIFIED - :20000209T060027Z -END:VEVENT -END:VCALENDAR diff --git a/libical/src/test/alice/incoming.ics b/libical/src/test/alice/incoming.ics deleted file mode 100644 index c25b6b11c3..0000000000 --- a/libical/src/test/alice/incoming.ics +++ /dev/null @@ -1,2164 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :0 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VCALENDAR -METHOD - :PUBLISH -PRODID - :-//ACME/DesktopCalendar//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -DTSTART - :19970701T200000Z -DTSTAMP - :19970611T190000Z -SUMMARY - :ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID - :0981234-1234234-23@example.com -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :PUBLISH -VERSION - :2.0 -PRODID - :-//ACME/DesktopCalendar//EN -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -DTSTAMP - :19970612T190000Z -DTSTART - :19970701T210000Z -DTEND - :19970701T230000Z -SEQUENCE - :1 -UID - :0981234-1234234-23@example.com -SUMMARY - :ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :CANCEL -VERSION - :2.0 -PRODID - :-//ACME/DesktopCalendar//EN -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -COMMENT - :DUKES forfeit the game -SEQUENCE - :2 -UID - :0981234-1234234-23@example.com -DTSTAMP - :19970613T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :PUBLISH -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PROPERTY_PARSE_ERROR - :Parse error in property name: 'SCALE' -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTIMEZONE -TZID - :America-Chicago -TZURL - :http://zones.stds_r_us.net/tz/America-Chicago -BEGIN:STANDARD -DTSTART - :19671029T020000 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=YEARLY\;BYDAY=-1SU\;BYMONTH=10' -TZOFFSETFROM - :-050000 -TZOFFSETTO - :-060000 -TZNAME - :CST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART - :19870405T020000 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=YEARLY\;BYDAY=1SU\;BYMONTH=4' -TZOFFSETFROM - :-060000 -TZOFFSETTO - :-050000 -TZNAME - :CDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -ATTACH - :http://www.dukes.com/ -CATEGORIES - :SPORTS EVENT -CATEGORIES - :ENTERTAINMENT -CLASS - :PRIVATE -DESCRIPTION - :MIDWAY STADIUM\nBig time game. MUST see.\nExpected duration:2 hours\n -DTEND - ;TZID=America-Chicago - :19970701T180000 -DTSTART - ;TZID=America-Chicago - :19970702T160000 -DTSTAMP - :19970614T190000Z -STATUS - :CONFIRMED -LOCATION - :http://www.midwaystadium.com/ -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter value: 'VALUE=America-Chicago' -PRIORITY - :2 -RESOURCES - :SCOREBOARD -SEQUENCE - :3 -SUMMARY - :ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID - :0981234-1234234-23@example.com -RELATED-TO - :0981234-1234234-14@example.com -BEGIN:VALARM -TRIGGER - :PT2H -ACTION - :DISPLAY -DESCRIPTION - :You should be leaving for the game now. -END:VALARM -BEGIN:VALARM -TRIGGER - :PT30M -ACTION - :AUDIO -END:VALARM -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :PUBLISH -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :mailto:a@example.com -DTSTAMP - :19970614T190000Z -UID - :0981234-1234234-23@example.com -DTSTART - ;VALUE=DATE - :19970714 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=YEARLY\;INTERVAL=1' -SUMMARY - : Bastille Day -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - ;CN=BIG A - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - ;CN=B - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - ;CN=C - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - ;CN=Hal - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=FALSE - :conf_Big@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=ROOM' -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - :Mailto:E@example.com -DTSTAMP - :19970611T190000Z -DTSTART - :19970701T200000Z -DTEND - :19970701T200000Z -SUMMARY - :Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ATTENDEE - ;PARTSTAT=ACCEPTED - :Mailto:B@example.com -ORGANIZER - :MAILTO:A@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970612T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - ;CN=Hal - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - ;CUTYPE=ROOM - :Mailto:Conf@example.com -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - :Mailto:E@example.com -DTSTART - :19970701T180000Z -DTEND - :19970701T190000Z -SUMMARY - :Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :1 -DTSTAMP - :19970613T190000Z -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTART - :19970701T190000Z -DTEND - :19970701T200000Z -SUMMARY - :Discuss the Merits of the election results -LOCATION - :Green Conference Room -UID - :calsrv.example.com-873970198738777a@example.com -SEQUENCE - :0 -DTSTAMP - :19970611T190000Z -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :COUNTER -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTART - :19970701T160000Z -DTEND - :19970701T190000Z -DTSTAMP - :19970612T190000Z -SUMMARY - :Discuss the Merits of the election results -LOCATION - :Green Conference Room -COMMENT - :This time works much better and I think the big conference room is - too big -UID - :calsrv.example.com-873970198738777a@example.com -SEQUENCE - :0 -DTSTAMP - :19970611T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTAMP - :19970613T190000Z -DTSTART - :19970701T160000Z -DTEND - :19970701T190000Z -SUMMARY - :Discuss the Merits of the election results - changed to meet B's schedule -LOCATION - :Green Conference Room -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :1 -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :DECLINECOUNTER -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -COMMENT - :Sorry -COMMENT - : I cannot change this meeting time -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -DTSTAMP - :19970614T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970611T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -DTSTART - :19970701T180000Z -DTEND - :19970701T200000Z -SUMMARY - :Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -STATUS - :CONFIRMED -DTSTAMP - :19970611T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=ACCEPTED - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970614T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=DELEGATED - ;DELEGATED-TO="Mailto:E@example.com" - :Mailto:C@example.com -ATTENDEE - ;PARTSTAT=DECLINED - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -COMMENT - :Sorry -COMMENT - : I will be out of town at that time. -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -REQUEST-STATUS - :2.0\;Success -DTSTAMP - :19970614T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :MAILTO:A@Example.com -ATTENDEE - ;PARTSTAT=DECLINED - ;DELEGATED-FROM="Mailto:C@example.com" - :Mailto:E@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -SUMMARY - :Phone Conference -DTSTART - :19970701T180000Z -DTEND - :19970701T200000Z -DTSTAMP - :19970614T200000Z -COMMENT - :DELEGATE (ATTENDEE Mailto:E@example.com) DECLINED YOURINVITATION -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :CANCEL -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :A@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'Mailto' -ATTENDEE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -COMMENT - :Mr. B cannot attend. It's raining. Lets cancel. -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :1 -STATUS - :CANCELLED -DTSTAMP - :19970613T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :CANCEL -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :mailto:B@example.com -COMMENT - :You're off the hook for this meeting -UID - :calsrv.example.com-873970198738777@example.com -DTSTAMP - :19970613T193000Z -SEQUENCE - :1 -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :CR_Big@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=ROOM' -ATTENDEE - ;ROLE=NON-PARTICIPANT - ;RSVP=FALSE - :Mailto:E@example.com -DTSTAMP - :19970611T190000Z -DTSTART - :19970701T200000Z -DTEND - :19970701T203000Z -SUMMARY - :Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :2 -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:B@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'STATUS=ACCEPTED' -ATTENDEE - :Mailto:C@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTAMP - :19970611T190000Z -DTSTART - :19970701T200000Z -DTEND - :19970701T203000Z -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=WEEKLY' -SUMMARY - :Phone Conference -UID - :123456@example.com -SEQUENCE - :1 -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -VERSION - :2.0 -METHOD - :PUBLISH -X-LIC-SENDER - :eric@busboom.org -BEGIN:VFREEBUSY -DTSTAMP - :19980101T124100Z -ORGANIZER - :MAILTO:A@Example.com -DTSTART - :19980101T124200Z -DTEND - :19980107T124200Z -FREEBUSY - :19980101T180000Z/19980101T190000Z -FREEBUSY - :19980103T020000Z/19980103T050000Z -FREEBUSY - :19980107T020000Z/19980107T050000Z -FREEBUSY - :19980113T000000Z/19980113T010000Z -FREEBUSY - :19980115T190000Z/19980115T200000Z -FREEBUSY - :19980115T220000Z/19980115T230000Z -FREEBUSY - :19980116T013000Z/19980116T043000Z -END:VFREEBUSY -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VFREEBUSY -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -DTSTAMP - :19970613T190000Z -DTSTART - :19970701T080000Z -DTEND - :19970701T200000 -UID - :calsrv.example.com-873970198738777@example.com -END:VFREEBUSY -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VFREEBUSY -ORGANIZER - :MAILTO:A@example.com -ATTENDEE - :Mailto:B@example.com -DTSTART - :19970701T080000Z -DTEND - :19970701T200000Z -UID - :calsrv.example.com-873970198738777@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as PERIOD value in FREEBUSY property. Removing entire - property: '19970701T090000Z/PT1H' -DTSTAMP - :19970613T190030Z -END:VFREEBUSY -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTIMEZONE -TZID - :America-SanJose -TZURL - :http://zones.stds_r_us.net/tz/America-SanJose -BEGIN:STANDARD -DTSTART - :19671029T020000 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=YEARLY\;BYDAY=-1SU\;BYMONTH=10' -TZOFFSETFROM - :-070000 -TZOFFSETTO - :-080000 -TZNAME - :PST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART - :19870405T020000 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=YEARLY\;BYDAY=1SU\;BYMONTH=4' -TZOFFSETFROM - :-080000 -TZOFFSETTO - :-070000 -TZNAME - :PDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :A@example.COM -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :B@example.fr -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :c@example.jp -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTAMP - :19970613T190030Z -DTSTART - ;TZID=America-SanJose - :19970701T140000 -DTEND - ;TZID=America-SanJose - :19970701T150000 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=WEEKLY\;INTERVAL=20\;WKST=SU\;BYDAY=TU' -RDATE - ;TZID=America-SanJose - :19970910T140000 -EXDATE - ;TZID=America-SanJose - :19970909T140000 -EXDATE - ;TZID=America-SanJose - :19971028T140000 -SUMMARY - :Weekly Phone Conference -UID - :calsrv.example.com-873970198738777@example.com -SEQUENCE - :0 -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :guid-1@host1.com -SEQUENCE - :0 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=MONTHLY\;BYMONTHDAY=1\;UNTIL=19980901T210000Z' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970601T210000Z -DTEND - :19970601T220000Z -LOCATION - :Conference Call -DTSTAMP - :19970526T083000Z -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :guid-1@host1com -RECURRENCE-ID - :19970701T210000Z -SEQUENCE - :1 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970703T210000Z -DTEND - :19970703T220000Z -LOCATION - :Conference Call -DTSTAMP - :19970626T093000Z -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :CANCEL -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :guid-1@host1.com -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -RECURRENCE-ID - :19970801T210000Z -SEQUENCE - :2 -STATUS - :CANCELLED -DTSTAMP - :19970721T093000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :CANCEL -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :guid-1@host1.com -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -DTSTAMP - :19970721T103000Z -STATUS - :CANCELLED -SEQUENCE - :3 -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :guid-1@host1.com -RECURRENCE-ID - :19970901T210000Z -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'THISANDFUTURE' -SEQUENCE - :3 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Discussion -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970901T210000Z -DTEND - :19970901T220000Z -LOCATION - :Building 32 -LOCATION - : Microsoft -LOCATION - : Seattle -LOCATION - : WA -DTSTAMP - :19970526T083000Z -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :ADD -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :4 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970715T210000Z -DTEND - :19970715T220000Z -LOCATION - :Conference Call -DTSTAMP - :19970629T093000Z -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :0 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'WKST=SU\;BYDAY=TU\;FREQ=WEEKLY' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980303T210000Z -DTEND - :19980303T220000Z -LOCATION - :The White Room -DTSTAMP - :19980301T093000Z -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :ADD -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :7 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'WKST=SU\;BYDAY=TH\;FREQ=WEEKLY' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980303T210000Z -DTEND - :19980303T220000Z -DTSTAMP - :19980303T193000Z -LOCATION - :The Usual conference room -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :7 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'WKST=SU\;BYDAY=TU' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980303T210000Z -DTEND - :19980303T220000Z -DTSTAMP - :19980303T193000Z -LOCATION - :The White Room -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :0 -RDATE - :19980304T180000Z -RDATE - :19980311T180000Z -RDATE - :19980318T180000Z -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980304T180000Z -DTEND - :19980304T200000Z -DTSTAMP - :19980303T193000Z -LOCATION - :Conference Room A -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :1 -RECURRENCE-ID - :19980311T180000Z -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980311T160000Z -DTEND - :19980311T180000Z -DTSTAMP - :19980306T193000Z -LOCATION - :The Small conference room -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :ADD -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :2 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980315T180000Z -DTEND - :19980315T200000Z -DTSTAMP - :19980307T193000Z -LOCATION - :Conference Room A -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :123456789@host1.com -SEQUENCE - :2 -RDATE - :19980304T180000Z -RDATE - :19980311T160000Z -RDATE - :19980315T180000Z -X-LIC-ERROR - ;X-LIC-ERRORTYPE=COMPONENT_PARSE_ERROR - :Got a data line\, but could not find a property name or component - begin tag: 'Error! Bookmark not defined.' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -SUMMARY - :Review Accounts -DTSTART - :19980304T180000Z -DTEND - :19980304T200000Z -DTSTAMP - :19980303T193000Z -LOCATION - :Conference Room A -STATUS - :CONFIRMED -END:VEVENT -BEGIN:VEVENT -X-LIC-ERROR - ;X-LIC-ERRORTYPE=COMPONENT_PARSE_ERROR - :Got a data line\, but could not find a property name or component - begin tag: 'Error! Bookmark not defined.' -SEQUENCE - :2 -RECURRENCE-ID - :19980311T160000Z -X-LIC-ERROR - ;X-LIC-ERRORTYPE=COMPONENT_PARSE_ERROR - :Got a data line\, but could not find a property name or component - begin tag: 'Error! Bookmark not defined.' -ATTENDEE - :ROLE=CHAIR;Error! Bookmark not defined. -ATTENDEE - :Error! Bookmark not defined. -SUMMARY - :Review Accounts -DTSTART - :19980311T160000Z -DTEND - :19980304T180000Z -DTSTAMP - :19980306T193000Z -LOCATION - :The Small conference room -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :COUNTER -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :guid-1@host1.com -RECURRENCE-ID - :19970715T210000Z -SEQUENCE - :4 -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;RSVP=TRUE - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970715T220000Z -DTEND - :19970715T230000Z -LOCATION - :Conference Call -COMMENT - :May we bump this by an hour? I have a conflict -DTSTAMP - :19970629T094000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :guid-1@host1.com -SEQUENCE - :0 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=MONTHLY\;BYMONTHDAY=1' -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DESCRIPTION - :IETF-C&S Conference Call -CLASS - :PUBLIC -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970601T210000Z -DTEND - :19970601T220000Z -DTSTAMP - :19970602T094000Z -LOCATION - :Conference Call -STATUS - :CONFIRMED -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PROPERTY_PARSE_ERROR - :Parse error in property name: 'FOO' -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//RDU Software//NONSGML HandCal//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -REQUEST-STATUS - :2.8\;Repeating event ignored. Scheduled as a single event\;RRULE -REQUEST-STATUS - :3.0\;Invalid Property Name\;FOO -UID - :guid-1@host1.com -SEQUENCE - :0 -DTSTAMP - :19970603T094000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:C@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -DTSTART - :19970701T170000Z -DUE - :19970722T170000Z -PRIORITY - :1 -SUMMARY - :Create the requirements document -UID - :calsrv.example.com-873970198738777-00@example.com -SEQUENCE - :0 -DTSTAMP - :19970717T200000Z -STATUS - :Needs Action -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;PARTSTAT=ACCEPTED - :Mailto:B@example.com -UID - :calsrv.example.com-873970198738777-00@example.com -COMMENT - :I'll send you my input by e-mail -SEQUENCE - :0 -DTSTAMP - :19970717T203000Z -REQUEST-STATUS - :2.0\;Success -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -UID - :calsrv.example.com-873970198738777-00@example.com -SUMMARY - :Create the requirements document -PRIORITY - :1 -SEQUENCE - :0 -STATUS - :IN-PROCESS -DTSTART - :19970701T170000Z -DTSTAMP - :19970717T230000Z -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ORGANIZER - :MAILTO:A@example.com -ATTENDEE - ;PARTSTAT=IN-PROCESS - :Mailto:B@example.com -PERCENT-COMPLETE - :75 -UID - :calsrv.example.com-873970198738777-00@example.com -DTSTAMP - :19970717T233000Z -SEQUENCE - :0 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ORGANIZER - :MAILTO:A@example.com -ATTENDEE - ;PARTSTAT=COMPLETED - :Mailto:D@example.com -UID - :calsrv.example.com-873970198738777-00@example.com -DTSTAMP - :19970717T233000Z -SEQUENCE - :0 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - ;PARTSTAT=ACCEPTED - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;PARTSTAT=IN-PROCESS - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -DTSTART - :19970701T170000Z -DUE - :19970722T170000Z -PRIORITY - :1 -SUMMARY - :Create the requirements document -UID - :calsrv.example.com-873970198738777-00@example.com -SEQUENCE - :1 -DTSTAMP - :19970718T100000Z -STATUS - :IN-PROGRESS -PERCENT-COMPLETE - :40 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REQUEST -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - :Mailto:A@example.com -ATTENDEE - ;RSVP=TRUE - :Mailto:B@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -ATTENDEE - ;RSVP=TRUE - :Mailto:D@example.com -X-LIC-ERROR - ;X-LIC-ERRORTYPE=PARAMETER_PARSE_ERROR - :Can't parse parameter name: 'TYPE=INDIVIDUAL' -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=MONTHLY\;COUNT=10\;BYDAY=1FR' -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as DATE-TIME value in DTSTART property. Removing entire - property: '19980101T100000-0700' -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as DATE-TIME value in DUE property. Removing entire property: - '19980103T100000-0700' -SUMMARY - :Send Status Reports to Area Managers -UID - :calsrv.example.com-873970198738777-00@example.com -SEQUENCE - :0 -DTSTAMP - :19970717T200000Z -STATUS - :NEEDS ACTION -PRIORITY - :1 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//ACME/DesktopCalendar//EN -METHOD - :REPLY -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VTODO -ATTENDEE - ;PARTSTAT=IN-PROCESS - :Mailto:B@example.com -PERCENT-COMPLETE - :75 -UID - :calsrv.example.com-873970198738777-00@example.com -DTSTAMP - :19970717T233000Z -RECURRENCE-ID - :19980101T170000Z -SEQUENCE - :1 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :PUBLISH -PRODID - :-//ACME/DesktopCalendar//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VJOURNAL -DTSTART - :19971002T200000Z -ORGANIZER - :MAILTO:A@Example.com -SUMMARY - :Phone conference minutes -DESCRIPTION - :The editors meeting was held on October 1 -DESCRIPTION - : 1997. Details are in the attached document. -UID - :0981234-1234234-2410@example.com -RELATED-TO - :0981234-1234234-2402-35@example.com -ATTACH - :ftp://ftp.example.com/pub/ed/minutes100197.txt -END:VJOURNAL -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//RDU Software//NONSGML HandCal//EN -METHOD - :REFRESH -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -ATTENDEE - :Mailto:C@example.com -ATTENDEE - :Mailto:D@example.com -UID - : guid-1-12345@host1.com -DTSTAMP - :19970603T094000 -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD - :REQUEST -PRODID - :-//RDU Software//NONSGML HandCal//EN -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -UID - :acme-12345@host1.com -SEQUENCE - :3 -X-LIC-ERROR - ;X-LIC-ERRORTYPE=VALUE_PARSE_ERROR - :Can't parse as RECUR value in RRULE property. Removing entire property: - 'FREQ=WEEKLY' -RDATE - ;VALUE=PERIOD - :19970819T210000Z/19970081T220000Z -ORGANIZER - :Mailto:A@example.com -ATTENDEE - ;ROLE=CHAIR - ;PARTSTAT=ACCEPTED - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -DESCRIPTION - :IETF-C&S Conference Call -SUMMARY - :IETF Calendaring Working Group Meeting -DTSTART - :19970801T210000Z -DTEND - :19970801T220000Z -RECURRENCE-ID - :19970809T210000Z -DTSTAMP - :19970726T083000 -STATUS - :CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID - :-//RDU Software//NONSGML HandCal//EN -METHOD - :REFRESH -VERSION - :2.0 -X-LIC-SENDER - :eric@busboom.org -BEGIN:VEVENT -ORGANIZER - :Mailto:A@example.com -ATTENDEE - :Mailto:B@example.com -UID - :acme-12345@host1.com -DTSTAMP - :19970603T094000 -END:VEVENT -END:VCALENDAR -END:VCALENDAR diff --git a/libical/src/test/copycluster.c b/libical/src/test/copycluster.c deleted file mode 100644 index b059130c13..0000000000 --- a/libical/src/test/copycluster.c +++ /dev/null @@ -1,113 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: copycluster.c - CREATOR: eric 15 January 2000 - - $Id$ - $Locker$ - - (C) COPYRIGHT 2000 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - - ======================================================================*/ - -#include /* for printf */ -#include "ical.h" -#include "icalcluster.h" -#include -#include /* For strerror */ -#include "icalrestriction.h" - -/* This program copies a file that holds iCal components to an other file. */ - - -void usage(char* arg0) { - printf("usage: %s cluster-file1 cluster-file2\n",arg0); -} - -int main(int c, char *argv[]){ - - icalcluster *clusterin, *clusterout; - icalcomponent *itr; - int count=0; - int tostdout = 0; - - if(c < 2 || c > 3){ - usage(argv[0]); - exit(1); - } - - if (c == 2){ - tostdout = 1; - } - - clusterin = icalcluster_new(argv[1]); - - if (clusterin == 0){ - printf("Could not open input cluster \"%s\"",argv[1]); - - exit(1); - } - - if (!tostdout){ - clusterout = icalcluster_new(argv[2]); - if (clusterout == 0){ - printf("Could not open output cluster \"%s\"\n",argv[2]); - exit(1); - } - } - - - for (itr = icalcluster_get_first_component(clusterin, - ICAL_ANY_COMPONENT); - itr != 0; - itr = icalcluster_get_next_component(clusterin, - ICAL_ANY_COMPONENT)){ - - icalrestriction_check(itr); - - if (itr != 0){ - - if(tostdout){ - - printf("--------------\n%s\n",icalcomponent_as_ical_string(itr)); - } else { - - icalcluster_add_component(clusterout, - icalcomponent_new_clone(itr)); - } - - count++; - - } else { - printf("Got NULL component"); - } - } - - - printf("Transfered %d components\n",count); - - icalcluster_free(clusterin); - - if (!tostdout){ - icalcluster_mark(clusterout); - icalcluster_free(clusterout); - } - - return 0; -} - diff --git a/libical/src/test/findobj.c b/libical/src/test/findobj.c deleted file mode 100644 index e7ec59169a..0000000000 --- a/libical/src/test/findobj.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: findobj.c - CREATOR: eric 11 February 2000 - - $Id$ - $Locker$ - - (C) COPYRIGHT 2000 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The Original Code is eric. The Initial Developer of the Original - Code is Eric Busboom - - - ======================================================================*/ - -#include /* for printf */ -#include "ical.h" -#include "icalcalendar.h" -#include -#include /* For strerror */ -#include "icalrestriction.h" - -/* This program finds an object stored in a calendar */ - -void usage(char* arg0) { - printf("usage: %s calendar-dir uid\n",arg0); -} - -int main(int c, char *argv[]){ - - icalcalendar *cal; - icalstore *booked; - icalcomponent *itr; - - if(c < 2 || c > 3){ - usage(argv[0]); - exit(1); - } - - cal = icalcalendar_new(argv[1]); - - if(cal == 0){ - fprintf(stderr,"%s: error in opening calendar \"%s\": %s. errno is \"%s\"\n", - argv[0],argv[1],icalerror_strerror(icalerrno), - strerror(errno)); - } - - booked = icalcalendar_get_booked(cal); - - itr = icalstore_fetch(booked,argv[2]); - - - if(itr != 0){ - printf("%s",icalcomponent_as_ical_string(itr)); - } - - return 0; -} - diff --git a/libical/src/test/icaltestparser.c b/libical/src/test/icaltestparser.c deleted file mode 100644 index d56af49258..0000000000 --- a/libical/src/test/icaltestparser.c +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: icaltestparser.c - CREATOR: eric 20 June 1999 - - $Id$ - $Locker$ - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is icaltestparser.c - - - (C) COPYRIGHT 1999 The Software Studio. - http://www.softwarestudio.org - - ======================================================================*/ - -#include -#include -#include -#include -#include "ical.h" - -#include - -char str[] = "BEGIN:VCALENDAR -PRODID:\"-//RDU Software//NONSGML HandCal//EN\" -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:US-Eastern -BEGIN:STANDARD -DTSTART:19990404T020000 -RDATE:19990u404xT020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19990404T020000 -RDATE:19990404T020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -Dkjhgri:derhvnv; -BEGIN:dfkjh -END:dfdfkjh -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -GEO:Bongo -DTSTAMP:19980309T231000Z -UID:guid-1.host1.com -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP - :MAILTO:employee-A@host.com -DESCRIPTION:Project XYZ Review Meeting -CATEGORIES:MEETING -CLASS:PUBLIC -CREATED:19980309T130000Z -SUMMARY:XYZ Project Review -DTSTART;TZID=US-Eastern:19980312T083000 -DTEND;TZID=US-Eastern:19980312T093000 -LOCATION:1CP Conference Room 4350 -END:VEVENT -END:VCALENDAR -"; - -extern int yydebug; - -/* Have the parser fetch data from stdin */ - -char* read_stdin(char *s, size_t size, void *d) -{ - char *c = fgets(s,size, stdin); - - return c; - -} - -int main() -{ - - /* This is how we would have the parser parse a string */ - /* icalcomponent *c = icalparser_parse_string(str);*/ - - icalcomponent *c = icalparser_parse(read_stdin); - - printf("%s\n",icalcomponent_as_ical_string(c)); - - /* Strip errors and spit it out again - printf("\n%d Errors in Component\n",icalcomponent_count_errors(c)); - icalcomponent_strip_errors(c); - printf("%s\n",icalcomponent_as_ical_string(c)); - */ - - icalmemory_free_ring(); - icalcomponent_free(c); - - return 1; -} - diff --git a/libical/src/test/regression.c b/libical/src/test/regression.c deleted file mode 100644 index a969022d98..0000000000 --- a/libical/src/test/regression.c +++ /dev/null @@ -1,1340 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: usecases.c - CREATOR: eric 03 April 1999 - - DESCRIPTION: - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is usecases.c - - - ======================================================================*/ - -#include "ical.h" -#include -#include /* for strdup */ -#include /* for malloc */ -#include /* for printf */ -#include /* for time() */ -#include "icalmemory.h" -#include "icalstore.h" -#include "icalcluster.h" -#include "icalerror.h" -#include "icalrestriction.h" -#include "icalcalendar.h" - -/* This example creates and minipulates the ical object that appears - * in rfc 2445, page 137 */ - -/* - BEGIN:VCALENDAR - PRODID:-//RDU Software//NONSGML HandCal//EN - VERSION:2.0 - BEGIN:VTIMEZONE - TZID:US-Eastern - BEGIN:STANDARD - DTSTART:19981025T020000 - RDATE:19981025T020000 - TZOFFSETFROM:-0400 - TZOFFSETTO:-0500 - TZNAME:EST - END:STANDARD - BEGIN:DAYLIGHT - DTSTART:19990404T020000 - RDATE:19990404T020000 - TZOFFSETFROM:-0500 - TZOFFSETTO:-0400 - TZNAME:EDT - END:DAYLIGHT - END:VTIMEZONE - BEGIN:VEVENT - DTSTAMP:19980309T231000Z - UID:guid-1.host1.com - ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com - ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP: - MAILTO:employee-A@host.com - DESCRIPTION:Project XYZ Review Meeting - CATEGORIES:MEETING - CLASS:PUBLIC - CREATED:19980309T130000Z - SUMMARY:XYZ Project Review - DTSTART;TZID=US-Eastern:19980312T083000 - DTEND;TZID=US-Eastern:19980312T093000 - LOCATION:1CP Conference Room 4350 - END:VEVENT - END:VCALENDAR - -*/ -char str[] = "BEGIN:VCALENDAR -PRODID:\"-//RDU Software//NONSGML HandCal//EN\" -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:US-Eastern -BEGIN:STANDARD -DTSTART:19981025T020000 -RDATE:19981025T020000 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19990404T020000 -RDATE:19990404T020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -DTSTAMP:19980309T231000Z -UID:guid-1.host1.com -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:employee-A@host.com -DESCRIPTION:Project XYZ Review Meeting -CATEGORIES:MEETING -CLASS:PUBLIC -CREATED:19980309T130000Z -SUMMARY:XYZ Project Review -DTSTART;TZID=US-Eastern:19980312T083000 -DTEND;TZID=US-Eastern:19980312T093000 -LOCATION:1CP Conference Room 4350 -END:VEVENT -BEGIN:BOOGA -DTSTAMP:19980309T231000Z -X-LIC-FOO:Booga -DTSTOMP:19980309T231000Z -UID:guid-1.host1.com -END:BOOGA -END:VCALENDAR"; - -void _test_string_line_generator(char* str); - -void test_string_line_generator() { - - _test_string_line_generator(str); - -} - -icalcomponent* create_simple_component() -{ - - icalcomponent* calendar; - struct icalperiodtype rtime; - - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); - - rtime.end.hour++; - - - - /* Create calendar and add properties */ - calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); - - - icalcomponent_add_property( - calendar, - icalproperty_new_version("2.0") - ); - - printf("%s\n",icalcomponent_as_ical_string(calendar)); - - return calendar; - -} - -/* Create a new component */ -icalcomponent* create_new_component() -{ - - icalcomponent* calendar; - icalcomponent* timezone; - icalcomponent* tzc; - icalcomponent* event; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); - struct icalperiodtype rtime; - icalproperty* property; - - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); - - rtime.end.hour++; - - - - /* Create calendar and add properties */ - calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); - - - icalcomponent_add_property( - calendar, - icalproperty_new_version("2.0") - ); - - icalcomponent_add_property( - calendar, - icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN") - ); - - /* Create a timezone object and add it to the calendar */ - - timezone = icalcomponent_new(ICAL_VTIMEZONE_COMPONENT); - - icalcomponent_add_property( - timezone, - icalproperty_new_tzid("US_Eastern") - ); - - /* Add a sub-component of the timezone */ - tzc = icalcomponent_new(ICAL_XDAYLIGHT_COMPONENT); - - icalcomponent_add_property( - tzc, - icalproperty_new_dtstart(atime) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_rdate(rtime) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_tzoffsetfrom(-4.0) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_tzoffsetto(-5.0) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_tzname("EST") - ); - - icalcomponent_add_component(timezone,tzc); - - icalcomponent_add_component(calendar,timezone); - - /* Add a second subcomponent */ - tzc = icalcomponent_new(ICAL_XSTANDARD_COMPONENT); - - icalcomponent_add_property( - tzc, - icalproperty_new_dtstart(atime) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_rdate(rtime) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_tzoffsetfrom(-4.0) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_tzoffsetto(-5.0) - ); - - icalcomponent_add_property( - tzc, - icalproperty_new_tzname("EST") - ); - - icalcomponent_add_component(timezone,tzc); - - /* Add an event */ - - event = icalcomponent_new(ICAL_VEVENT_COMPONENT); - - icalcomponent_add_property( - event, - icalproperty_new_dtstamp(atime) - ); - - icalcomponent_add_property( - event, - icalproperty_new_uid("guid-1.host1.com") - ); - - /* add a property that has parameters */ - property = icalproperty_new_organizer("mrbig@host.com"); - - icalproperty_add_parameter( - property, - icalparameter_new_role(ICAL_ROLE_CHAIR) - ); - - icalcomponent_add_property(event,property); - - /* add another property that has parameters */ - property = icalproperty_new_attendee("employee-A@host.com"); - - icalproperty_add_parameter( - property, - icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT) - ); - - icalproperty_add_parameter( - property, - icalparameter_new_rsvp(1) - ); - - icalproperty_add_parameter( - property, - icalparameter_new_cutype(ICAL_CUTYPE_GROUP) - ); - - icalcomponent_add_property(event,property); - - - /* more properties */ - - icalcomponent_add_property( - event, - icalproperty_new_description("Project XYZ Review Meeting") - ); - - icalcomponent_add_property( - event, - icalproperty_new_categories("MEETING") - ); - - icalcomponent_add_property( - event, - icalproperty_new_class("PUBLIC") - ); - - icalcomponent_add_property( - event, - icalproperty_new_created(atime) - ); - - icalcomponent_add_property( - event, - icalproperty_new_summary("XYZ Project Review") - ); - - - property = icalproperty_new_dtstart(atime); - - icalproperty_add_parameter( - property, - icalparameter_new_tzid("US-Eastern") - ); - - icalcomponent_add_property(event,property); - - - property = icalproperty_new_dtend(atime); - - icalproperty_add_parameter( - property, - icalparameter_new_tzid("US-Eastern") - ); - - icalcomponent_add_property(event,property); - - icalcomponent_add_property( - event, - icalproperty_new_location("1CP Conference Room 4350") - ); - - icalcomponent_add_component(calendar,event); - - printf("%s\n",icalcomponent_as_ical_string(calendar)); - - icalcomponent_free(calendar); - - return 0; -} - - -/* Create a new component, using the va_args list */ - -icalcomponent* create_new_component_with_va_args() -{ - - icalcomponent* calendar; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); - struct icalperiodtype rtime; - - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); - - rtime.end.hour++; - - calendar = - icalcomponent_vanew( - ICAL_VCALENDAR_COMPONENT, - icalproperty_new_version("2.0"), - icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN"), - icalcomponent_vanew( - ICAL_VTIMEZONE_COMPONENT, - icalproperty_new_tzid("US_Eastern"), - icalcomponent_vanew( - ICAL_XDAYLIGHT_COMPONENT, - icalproperty_new_dtstart(atime), - icalproperty_new_rdate(rtime), - icalproperty_new_tzoffsetfrom(-4.0), - icalproperty_new_tzoffsetto(-5.0), - icalproperty_new_tzname("EST"), - 0 - ), - icalcomponent_vanew( - ICAL_XSTANDARD_COMPONENT, - icalproperty_new_dtstart(atime), - icalproperty_new_rdate(rtime), - icalproperty_new_tzoffsetfrom(-5.0), - icalproperty_new_tzoffsetto(-4.0), - icalproperty_new_tzname("EST"), - 0 - ), - 0 - ), - icalcomponent_vanew( - ICAL_VEVENT_COMPONENT, - icalproperty_new_dtstamp(atime), - icalproperty_new_uid("guid-1.host1.com"), - icalproperty_vanew_organizer( - "mrbig@host.com", - icalparameter_new_role(ICAL_ROLE_CHAIR), - 0 - ), - icalproperty_vanew_attendee( - "employee-A@host.com", - icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT), - icalparameter_new_rsvp(1), - icalparameter_new_cutype(ICAL_CUTYPE_GROUP), - 0 - ), - icalproperty_new_description("Project XYZ Review Meeting"), - icalproperty_new_categories("MEETING"), - icalproperty_new_class("PUBLIC"), - icalproperty_new_created(atime), - icalproperty_new_summary("XYZ Project Review"), - icalproperty_vanew_dtstart( - atime, - icalparameter_new_tzid("US-Eastern"), - 0 - ), - icalproperty_vanew_dtend( - atime, - icalparameter_new_tzid("US-Eastern"), - 0 - ), - icalproperty_new_location("1CP Conference Room 4350"), - 0 - ), - 0 - ); - - printf("%s\n",icalcomponent_as_ical_string(calendar)); - - - icalcomponent_free(calendar); - - return 0; -} - - -/* Return a list of all attendees who are required. */ - -char** get_required_attendees(icalproperty* event) -{ - icalproperty* p; - icalparameter* parameter; - - char **attendees; - int max = 10; - int c = 0; - - attendees = malloc(max * (sizeof (char *))); - - assert(event != 0); - assert(icalcomponent_isa(event) == ICAL_VEVENT_COMPONENT); - - for( - p = icalcomponent_get_first_property(event,ICAL_ATTENDEE_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(event,ICAL_ATTENDEE_PROPERTY) - ) { - - parameter = icalproperty_get_first_parameter(p,ICAL_ROLE_PARAMETER); - - if ( icalparameter_get_role(parameter) == ICAL_ROLE_REQPARTICIPANT) - { - attendees[c++] = strdup(icalproperty_get_attendee(p)); - - if (c >= max) { - max *= 2; - attendees = realloc(attendees, max * (sizeof (char *))); - } - - } - } - - return attendees; -} - -/* If an attendee has a PARTSTAT of NEEDSACTION or has no PARTSTAT - parameter, change it to TENTATIVE. */ - -void update_attendees(icalproperty* event) -{ - icalproperty* p; - icalparameter* parameter; - - - assert(event != 0); - assert(icalcomponent_isa(event) == ICAL_VEVENT_COMPONENT); - - for( - p = icalcomponent_get_first_property(event,ICAL_ATTENDEE_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(event,ICAL_ATTENDEE_PROPERTY) - ) { - - parameter = icalproperty_get_first_parameter(p,ICAL_PARTSTAT_PARAMETER); - - if (parameter == 0) { - - icalproperty_add_parameter( - p, - icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE) - ); - - } else if (icalparameter_get_partstat(parameter) == ICAL_PARTSTAT_NEEDSACTION) { - - icalproperty_remove_parameter(p,ICAL_PARTSTAT_PARAMETER); - - icalparameter_free(parameter); - - icalproperty_add_parameter( - p, - icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE) - ); - } - - } -} - - -void test_values() -{ - icalvalue *v; - icalvalue *copy; - - v = icalvalue_new_caladdress("cap://value/1"); - printf("caladdress 1: %s\n",icalvalue_get_caladdress(v)); - icalvalue_set_caladdress(v,"cap://value/2"); - printf("caladdress 2: %s\n",icalvalue_get_caladdress(v)); - printf("String: %s\n",icalvalue_as_ical_string(v)); - - copy = icalvalue_new_clone(v); - printf("Clone: %s\n",icalvalue_as_ical_string(v)); - icalvalue_free(v); - icalvalue_free(copy); - - - v = icalvalue_new_boolean(1); - printf("caladdress 1: %d\n",icalvalue_get_boolean(v)); - icalvalue_set_boolean(v,2); - printf("caladdress 2: %d\n",icalvalue_get_boolean(v)); - printf("String: %s\n",icalvalue_as_ical_string(v)); - - copy = icalvalue_new_clone(v); - printf("Clone: %s\n",icalvalue_as_ical_string(v)); - icalvalue_free(v); - icalvalue_free(copy); - - - v = icalvalue_new_date(icaltimetype_from_timet( time(0),0)); - printf("date 1: %s\n",icalvalue_as_ical_string(v)); - icalvalue_set_date(v,icaltimetype_from_timet( time(0)+3600,0)); - printf("date 2: %s\n",icalvalue_as_ical_string(v)); - - copy = icalvalue_new_clone(v); - printf("Clone: %s\n",icalvalue_as_ical_string(v)); - icalvalue_free(v); - icalvalue_free(copy); - - - v = icalvalue_new(-1); - - printf("Invalid type: %p\n",v); - - if (v!=0) icalvalue_free(v); - - - /* v = icalvalue_new_caladdress(0); - - printf("Bad string: %p\n",v); - - if (v!=0) icalvalue_free(v); */ - -} - -void test_properties() -{ - icalproperty *prop; - icalparameter *param; - - icalproperty *clone; - - prop = icalproperty_vanew_comment( - "Another Comment", - icalparameter_new_cn("A Common Name 1"), - icalparameter_new_cn("A Common Name 2"), - icalparameter_new_cn("A Common Name 3"), - icalparameter_new_cn("A Common Name 4"), - 0); - - for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PROPERTY); - param != 0; - param = icalproperty_get_next_parameter(prop,ICAL_ANY_PROPERTY)) { - - printf("Prop parameter: %s\n",icalparameter_get_cn(param)); - } - - printf("Prop value: %s\n",icalproperty_get_comment(prop)); - - - printf("As iCAL string:\n %s\n",icalproperty_as_ical_string(prop)); - - clone = icalproperty_new_clone(prop); - - printf("Clone:\n %s\n",icalproperty_as_ical_string(prop)); - - icalproperty_free(clone); - icalproperty_free(prop); - - prop = icalproperty_new(-1); - - printf("Invalid type: %p\n",prop); - - if (prop!=0) icalproperty_free(prop); - - /* - prop = icalproperty_new_method(0); - - printf("Bad string: %p\n",prop); - - - if (prop!=0) icalproperty_free(prop); - */ -} - -void test_parameters() -{ - icalparameter *p; - - p = icalparameter_new_cn("A Common Name"); - - printf("Common Name: %s\n",icalparameter_get_cn(p)); - - printf("As String: %s\n",icalparameter_as_ical_string(p)); - - icalparameter_free(p); -} - - -void test_components() -{ - - icalcomponent* c; - icalcomponent* child; - - c = icalcomponent_vanew( - ICAL_VCALENDAR_COMPONENT, - icalproperty_new_version("2.0"), - icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN"), - icalproperty_vanew_comment( - "A Comment", - icalparameter_new_cn("A Common Name 1"), - 0), - icalcomponent_vanew( - ICAL_VEVENT_COMPONENT, - icalproperty_new_version("2.0"), - icalproperty_new_description("This is an event"), - icalproperty_vanew_comment( - "Another Comment", - icalparameter_new_cn("A Common Name 1"), - icalparameter_new_cn("A Common Name 2"), - icalparameter_new_cn("A Common Name 3"), - icalparameter_new_cn("A Common Name 4"), - 0), - icalproperty_vanew_xlicerror( - "This is only a test", - icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_COMPONENTPARSEERROR), - 0), - - 0 - ), - 0 - ); - - printf("Original Component:\n%s\n\n",icalcomponent_as_ical_string(c)); - - child = icalcomponent_get_first_component(c,ICAL_VEVENT_COMPONENT); - - printf("Child Component:\n%s\n\n",icalcomponent_as_ical_string(child)); - - icalcomponent_free(c); - -} - -void test_memory() -{ - size_t bufsize = 256; - char *p; - - char S1[] = "1) When in the Course of human events, "; - char S2[] = "2) it becomes necessary for one people to dissolve the political bands which have connected them with another, "; - char S3[] = "3) and to assume among the powers of the earth, "; - char S4[] = "4) the separate and equal station to which the Laws of Nature and of Nature's God entitle them, "; - char S5[] = "5) a decent respect to the opinions of mankind requires that they "; - char S6[] = "6) should declare the causes which impel them to the separation. "; - char S7[] = "7) We hold these truths to be self-evident, "; - char S8[] = "8) that all men are created equal, "; - -/* char S9[] = "9) that they are endowed by their Creator with certain unalienable Rights, "; - char S10[] = "10) that among these are Life, Liberty, and the pursuit of Happiness. "; - char S11[] = "11) That to secure these rights, Governments are instituted among Men, "; - char S12[] = "12) deriving their just powers from the consent of the governed. "; -*/ - - - char *f, *b1, *b2, *b3, *b4, *b5, *b6, *b7, *b8; - - #define BUFSIZE 1024 - - - f = icalmemory_new_buffer(bufsize); - p = f; - b1 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b1, S1); - icalmemory_append_string(&f, &p, &bufsize, b1); - - b2 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b2, S2); - icalmemory_append_string(&f, &p, &bufsize, b2); - - b3 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b3, S3); - icalmemory_append_string(&f, &p, &bufsize, b3); - - b4 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b4, S4); - icalmemory_append_string(&f, &p, &bufsize, b4); - - b5 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b5, S5); - icalmemory_append_string(&f, &p, &bufsize, b5); - - b6 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b6, S6); - icalmemory_append_string(&f, &p, &bufsize, b6); - - b7 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b7, S7); - icalmemory_append_string(&f, &p, &bufsize, b7); - - b8 = icalmemory_tmp_buffer(BUFSIZE); - strcpy(b8, S8); - icalmemory_append_string(&f, &p, &bufsize, b8); - - - printf("1: %p %s \n",b1,b1); - printf("2: %p %s\n",b2,b2); - printf("3: %p %s\n",b3,b3); - printf("4: %p %s\n",b4,b4); - printf("5: %p %s\n",b5,b5); - printf("6: %p %s\n",b6,b6); - printf("7: %p %s\n",b7,b7); - printf("8: %p %s\n",b8,b8); - - - printf("Final: %s\n", f); - - printf("Final buffer size: %d\n",bufsize); - - free(f); - - bufsize = 4; - f = icalmemory_new_buffer(bufsize); - p = f; - - icalmemory_append_char(&f, &p, &bufsize, 'a'); - icalmemory_append_char(&f, &p, &bufsize, 'b'); - icalmemory_append_char(&f, &p, &bufsize, 'c'); - icalmemory_append_char(&f, &p, &bufsize, 'd'); - icalmemory_append_char(&f, &p, &bufsize, 'e'); - icalmemory_append_char(&f, &p, &bufsize, 'f'); - icalmemory_append_char(&f, &p, &bufsize, 'g'); - icalmemory_append_char(&f, &p, &bufsize, 'h'); - icalmemory_append_char(&f, &p, &bufsize, 'i'); - icalmemory_append_char(&f, &p, &bufsize, 'j'); - icalmemory_append_char(&f, &p, &bufsize, 'a'); - icalmemory_append_char(&f, &p, &bufsize, 'b'); - icalmemory_append_char(&f, &p, &bufsize, 'c'); - icalmemory_append_char(&f, &p, &bufsize, 'd'); - icalmemory_append_char(&f, &p, &bufsize, 'e'); - icalmemory_append_char(&f, &p, &bufsize, 'f'); - icalmemory_append_char(&f, &p, &bufsize, 'g'); - icalmemory_append_char(&f, &p, &bufsize, 'h'); - icalmemory_append_char(&f, &p, &bufsize, 'i'); - icalmemory_append_char(&f, &p, &bufsize, 'j'); - - printf("Char-by-Char buffer: %s\n", f); - -} - -int test_parser() -{ - - - icalcomponent *c = icalparser_parse_string(str); - printf("%s\n",icalcomponent_as_ical_string(c)); - icalcomponent_free(c); - icalmemory_free_ring(); - return 1; -} - - -int test_store() -{ - - icalcomponent *c, *gauge; - icalerrorenum error; - icalcomponent *next, *itr; - icalcluster* cluster; - struct icalperiodtype rtime; - icalstore *s = icalstore_new("store"); - int i; - - rtime.start = icaltimetype_from_timet( time(0),0); - - cluster = icalcluster_new("clusterin.vcd"); - - if (cluster == 0){ - printf("Failed to create cluster: %s\n",icalerror_strerror(icalerrno)); - return 0; - } - -#define NUMCOMP 4 - - /* Duplicate every component in the cluster NUMCOMP times */ - - icalerror_clear_errno(); - - for (i = 1; i 5 */ - - assert(icalrestriction_get_property_restriction( - ICAL_METHOD_PUBLISH, - ICAL_VEVENT_COMPONENT, - ICAL_ATTACH_PROPERTY)==3); /* ZEROPLUS -> 3 */ - - assert(icalrestriction_get_property_restriction( - ICAL_METHOD_DECLINECOUNTER, - ICAL_VEVENT_COMPONENT, - ICAL_SEQUENCE_PROPERTY)==1); /* ZERO -> 1 */ - - /* Component restrictions */ - assert(icalrestriction_get_component_restriction( - ICAL_METHOD_PUBLISH, - ICAL_VJOURNAL_COMPONENT, - ICAL_X_COMPONENT) == 3); /* ZEROPLUS */ - - assert(icalrestriction_get_component_restriction( - ICAL_METHOD_CANCEL, - ICAL_VJOURNAL_COMPONENT, - ICAL_VEVENT_COMPONENT) == 1); /* ZERO */ - - comp = - icalcomponent_vanew( - ICAL_VCALENDAR_COMPONENT, - icalproperty_new_version("2.0"), - icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN"), - icalproperty_new_method(ICAL_METHOD_CANCEL), - icalcomponent_vanew( - ICAL_VTIMEZONE_COMPONENT, - icalproperty_new_tzid("US_Eastern"), - icalcomponent_vanew( - ICAL_XDAYLIGHT_COMPONENT, - icalproperty_new_dtstart(atime), - icalproperty_new_rdate(rtime), - icalproperty_new_tzoffsetfrom(-4.0), - icalproperty_new_tzoffsetto(-5.0), - icalproperty_new_tzname("EST"), - 0 - ), - icalcomponent_vanew( - ICAL_XSTANDARD_COMPONENT, - icalproperty_new_dtstart(atime), - icalproperty_new_rdate(rtime), - icalproperty_new_tzoffsetfrom(-5.0), - icalproperty_new_tzoffsetto(-4.0), - icalproperty_new_tzname("EST"), - 0 - ), - 0 - ), - icalcomponent_vanew( - ICAL_VEVENT_COMPONENT, - icalproperty_new_dtstamp(atime), - icalproperty_new_uid("guid-1.host1.com"), - icalproperty_vanew_organizer( - "mrbig@host.com", - icalparameter_new_role(ICAL_ROLE_CHAIR), - 0 - ), - icalproperty_vanew_attendee( - "employee-A@host.com", - icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT), - icalparameter_new_rsvp(1), - icalparameter_new_cutype(ICAL_CUTYPE_GROUP), - 0 - ), - icalproperty_new_description("Project XYZ Review Meeting"), - icalproperty_new_categories("MEETING"), - icalproperty_new_class("PUBLIC"), - icalproperty_new_created(atime), - icalproperty_new_summary("XYZ Project Review"), - icalproperty_vanew_dtstart( - atime, - icalparameter_new_tzid("US-Eastern"), - 0 - ), - icalproperty_vanew_dtend( - atime, - icalparameter_new_tzid("US-Eastern"), - 0 - ), - icalproperty_new_location("1CP Conference Room 4350"), - 0 - ), - 0 - ); - - valid = icalrestriction_check(comp); - - printf("#### %d ####\n%s\n",valid, icalcomponent_as_ical_string(comp)); - -} - -void test_calendar() -{ - icalcomponent *comp; - icalcluster *c; - icalstore *s; - icalcalendar* calendar = icalcalendar_new("calendar"); - icalerrorenum error; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); - - comp = icalcomponent_vanew( - ICAL_VEVENT_COMPONENT, - icalproperty_new_version("2.0"), - icalproperty_new_description("This is an event"), - icalproperty_new_dtstart(atime), - icalproperty_vanew_comment( - "Another Comment", - icalparameter_new_cn("A Common Name 1"), - icalparameter_new_cn("A Common Name 2"), - icalparameter_new_cn("A Common Name 3"), - icalparameter_new_cn("A Common Name 4"), - 0), - icalproperty_vanew_xlicerror( - "This is only a test", - icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_COMPONENTPARSEERROR), - 0), - - 0); - - - s = icalcalendar_get_booked(calendar); - - error = icalstore_add_component(s,comp); - - assert(error == ICAL_NO_ERROR); - - c = icalcalendar_get_properties(calendar); - - error = icalcluster_add_component(c,icalcomponent_new_clone(comp)); - - assert(error == ICAL_NO_ERROR); - - icalcalendar_free(calendar); - -} - -void test_recur() -{ - icalvalue *v; - - v = icalvalue_new_from_string(ICAL_RECUR_VALUE, - "FREQ=DAILY;COUNT=5;BYDAY=MO,TU,WE,TH,FR"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - v = icalvalue_new_from_string(ICAL_RECUR_VALUE, - "FREQ=YEARLY;UNTIL=123456T123456;BYSETPOS=-1,2"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - v = icalvalue_new_from_string(ICAL_RECUR_VALUE, - "FREQ=YEARLY;UNTIL=123456T123456;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;BYMINUTE=30"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - v = icalvalue_new_from_string(ICAL_RECUR_VALUE, - "FREQ=MONTHLY;BYDAY=-1MO,TU,WE,TH,FR"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - v = icalvalue_new_from_string(ICAL_RECUR_VALUE, - "FREQ=WEEKLY;INTERVAL=20;WKST=SU;BYDAY=TU"); - - printf("%s\n",icalvalue_as_ical_string(v)); - -} - -void test_duration() -{ - - icalvalue *v; - - v = icalvalue_new_from_string(ICAL_DURATION_VALUE, - "PT8H30M"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - icalvalue_free(v); - v = icalvalue_new_from_string(ICAL_PERIOD_VALUE, - "19971015T050000Z/PT8H30M"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - icalvalue_free(v); - v = icalvalue_new_from_string(ICAL_PERIOD_VALUE, - "19971015T050000Z/19971015T060000Z"); - - printf("%s\n",icalvalue_as_ical_string(v)); - icalvalue_free(v); - - -} - - -void test_strings(){ - - icalvalue *v; - - v = icalvalue_new_text("foo;bar;bats"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - icalvalue_free(v); - - v = icalvalue_new_text("foo\\;b\nar\\;ba\tts"); - - printf("%s\n",icalvalue_as_ical_string(v)); - - icalvalue_free(v); - - -} - -int main(int argc, char *argv[]) -{ - - - printf("\n------------Test strings---------------\n"); - test_strings(); - -exit(0); - - printf("\n------------Test recur---------------\n"); - test_recur(); - -#if 0 - printf("\n------------Test Calendar---------------\n"); - test_calendar(); - - printf("\n------------Test Store---------------\n"); - test_store(); -#endif - - printf("\n------------Test duration---------------\n"); - test_duration(); - - - - printf("\n------------Test Restriction---------------\n"); - test_restriction(); - - - - printf("\n------------Test Compare---------------\n"); - test_compare(); - - printf("\n------------Test Memory---------------\n"); - test_memory(); - - printf("\n------------Test Values---------------\n"); - test_values(); - - printf("\n------------Test Parameters-----------\n"); - test_parameters(); - - printf("\n------------Test Properties-----------\n"); - test_properties(); - - printf("\n------------Test Components ----------\n"); - test_components(); - - printf("\n------------Create Components --------\n"); - create_new_component(); - - printf("\n------------Test Parser---------------\n"); - test_parser(); - - printf("\n----- Create Components with vaargs ---\n"); - create_new_component_with_va_args(); - - - - - return 0; -} - - - diff --git a/libical/src/test/test-component.icd b/libical/src/test/test-component.icd deleted file mode 100644 index 3fe2995a83..0000000000 --- a/libical/src/test/test-component.icd +++ /dev/null @@ -1,23 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :0 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VCALENDAR -PRODID:-//RDU Software//NONSGML HandCal//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -REQUEST-STATUS:2.8;Repeating event ignored. Scheduled as a single - event;RRULE -REQUEST-STATUS:3.0;Invalid Property Name;FOO -UID:guid-1@host1.com -SEQUENCE:0 -DTSTAMP:19970603T094000Z -END:VEVENT -END:VCALENDAR -END:VCALENDAR diff --git a/libical/src/test/usecases.c b/libical/src/test/usecases.c deleted file mode 100644 index d07b5edac5..0000000000 --- a/libical/src/test/usecases.c +++ /dev/null @@ -1,561 +0,0 @@ -/* -*- Mode: C -*- - ====================================================================== - FILE: usecases.c - CREATOR: eric 03 April 1999 - - DESCRIPTION: - - $Id$ - $Locker$ - - (C) COPYRIGHT 1999 Eric Busboom - http://www.softwarestudio.org - - The contents of this file are subject to the Mozilla Public License - Version 1.0 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - the License for the specific language governing rights and - limitations under the License. - - The original author is Eric Busboom - The original code is usecases.c - - - ======================================================================*/ - -#include "ical.h" -#include -#include /* for strdup */ -#include /* for malloc */ -#include /* for printf */ -#include /* for time() */ -#include "icalmemory.h" - -/* - - Here is the example iCal object that the examples routines in this - file will use: - - BEGIN:VCALENDAR - PRODID:-//RDU Software//NONSGML HandCal//EN - VERSION:2.0 - BEGIN:VTIMEZONE - BEGIN:VEVENT - DTSTAMP:19980309T231000Z - UID:guid-1.host1.com - ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com - ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP: - MAILTO:employee-A@host.com - DESCRIPTION:Project XYZ Review Meeting - CREATED:19980309T130000Z - SUMMARY:XYZ Project Review - DTSTART;TZID=US-Eastern:19980312T083000 - DTEND;TZID=US-Eastern:19980312T093000 - END:VEVENT - END:VCALENDAR - -*/ -char str[] = "BEGIN:VCALENDAR -PRODID:\"-//RDU Software//NONSGML HandCal//EN\" -VERSION:2.0 -BEGIN:VEVENT -DTSTAMP:19980309T231000Z -UID:guid-1.host1.com -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:employee-A@host.com -DESCRIPTION:Project XYZ Review Meeting -CATEGORIES:MEETING -CREATED:19980309T130000Z -SUMMARY:XYZ Project Review -DTSTART;TZID=US-Eastern:19980312T083000 -DTEND;TZID=US-Eastern:19980312T093000 -END:VEVENT -END:VCALENDAR"; - -/* Creating iCal Components - - There are two ways to create new component in libical. You can - build the component from primitive parts, or you can create it - from a string. - - There are two variations of the API for building the component from - primitive parts. In the first variation, you add each parameter and - value to a property, and then add each property to a - component. This results in a long series of function calls. This - style is show in create_new_component() - - The second variation uses vargs lists to nest many primitive part - constructors, resulting in a compact, neatly formated way to create - components. This style is shown in create_new_component_with_va_args() - - - -*/ - -icalcomponent* create_new_component() -{ - - /* variable definitions */ - icalcomponent* calendar; - icalcomponent* event; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); - struct icalperiodtype rtime; - icalproperty* property; - - /* Define a time type that will use as data later. */ - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); - rtime.end.hour++; - - /* Create calendar and add properties */ - - calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT); - - /* Nearly every libical function call has the same general - form. The first part of the name defines the 'class' for the - function, and the first argument will be a pointer to a struct - of that class. So, icalcomponent_ functions will all take - icalcomponent* as their first argument. */ - - /* The next call creates a new proeprty and immediately adds it to the - 'calendar' component. */ - - icalcomponent_add_property( - calendar, - icalproperty_new_version(strdup("2.0")) - ); - - /* Note the use of strdup() in the previous and next call. All - properties constructors for properties with value types of - TEXT will take control of the string you pass into them. Since - the string '2.0' is a static string, we need to duplicate it in - new memory before giving it to the property */ - - /* Here is the short version of the memory rules: - - If the routine name has "new" in it: - Caller owns the returned memory. - If you pass in a string, the routine takes the memory. - - If the routine name has "add" in it: - The routine takes control of the component, property, - parameter or value memory. - - If the routine returns a string ( "get" and "as_ical_string" ) - The library owns the returned memory. - - */ - - icalcomponent_add_property( - calendar, - icalproperty_new_prodid(strdup("-//RDU Software//NONSGML HandCal//EN")) - ); - - /* Add an event */ - - event = icalcomponent_new(ICAL_VEVENT_COMPONENT); - - icalcomponent_add_property( - event, - icalproperty_new_dtstamp(atime) - ); - - /* In the previous call, atime is a struct, and it is passed in by value. - This is how all compound types of values are handled. */ - - icalcomponent_add_property( - event, - icalproperty_new_uid(strdup("guid-1.host1.com")) - ); - - /* add a property that has parameters */ - property = icalproperty_new_organizer(strdup("mrbig@host.com")); - - icalproperty_add_parameter( - property, - icalparameter_new_role(ICAL_ROLE_CHAIR) - ); - - icalcomponent_add_property(event,property); - - /* In this style of component creation, you need to use an extra - call to add parameters to properties, but the form of this - operation is the same as adding a property to a component */ - - /* add another property that has parameters */ - property = icalproperty_new_attendee(strdup("employee-A@host.com")); - - icalproperty_add_parameter( - property, - icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT) - ); - - icalproperty_add_parameter( - property, - icalparameter_new_rsvp(1) - ); - - icalproperty_add_parameter( - property, - icalparameter_new_cutype(ICAL_CUTYPE_GROUP) - ); - - icalcomponent_add_property(event,property); - - - /* more properties */ - - icalcomponent_add_property( - event, - icalproperty_new_description(strdup("Project XYZ Review Meeting")) - ); - - icalcomponent_add_property( - event, - icalproperty_new_categories(strdup("MEETING")) - ); - - icalcomponent_add_property( - event, - icalproperty_new_class(strdup("PUBLIC")) - ); - - icalcomponent_add_property( - event, - icalproperty_new_created(atime) - ); - - icalcomponent_add_property( - event, - icalproperty_new_summary(strdup("XYZ Project Review")) - ); - - property = icalproperty_new_dtstart(atime); - - icalproperty_add_parameter( - property, - icalparameter_new_tzid(strdup("US-Eastern")) - ); - - icalcomponent_add_property(event,property); - - - property = icalproperty_new_dtend(atime); - - icalproperty_add_parameter( - property, - icalparameter_new_tzid(strdup("US-Eastern")) - ); - - icalcomponent_add_property(event,property); - - icalcomponent_add_property( - event, - icalproperty_new_location(strdup("1CP Conference Room 4350")) - ); - - icalcomponent_add_component(calendar,event); - - return calendar; -} - - -/* Now, create the same component as in the previous routine, but use -the constructor style. */ - -icalcomponent* create_new_component_with_va_args() -{ - - /* This is a similar set up to the last routine */ - icalcomponent* calendar; - struct icaltimetype atime = icaltimetype_from_timet( time(0),0); - struct icalperiodtype rtime; - - rtime.start = icaltimetype_from_timet( time(0),0); - rtime.end = icaltimetype_from_timet( time(0),0); - rtime.end.hour++; - - /* Some of these routines are the same as those in the previous - routine, but we've also added several 'vanew' routines. These - 'vanew' routines take a list of properties, parameters or - values and add each of them to the parent property or - component. */ - - calendar = - icalcomponent_vanew( - ICAL_VCALENDAR_COMPONENT, - icalproperty_new_version(strdup("2.0")), - icalproperty_new_prodid(strdup("-//RDU Software//NONSGML HandCal//EN")), - icalcomponent_vanew( - ICAL_VEVENT_COMPONENT, - icalproperty_new_dtstamp(atime), - icalproperty_new_uid(strdup("guid-1.host1.com")), - icalproperty_vanew_organizer( - strdup("mrbig@host.com"), - icalparameter_new_role(ICAL_ROLE_CHAIR), - 0 - ), - icalproperty_vanew_attendee( - strdup("employee-A@host.com"), - icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT), - icalparameter_new_rsvp(1), - icalparameter_new_cutype(ICAL_CUTYPE_GROUP), - 0 - ), - icalproperty_new_description(strdup("Project XYZ Review Meeting")), - icalproperty_new_categories(strdup("MEETING")), - icalproperty_new_class(strdup("PUBLIC")), - icalproperty_new_created(atime), - icalproperty_new_summary(strdup("XYZ Project Review")), - icalproperty_vanew_dtstart( - atime, - icalparameter_new_tzid(strdup("US-Eastern")), - 0 - ), - icalproperty_vanew_dtend( - atime, - icalparameter_new_tzid(strdup("US-Eastern")), - 0 - ), - icalproperty_new_location(strdup("1CP Conference Room 4350")), - 0 - ), - 0 - ); - - - /* Note that properties with no parameters can use the regular - 'new' constructor, while those with parameters use the 'vanew' - constructor. And, be sure that the last argument in the 'vanew' - call is a zero. Without, your program will probably crash. */ - - return calendar; -} - - -/* Now, lets try to get a particular parameter out of a - component. This routine will return a list of strings of all - attendees who are required. Note that this routine assumes that the - component that we pass in is a VEVENT; the top level component we - created in the above two routines is a VCALENDAR */ - -char *attendees[10]; -#define MAX_ATTENDEES 10; - -char** get_required_attendees(icalcomponent* event) -{ - icalproperty* p; - icalparameter* parameter; - int c=0; - - assert(event != 0); - assert(icalcomponent_isa(event) == ICAL_VEVENT_COMPONENT); - - /* This loop iterates over all of the ATTENDEE properties in the - event */ - - /* Yes, the iteration routines save their state in the event - struct, so the are not thread safe unless you lock the whole - event. */ - - for( - p = icalcomponent_get_first_property(event,ICAL_ATTENDEE_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(event,ICAL_ATTENDEE_PROPERTY) - ) { - - /* Get the first ROLE parameter in the property. There should - only be one, so we wont bother to iterate over them. */ - - parameter = icalproperty_get_first_parameter(p,ICAL_ROLE_PARAMETER); - - /* If the parameter indicates the participant is required, get - the attendees name and stick a copy of it into the output - array */ - - if ( icalparameter_get_role(parameter) == ICAL_ROLE_REQPARTICIPANT) - { - attendees[c++] = strdup(icalproperty_get_attendee(p)); - } - } - - return attendees; -} - -/* Here is a similar example. If an attendee has a PARTSTAT of - NEEDSACTION or has no PARTSTAT parameter, change it to - TENTATIVE. */ - -void update_attendees(icalcomponent* event) -{ - icalproperty* p; - icalparameter* parameter; - - assert(event != 0); - assert(icalcomponent_isa(event) == ICAL_VEVENT_COMPONENT); - - for( - p = icalcomponent_get_first_property(event,ICAL_ATTENDEE_PROPERTY); - p != 0; - p = icalcomponent_get_next_property(event,ICAL_ATTENDEE_PROPERTY) - ) { - - parameter = icalproperty_get_first_parameter(p,ICAL_PARTSTAT_PARAMETER); - - if (parameter == 0) { - - /* There was no PARTSTAT parameter, so add one. */ - icalproperty_add_parameter( - p, - icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE) - ); - - } else if (icalparameter_get_partstat(parameter) == ICAL_PARTSTAT_NEEDSACTION) { - /* Remove the NEEDSACTION parameter and replace it with - TENTATIVE */ - - icalproperty_remove_parameter(p,ICAL_PARTSTAT_PARAMETER); - - /* Don't forget to free it */ - icalparameter_free(parameter); - - /* Add a new one */ - icalproperty_add_parameter( - p, - icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE) - ); - } - - } -} - -/* Here are some examples of manipulating properties */ - -void test_properties() -{ - icalproperty *prop; - icalparameter *param; - icalvalue *value; - - icalproperty *clone; - - /* Create a new property */ - prop = icalproperty_vanew_comment( - strdup("Another Comment"), - icalparameter_new_cn("A Common Name 1"), - icalparameter_new_cn("A Common Name 2"), - icalparameter_new_cn("A Common Name 3"), - icalparameter_new_cn("A Common Name 4"), - 0); - - /* Iterate through all of the parameters in the property */ - for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PROPERTY); - param != 0; - param = icalproperty_get_next_parameter(prop,ICAL_ANY_PROPERTY)) { - - printf("Prop parameter: %s\n",icalparameter_get_cn(param)); - } - - /* Get a string representation of the property's value */ - printf("Prop value: %s\n",icalproperty_get_comment(prop)); - - /* Spit out the property in its RFC 2445 representation */ - printf("As iCAL string:\n %s\n",icalproperty_as_ical_string(prop)); - - /* Make a copy of the property. Caller owns the memory */ - clone = icalproperty_new_clone(prop); - - /* Get a reference to the value within the clone property */ - value = icalproperty_get_value(clone); - - printf("Value: %s",icalvalue_as_ical_string(value)); - - /* Free the original and the clone */ - icalproperty_free(clone); - icalproperty_free(prop); - -} - - - -/* Here are some ways to work with values. */ -void test_values() -{ - icalvalue *v; - icalvalue *copy; - - v = icalvalue_new_caladdress(strdup("cap://value/1")); - printf("caladdress 1: %s\n",icalvalue_get_caladdress(v)); - - icalvalue_set_caladdress(v,strdup("cap://value/2")); - printf("caladdress 2: %s\n",icalvalue_get_caladdress(v)); - printf("String: %s\n",icalvalue_as_ical_string(v)); - - copy = icalvalue_new_clone(v); - printf("Clone: %s\n",icalvalue_as_ical_string(v)); - icalvalue_free(v); - icalvalue_free(copy); - - -} - -void test_parameters() -{ - icalparameter *p; - - p = icalparameter_new_cn("A Common Name"); - - printf("Common Name: %s\n",icalparameter_get_cn(p)); - - printf("As String: %s\n",icalparameter_as_ical_string(p)); -} - - -int test_parser() -{ - - - icalcomponent *c = icalparser_parse_string(str); - printf("%s\n",icalcomponent_as_ical_string(c)); - icalcomponent_free(c); - icalmemory_free_ring(); - return 1; -} - - -int main(int argc, char *argv[]) -{ - icalcomponent *c1; - icalcomponent *c2; - icalcomponent *vevent; - char **attendees; - - c1 = create_new_component(); - c2 = create_new_component_with_va_args(); - - /* Extract the VEVENT component from the component */ - - vevent = icalcomponent_get_first_component(c1,ICAL_VEVENT_COMPONENT); - - attendees = get_required_attendees(vevent); - - printf("Attendees: %s\n",attendees[0]); - - /* Now print out the component as a string. Remember that the - library retains control of the memory returned by - icalcomponent_as_ical_string. Do not sotre references to it or - try to free it. It is stored on an internal ring buffer,and the - library will eventuall reclaim it. */ - - printf("%s\n",icalcomponent_as_ical_string(c1)); - - return 0; - -} - - - diff --git a/libical/test-data/0 b/libical/test-data/0 deleted file mode 100644 index 3d7fb999cb..0000000000 --- a/libical/test-data/0 +++ /dev/null @@ -1,9 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//hacksw/handcal//NONSGML v1.0//EN -BEGIN:VEVENT -DTSTART:19970714T170000Z -DTEND:19970715T035959Z -SUMMARY:Bastille Day Party -END:VEVENT -END:VCALENDAR diff --git a/libical/test-data/1 b/libical/test-data/1 deleted file mode 100644 index 213b37d916..0000000000 --- a/libical/test-data/1 +++ /dev/null @@ -1,36 +0,0 @@ -BEGIN:VCALENDAR -PRODID:"-//RDU Software//NONSGML HandCal//EN" -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:US-Eastern -BEGIN:STANDARD -DTSTART:19981025T020000 -RDATE:19981025T020000 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19990404T020000 -RDATE:19990404T020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -DTSTAMP:19980309T231000Z -UID:guid-1.host1.com -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:employee-A@host.com -DESCRIPTION:Project XYZ Review Meeting -CATEGORIES:MEETING -CLASS:PUBLIC -CREATED:19980309T130000Z -SUMMARY:XYZ Project Review -DTSTART;TZID=US-Eastern:19980312T083000 -DTEND;TZID=US-Eastern:19980312T093000 -LOCATION:1CP Conference Room 4350 -END:VEVENT -END:VCALENDAR - diff --git a/libical/test-data/1.1 b/libical/test-data/1.1 deleted file mode 100644 index a7c92c33bd..0000000000 --- a/libical/test-data/1.1 +++ /dev/null @@ -1,13 +0,0 @@ -BEGIN:VCALENDAR -DURATION:P15DT5H0M20S -DURATION:P7W -URL;CN=John Smith:http://example.com/urivalue.html -X-SKI-TITLE;RSVP=TRUE: This is an extension property -SUMMARY:"No Property" -SUMMARY;RSVP=TRUE;RSVP=FALSE:Calendaring Interoperability Planning Meeting -SUMMARY;ALTREP=This is an xname:altrep -SUMMARY;CUTYPE=DESCRIPTION is a keyword:Xname parameter -DTEND:19990605 -DTSTART:19990605T103012 -CATEGORIES;RSVP=TRUE;RSVP=FALSE:one,two -END:VCALENDAR diff --git a/libical/test-data/2 b/libical/test-data/2 deleted file mode 100644 index 50ba609ab3..0000000000 --- a/libical/test-data/2 +++ /dev/null @@ -1,22 +0,0 @@ -BEGIN:VCALENDAR -METHOD:xyz -VERSION:2.0 -PRODID:-//ABC Corporation//NONSGML - My Product//EN -BEGIN:VEVENT -DTSTAMP:19970324T1200Z -SEQUENCE:0 -UID:uid3@host1.com -ORGANIZER:MAILTO:jdoe@host1.com -ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host1.com -DTSTART:19970324T123000Z -DTEND:19970324T210000Z -CATEGORIES:MEETING,PROJECT -CLASS:PUBLIC -SUMMARY:Calendaring Interoperability Planning Meeting -DESCRIPTION:Discuss how we can test c&s interoperability\n - using iCalendar and other IETF standards. -LOCATION:LDB Lobby -ATTACH;FMTTYPE=application/postscript:ftp://xyzCorp.com/pub/conf/bkgrnd.ps -END:VEVENT -END:VCALENDAR diff --git a/libical/test-data/2445.vcd b/libical/test-data/2445.vcd deleted file mode 100644 index 1168324d88..0000000000 --- a/libical/test-data/2445.vcd +++ /dev/null @@ -1,329 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :0 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//hacksw/handcal//NONSGML v1.0//EN -BEGIN:VEVENT -DTSTART:19970714T170000Z -DTEND:19970715T035959Z -SUMMARY:Bastille Day Party -END:VEVENT -END:VCALENDAR - -BEGIN:VEVENT -UID:19970901T130000Z-123401@host.com -DTSTAMP:19970901T1300Z -DTSTART:19970903T163000Z -DTEND:19970903T190000Z -SUMMARY:Annual Employee Review -CLASS:PRIVATE -CATEGORIES:BUSINESS,HUMAN RESOURCES -END:VEVENT - -BEGIN:VEVENT -UID:19970901T130000Z-123402@host.com -DTSTAMP:19970901T1300Z -DTSTART:19970401T163000Z -DTEND:19970402T010000Z -SUMMARY:Laurel is in sensitivity awareness class. -CLASS:PUBLIC -CATEGORIES:BUSINESS,HUMAN RESOURCES -TRANSP:TRANSPARENT -END:VEVENT - -BEGIN:VEVENT -UID:19970901T130000Z-123403@host.com -DTSTAMP:19970901T1300Z -DTSTART:19971102 -SUMMARY:Our Blissful Anniversary -CLASS:CONFIDENTIAL -CATEGORIES:ANNIVERSARY,PERSONAL,SPECIAL OCCASION -RRULE:FREQ=YEARLY -END:VEVENT - -BEGIN:VTODO -UID:19970901T130000Z-123404@host.com -DTSTAMP:19970901T1300Z -DTSTART:19970415T133000Z -DUE:19970416T045959Z -SUMMARY:1996 Income Tax Preparation -CLASS:CONFIDENTIAL -CATEGORIES:FAMILY,FINANCE -PRIORITY:1 -STATUS:NEEDS-ACTION -END:VTODO -BEGIN:VJOURNAL -UID:19970901T130000Z-123405@host.com -DTSTAMP:19970901T1300Z -DTSTART;VALUE=DATE:19970317 -SUMMARY:Staff meeting minutes -DESCRIPTION:1. Staff meeting: Participants include Joe\, Lisa - and Bob. Aurora project plans were reviewed. There is currently - no budget reserves for this project. Lisa will escalate to - management. Next meeting on Tuesday.\n - 2. Telephone Conference: ABC Corp. sales representative called - to discuss new printer. Promised to get us a demo by Friday.\n - 3. Henry Miller (Handsoff Insurance): Car was totaled by tree. - Is looking into a loaner car. 654-2323 (tel). -END:VJOURNAL -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:jane_doe@host1.com -ATTENDEE:MAILTO:john_public@host2.com -DTSTART:19971015T050000Z -DTEND:19971016T050000Z -DTSTAMP:19970901T083000Z -END:VFREEBUSY -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:jane_doe@host1.com -ATTENDEE:MAILTO:john_public@host2.com -DTSTAMP:19970901T100000Z -FREEBUSY;VALUE=PERIOD:19971015T050000Z/PT8H30M, - 19971015T160000Z/PT5H30M,19971015T223000Z/PT6H30M -URL:http://host2.com/pub/busy/jpublic-01.ifb -COMMENT:This iCalendar file contains busy time information for - the next three months. -END:VFREEBUSY -BEGIN:VFREEBUSY -ORGANIZER:jsmith@host.com -DTSTART:19980313T141711Z -DTEND:19980410T141711Z -FREEBUSY:19980314T233000Z/19980315T003000Z -FREEBUSY:19980316T153000Z/19980316T163000Z -FREEBUSY:19980318T030000Z/19980318T040000Z -URL:http://www.host.com/calendar/busytime/jsmith.ifb -END:VFREEBUSY -BEGIN:VTIMEZONE -TZID:US-Eastern -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19971026T020000 -RDATE:19971026T020000 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19971026T020000 -RDATE:19970406T020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VTIMEZONE -TZID:US-Eastern -LAST-MODIFIED:19870101T000000Z -TZURL:http://zones.stds_r_us.net/tz/US-Eastern -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VTIMEZONE -TZID:US--Fictitious-Eastern -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VTIMEZONE -TZID:US--Fictitious-Eastern -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -BEGIN:DAYLIGHT -DTSTART:19990424T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=4 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VALARM -TRIGGER;VALUE=DATE-TIME:19970317T133000Z -REPEAT:4 -DURATION:PT15M -ACTION:AUDIO -ATTACH;FMTTYPE=audio/basic:ftp://host.com/pub/sounds/bell-01.aud -END:VALARM -BEGIN:VALARM -TRIGGER:-PT30M -REPEAT:2 -DURATION:PT15M -ACTION:DISPLAY -DESCRIPTION:Breakfast meeting with executive\n - team at 8:30 AM EST. -END:VALARM -BEGIN:VALARM -TRIGGER:-P2D -ACTION:EMAIL -ATTENDEE:MAILTO:john_doe@host.com -SUMMARY:*** REMINDER: SEND AGENDA FOR WEEKLY STAFF MEETING *** -DESCRIPTION:A draft agenda needs to be sent out to the attendees - to the weekly managers meeting (MGR-LIST). Attached is a - pointer the document template for the agenda file. -ATTACH;FMTTYPE=application/binary:http://host.com/templates/agen - da.doc -END:VALARM -BEGIN:VALARM -TRIGGER;VALUE=DATE-TIME:19980101T050000Z -REPEAT:23 -DURATION:PT1H -ACTION:PROCEDURE -ATTACH;FMTTYPE=application/binary:ftp://host.com/novo- - procs/felizano.exe -END:VALARM -BEGIN:VCALENDAR -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:US-Eastern -BEGIN:STANDARD -DTSTART:19981025T020000 -RDATE:19981025T020000 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19990404T020000 -RDATE:19990404T020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -DTSTAMP:19980309T231000Z -UID:guid-1.host1.com -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP: - MAILTO:employee-A@host.com -DESCRIPTION:Project XYZ Review Meeting -CATEGORIES:MEETING -CLASS:PUBLIC -CREATED:19980309T130000Z -SUMMARY:XYZ Project Review -DTSTART;TZID=US-Eastern:19980312T083000 -DTEND;TZID=US-Eastern:19980312T093000 -LOCATION:1CP Conference Room 4350 -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:xyz -VERSION:2.0 -PRODID:-//ABC Corporation//NONSGML My Product//EN -BEGIN:VEVENT -DTSTAMP:19970324T1200Z -SEQUENCE:0 -UID:uid3@host1.com -ORGANIZER:MAILTO:jdoe@host1.com -ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host1.com -DTSTART:19970324T123000Z -DTEND:19970324T210000Z -CATEGORIES:MEETING,PROJECT -CLASS:PUBLIC -SUMMARY:Calendaring Interoperability Planning Meeting -DESCRIPTION:Discuss how we can test c&s interoperability\n - using iCalendar and other IETF standards. -LOCATION:LDB Lobby -ATTACH;FMTTYPE=application/postscript:ftp://xyzCorp.com/pub/ - conf/bkgrnd.ps -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//ABC Corporation//NONSGML My Product//EN -BEGIN:VTODO -DTSTAMP:19980130T134500Z -SEQUENCE:2 -UID:uid4@host1.com -ORGANIZER:MAILTO:unclesam@us.gov -ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:jqpublic@host.com -DUE:19980415T235959 -STATUS:NEEDS-ACTION -SUMMARY:Submit Income Taxes -BEGIN:VALARM -ACTION:AUDIO -TRIGGER;VALUE=DATE-TIME:19980403T120000Z -ATTACH;FMTTYPE=audio/basic:http://host.com/pub/audio- - files/ssbanner.aud -REPEAT:4 -DURATION:PT1H -END:VALARM -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//ABC Corporation//NONSGML My Product//EN -BEGIN:VJOURNAL -DTSTAMP:19970324T120000Z -UID:uid5@host1.com -ORGANIZER:MAILTO:jsmith@host.com -STATUS:DRAFT -CLASS:PUBLIC -CATEGORIES:Project Report, XYZ, Weekly Meeting -DESCRIPTION:Project xyz Review Meeting Minutes\n - Agenda\n1. Review of project version 1.0 requirements.\n2. - Definition of project processes.\n3. Review of project schedule.\n - Participants: John Smith, Jane Doe, Jim Dandy\n-It was - decided that the requirements need to be signed off by - product marketing.\n-Project processes were accepted.\n - -Project schedule needs to account for scheduled holidays - and employee vacation time. Check with HR for specific - dates.\n-New schedule will be distributed by Friday.\n- - Next weeks meeting is cancelled. No meeting until 3/23. -END:VJOURNAL -END:VCALENDAR -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//RDU Software//NONSGML HandCal//EN -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:jsmith@host.com -DTSTART:19980313T141711Z -DTEND:19980410T141711Z -FREEBUSY:19980314T233000Z/19980315T003000Z -FREEBUSY:19980316T153000Z/19980316T163000Z -FREEBUSY:19980318T030000Z/19980318T040000Z -URL:http://www.host.com/calendar/busytime/jsmith.ifb -END:VFREEBUSY -END:VCALENDAR -END:VCALENDAR \ No newline at end of file diff --git a/libical/test-data/2446.vcd b/libical/test-data/2446.vcd deleted file mode 100644 index 679f6c7920..0000000000 --- a/libical/test-data/2446.vcd +++ /dev/null @@ -1,1007 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :0 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VCALENDAR -METHOD:PUBLISH -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTART:19970701T200000Z -DTSTAMP:19970611T190000Z -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:PUBLISH -VERSION:2.0 -PRODID:-//ACME/DesktopCalendar//EN -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTAMP:19970612T190000Z -DTSTART:19970701T210000Z -DTEND:19970701T230000Z -SEQUENCE:1 -UID:0981234-1234234-23@example.com -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:CANCEL -VERSION:2.0 -PRODID:-//ACME/DesktopCalendar//EN -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -COMMENT:DUKES forfeit the game -SEQUENCE:2 -UID:0981234-1234234-23@example.com -DTSTAMP:19970613T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:PUBLISH -SCALE:GREGORIAN -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:America-Chicago -TZURL:http://zones.stds_r_us.net/tz/America-Chicago -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0600 -TZNAME:CST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZOFFSETFROM:-0600 -TZOFFSETTO:-0500 -TZNAME:CDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -ATTACH:http://www.dukes.com/ -CATEGORIES:SPORTS EVENT,ENTERTAINMENT -CLASS:PRIVATE -DESCRIPTION:MIDWAY STADIUM\n - Big time game. MUST see.\n - Expected duration:2 hours\n -DTEND;TZID=America-Chicago:19970701T180000 -DTSTART;TZID=America-Chicago:19970702T160000 -DTSTAMP:19970614T190000Z -STATUS:CONFIRMED -LOCATION;VALUE=URI:http://www.midwaystadium.com/ -PRIORITY:2 -RESOURCES:SCOREBOARD -SEQUENCE:3 -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -RELATED-TO:0981234-1234234-14@example.com -BEGIN:VALARM -TRIGGER:-PT2H -ACTION:DISPLAY -DESCRIPTION:You should be leaving for the game now. -END:VALARM -BEGIN:VALARM -TRIGGER:-PT30M -ACTION:AUDIO -END:VALARM -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:PUBLISH -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTAMP:19970614T190000Z -UID:0981234-1234234-23@example.com -DTSTART;VALUE=DATE:19970714 -RRULE:FREQ=YEARLY;INTERVAL=1 -SUMMARY: Bastille Day -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com -ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com -ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com -DTSTAMP:19970611T190000Z -DTSTART:19970701T200000Z -DTEND:19970701T2000000Z -SUMMARY:Conference -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ATTENDEE;PARTSTAT=ACCEPTED:Mailto:B@example.com -ORGANIZER:MAILTO:A@example.com -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970612T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com -ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE; - CUTYPE=ROOM:Mailto:Conf@example.com -ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com -DTSTART:19970701T180000Z -DTEND:19970701T190000Z -SUMMARY:Phone Conference -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:1 -DTSTAMP:19970613T190000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -DTSTART:19970701T190000Z -DTEND:19970701T200000Z -SUMMARY:Discuss the Merits of the election results -LOCATION:Green Conference Room -UID:calsrv.example.com-873970198738777a@example.com -SEQUENCE:0 -DTSTAMP:19970611T190000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:COUNTER -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -DTSTART:19970701T160000Z -DTEND:19970701T190000Z -DTSTAMP:19970612T190000Z -SUMMARY:Discuss the Merits of the election results -LOCATION:Green Conference Room -COMMENT:This time works much better and I think the big conference - room is too big -UID:calsrv.example.com-873970198738777a@example.com -SEQUENCE:0 -DTSTAMP:19970611T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -DTSTAMP:19970613T190000Z -DTSTART:19970701T160000Z -DTEND:19970701T190000Z -SUMMARY:Discuss the Merits of the election results - changed to - meet B's schedule -LOCATION:Green Conference Room -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:1 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:DECLINECOUNTER -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -COMMENT:Sorry, I cannot change this meeting time -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -DTSTAMP:19970614T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=DELEGATED;DELEGATED- - TO="Mailto:E@example.com":Mailto:C@example.com -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970611T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;PARTSTAT=DELEGATED;DELEGATED- - TO="Mailto:E@example.com":Mailto:C@example.com -ATTENDEE;RSVP=TRUE; - DELEGATED-FROM="Mailto:C@example.com":Mailto:E@example.com -DTSTART:19970701T180000Z -DTEND:19970701T200000Z -SUMMARY:Phone Conference -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -STATUS:CONFIRMED -DTSTAMP:19970611T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=ACCEPTED;DELEGATED- - FROM="Mailto:C@example.com":Mailto:E@example.com -ATTENDEE;PARTSTAT=DELEGATED; - DELEGATED-TO="Mailto:E@example.com":Mailto:C@example.com -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970614T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=DELEGATED; - DELEGATED-TO="Mailto:E@example.com":Mailto:C@example.com -ATTENDEE;PARTSTAT=DECLINED; - DELEGATED-FROM="Mailto:C@example.com":Mailto:E@example.com -COMMENT:Sorry, I will be out of town at that time. -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -REQUEST-STATUS:2.0;Success -DTSTAMP:19970614T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:MAILTO:A@Example.com -ATTENDEE;PARTSTAT=DECLINED; - DELEGATED-FROM="Mailto:C@example.com":Mailto:E@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -SUMMARY:Phone Conference -DTSTART:19970701T180000Z -DTEND:19970701T200000Z -DTSTAMP:19970614T200000Z -COMMENT:DELEGATE (ATTENDEE Mailto:E@example.com) DECLINED YOUR - INVITATION -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:CANCEL -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:A@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:D@example.com -COMMENT:Mr. B cannot attend. It's raining. Lets cancel. -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:1 -STATUS:CANCELLED -DTSTAMP:19970613T190000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:CANCEL -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE:mailto:B@example.com -COMMENT:You're off the hook for this meeting -UID:calsrv.example.com-873970198738777@example.com -DTSTAMP:19970613T193000Z -SEQUENCE:1 -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:D@example.com -ATTENDEE;CUTYPE=ROOM:CR_Big@example.com -ATTENDEE;ROLE=NON-PARTICIPANT; - RSVP=FALSE:Mailto:E@example.com -DTSTAMP:19970611T190000Z -DTSTART:19970701T200000Z -DTEND:19970701T203000Z -SUMMARY:Phone Conference -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:2 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:B@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:B@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:C@example.com -ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:D@example.com -DTSTAMP:19970611T190000Z -DTSTART:19970701T200000Z -DTEND:19970701T203000Z -RRULE:FREQ=WEEKLY -SUMMARY:Phone Conference -UID:123456@example.com -SEQUENCE:1 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -METHOD:PUBLISH -BEGIN:VFREEBUSY -DTSTAMP:19980101T124100Z -ORGANIZER:MAILTO:A@Example.com -DTSTART:19980101T124200Z -DTEND:19980107T124200Z -FREEBUSY:19980101T180000Z/19980101T190000Z -FREEBUSY:19980103T020000Z/19980103T050000Z -FREEBUSY:19980107T020000Z/19980107T050000Z -FREEBUSY:19980113T000000Z/19980113T010000Z -FREEBUSY:19980115T190000Z/19980115T200000Z -FREEBUSY:19980115T220000Z/19980115T230000Z -FREEBUSY:19980116T013000Z/19980116T043000Z -END:VFREEBUSY -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VFREEBUSY -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -DTSTAMP:19970613T190000Z -DTSTART:19970701T080000Z -DTEND:19970701T200000 -UID:calsrv.example.com-873970198738777@example.com -END:VFREEBUSY -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:A@example.com -ATTENDEE:Mailto:B@example.com -DTSTART:19970701T080000Z -DTEND:19970701T200000Z -UID:calsrv.example.com-873970198738777@example.com -FREEBUSY:19970701T090000Z/PT1H,19970701T140000Z/PT30M -DTSTAMP:19970613T190030Z -END:VFREEBUSY -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:America-SanJose -TZURL:http://zones.stds_r_us.net/tz/America-SanJose -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0700 -TZOFFSETTO:-0800 -TZNAME:PST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZOFFSETFROM:-0800 -TZOFFSETTO:-0700 -TZNAME:PDT -END:DAYLIGHT -END:VTIMEZONE -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CUTYPE=INDIVIDUAL:A@example.COM -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:B@example.fr -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:c@example.jp -DTSTAMP:19970613T190030Z -DTSTART;TZID=America-SanJose:19970701T140000 -DTEND;TZID=America-SanJose:19970701T150000 -RRULE:FREQ=WEEKLY;INTERVAL=20;WKST=SU;BYDAY=TU -RDATE;TZID=America-SanJose:19970910T140000 -EXDATE;TZID=America-SanJose:19970909T140000 -EXDATE;TZID=America-SanJose:19971028T140000 -SUMMARY:Weekly Phone Conference -UID:calsrv.example.com-873970198738777@example.com -SEQUENCE:0 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -SEQUENCE:0 -RRULE:FREQ=MONTHLY;BYMONTHDAY=1;UNTIL=19980901T210000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970601T210000Z -DTEND:19970601T220000Z -LOCATION:Conference Call -DTSTAMP:19970526T083000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1com -RECURRENCE-ID:19970701T210000Z -SEQUENCE:1 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970703T210000Z -DTEND:19970703T220000Z -LOCATION:Conference Call -DTSTAMP:19970626T093000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:CANCEL -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -RECURRENCE-ID:19970801T210000Z -SEQUENCE:2 -STATUS:CANCELLED -DTSTAMP:19970721T093000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:CANCEL -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -DTSTAMP:19970721T103000Z -STATUS:CANCELLED -SEQUENCE:3 -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -RECURRENCE-ID;RANGE=THISANDFUTURE:19970901T210000Z -SEQUENCE:3 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Discussion -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970901T210000Z -DTEND:19970901T220000Z -LOCATION:Building 32, Microsoft, Seattle, WA -DTSTAMP:19970526T083000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:ADD -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:4 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970715T210000Z -DTEND:19970715T220000Z -LOCATION:Conference Call -DTSTAMP:19970629T093000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:0 -RRULE:FREQ=WEEKLY;WKST=SU;BYDAY=TU -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980303T210000Z -DTEND:19980303T220000Z -LOCATION:The White Room -DTSTAMP:19980301T093000Z -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:ADD -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:7 -RRULE:WKST=SU;BYDAY=TH;FREQ=WEEKLY -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980303T210000Z -DTEND:19980303T220000Z -DTSTAMP:19980303T193000Z -LOCATION:The Usual conference room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:7 -RRULE:WKST=SU;BYDAY=TU,TH;FREQ=WEEKLY -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980303T210000Z -DTEND:19980303T220000Z -DTSTAMP:19980303T193000Z -LOCATION:The White Room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:0 -RDATE:19980304T180000Z -RDATE:19980311T180000Z -RDATE:19980318T180000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980304T180000Z -DTEND:19980304T200000Z -DTSTAMP:19980303T193000Z -LOCATION:Conference Room A -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:1 -RECURRENCE-ID:19980311T180000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980311T160000Z -DTEND:19980311T180000Z -DTSTAMP:19980306T193000Z -LOCATION:The Small conference room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:ADD -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:2 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980315T180000Z -DTEND:19980315T200000Z -DTSTAMP:19980307T193000Z -LOCATION:Conference Room A -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:123456789@host1.com -SEQUENCE:2 -RDATE:19980304T180000Z -RDATE:19980311T160000Z -RDATE:19980315T180000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980304T180000Z -DTEND:19980304T200000Z -DTSTAMP:19980303T193000Z -LOCATION:Conference Room A -STATUS:CONFIRMED -END:VEVENT -BEGIN:VEVENT -SEQUENCE:2 -RECURRENCE-ID:19980311T160000Z -ATTENDEE;ROLE=CHAIR;RSVP=TRUE:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -SUMMARY:Review Accounts -DTSTART:19980311T160000Z -DTEND:19980304T180000Z -DTSTAMP:19980306T193000Z -LOCATION:The Small conference room -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:COUNTER -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -RECURRENCE-ID:19970715T210000Z -SEQUENCE:4 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;RSVP=TRUE:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970715T220000Z -DTEND:19970715T230000Z -LOCATION:Conference Call -COMMENT:May we bump this by an hour? I have a conflict -DTSTAMP:19970629T094000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:guid-1@host1.com -SEQUENCE:0 -RRULE:FREQ=MONTHLY;BYMONTHDAY=1 -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DESCRIPTION:IETF-C&S Conference Call -CLASS:PUBLIC -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970601T210000Z -DTEND:19970601T220000Z -DTSTAMP:19970602T094000Z -LOCATION:Conference Call -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//RDU Software//NONSGML HandCal//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -REQUEST-STATUS:2.8;Repeating event ignored. Scheduled as a single - event;RRULE -REQUEST-STATUS:3.0;Invalid Property Name;FOO -UID:guid-1@host1.com -SEQUENCE:0 -DTSTAMP:19970603T094000Z -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VTODO -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR:Mailto:A@example.com -ATTENDEE;RSVP=TRUE:Mailto:B@example.com -ATTENDEE;RSVP=TRUE:Mailto:C@example.com -ATTENDEE;RSVP=TRUE:Mailto:D@example.com -DTSTART:19970701T170000Z -DUE:19970722T170000Z -PRIORITY:1 -SUMMARY:Create the requirements document -UID:calsrv.example.com-873970198738777-00@example.com -SEQUENCE:0 -DTSTAMP:19970717T200000Z -STATUS:Needs Action -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VTODO -ORGANIZER:Mailto:A@example.com -ATTENDEE;PARTSTAT=ACCEPTED:Mailto:B@example.com -UID:calsrv.example.com-873970198738777-00@example.com -COMMENT:I'll send you my input by e-mail -SEQUENCE:0 -DTSTAMP:19970717T203000Z -REQUEST-STATUS:2.0;Success -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VTODO -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:D@example.com -UID:calsrv.example.com-873970198738777-00@example.com -SUMMARY:Create the requirements document -PRIORITY:1 -SEQUENCE:0 -STATUS:IN-PROCESS -DTSTART:19970701T170000Z -DTSTAMP:19970717T230000Z -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VTODO -ORGANIZER:MAILTO:A@example.com -ATTENDEE;PARTSTAT=IN-PROCESS:Mailto:B@example.com -PERCENT-COMPLETE:75 -UID:calsrv.example.com-873970198738777-00@example.com -DTSTAMP:19970717T233000Z -SEQUENCE:0 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VTODO -ORGANIZER:MAILTO:A@example.com -ATTENDEE;PARTSTAT=COMPLETED:Mailto:D@example.com -UID:calsrv.example.com-873970198738777-00@example.com -DTSTAMP:19970717T233000Z -SEQUENCE:0 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VTODO -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE;PARTSTAT=ACCEPTED;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;PARTSTAT=IN-PROCESS;CUTYPE=INDIVIDUAL:Mailto:D@example.com -DTSTART:19970701T170000Z -DUE:19970722T170000Z -PRIORITY:1 -SUMMARY:Create the requirements document -UID:calsrv.example.com-873970198738777-00@example.com -SEQUENCE:1 -DTSTAMP:19970718T100000Z -STATUS:IN-PROGRESS -PERCENT-COMPLETE:40 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REQUEST -VERSION:2.0 -BEGIN:VTODO -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR:Mailto:A@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:B@example.com -ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL:Mailto:D@example.com -RRULE:FREQ=MONTHLY;COUNT=10;BYDAY=1FR -DTSTART:19980101T100000 -DUE:19980103T100000 -SUMMARY:Send Status Reports to Area Managers -UID:calsrv.example.com-873970198738777-00@example.com -SEQUENCE:0 -DTSTAMP:19970717T200000Z -STATUS:NEEDS ACTION -PRIORITY:1 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//ACME/DesktopCalendar//EN -METHOD:REPLY -VERSION:2.0 -BEGIN:VTODO -ATTENDEE;PARTSTAT=IN-PROCESS:Mailto:B@example.com -PERCENT-COMPLETE:75 -UID:calsrv.example.com-873970198738777-00@example.com -DTSTAMP:19970717T233000Z -RECURRENCE-ID:19980101T170000Z -SEQUENCE:1 -END:VTODO -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:PUBLISH -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VJOURNAL -DTSTART:19971002T200000Z -ORGANIZER:MAILTO:A@Example.com -SUMMARY:Phone conference minutes -DESCRIPTION:The editors meeting was held on October 1, 1997. - Details are in the attached document. -UID:0981234-1234234-2410@example.com -RELATED-TO:0981234-1234234-2402-35@example.com -ATTACH:ftp://ftp.example.com/pub/ed/minutes100197.txt -END:VJOURNAL -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//RDU Software//NONSGML HandCal//EN -METHOD:REFRESH -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -ATTENDEE:Mailto:C@example.com -ATTENDEE:Mailto:D@example.com -UID: guid-1-12345@host1.com -DTSTAMP:19970603T094000 -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -METHOD:REQUEST -PRODID:-//RDU Software//NONSGML HandCal//EN -VERSION:2.0 -BEGIN:VEVENT -UID:acme-12345@host1.com -SEQUENCE:3 -RRULE:FREQ=WEEKLY -RDATE;VALUE=PERIOD:19970819T210000Z/199700819T220000Z -ORGANIZER:Mailto:A@example.com -ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -DESCRIPTION:IETF-C&S Conference Call -SUMMARY:IETF Calendaring Working Group Meeting -DTSTART:19970801T210000Z -DTEND:19970801T220000Z -RECURRENCE-ID:19970809T210000Z -DTSTAMP:19970726T083000 -STATUS:CONFIRMED -END:VEVENT -END:VCALENDAR -BEGIN:VCALENDAR -PRODID:-//RDU Software//NONSGML HandCal//EN -METHOD:REFRESH -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:Mailto:A@example.com -ATTENDEE:Mailto:B@example.com -UID:acme-12345@host1.com -DTSTAMP:19970603T094000 -END:VEVENT -END:VCALENDAR -END:VCALENDAR \ No newline at end of file diff --git a/libical/test-data/3 b/libical/test-data/3 deleted file mode 100644 index 008373ebfa..0000000000 --- a/libical/test-data/3 +++ /dev/null @@ -1,21 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//ABC Corporation//NONSGML My Product//EN -BEGIN:VTODO -DTSTAMP:19980130T134500Z -SEQUENCE:2 -UID:uid4@host1.com -ORGANIZER:MAILTO:unclesam@us.gov -ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:jqpublic@host.com -DUE:19980415T235959 -STATUS:NEEDS-ACTION -SUMMARY:Submit Income Taxes -BEGIN:VALARM -ACTION:AUDIO -TRIGGER;VALUE=DATE-TIME:19980403T120000 -ATTACH;FMTTYPE=audio/basic:http://host.com/pub/audio-files/ssbanner.aud -REPEAT:4 -DURATION:PT1H -END:VALARM -END:VTODO -END:VCALENDAR diff --git a/libical/test-data/4 b/libical/test-data/4 deleted file mode 100644 index 59c3d6917b..0000000000 --- a/libical/test-data/4 +++ /dev/null @@ -1,23 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//ABC Corporation//NONSGML My Product//EN -BEGIN:VJOURNAL -DTSTAMP:19970324T120000Z -UID:uid5@host1.com -ORGANIZER:MAILTO:jsmith@host.com -STATUS:DRAFT -CLASS:PUBLIC -CATEGORIES:Project Report, XYZ: Weekly Meeting -DESCRIPTION:Project xyz Review Meeting Minutes\n - Agenda\n1. Review of project version 1.0 requirements.\n2. - Definition - of project processes.\n3. Review of project schedule.\n - Participants: John Smith\, Jane Doe\, Jim Dandy\n-It was - decided that the requirements need to be signed off by - product marketing.\n-Project processes were accepted.\n - -Project schedule needs to account for scheduled holidays - and employee vacation time. Check with HR for specific - dates.\n-New schedule will be distributed by Friday.\n- - Next weeks meeting is cancelled. No meeting until 3/23. -END:VJOURNAL -END:VCALENDAR diff --git a/libical/test-data/5 b/libical/test-data/5 deleted file mode 100644 index ba1fd09f7f..0000000000 --- a/libical/test-data/5 +++ /dev/null @@ -1,16 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//RDU Software//NONSGML HandCal//EN -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:jsmith@host.com -DTSTART:19980313T141711Z -DTEND:19980410T141711 -FREEBUSY:19980314T233000Z/19980315T003000Z -FREEBUSY:19980316T153000Z/19980316T163000Z -FREEBUSY:19980318T030000/19980318T040000,19980318T030000/19980318T040000 -URL:http://www.host.com/calendar/busytime/jsmith.ifb -END:VFREEBUSY -END:VCALENDAR - - - diff --git a/libical/test-data/6 b/libical/test-data/6 deleted file mode 100644 index 753bd2b66c..0000000000 --- a/libical/test-data/6 +++ /dev/null @@ -1,12 +0,0 @@ -BEGIN:VCALENDAR -METHOD:PUBLISH -PRODID:-//ACME/DesktopCalendar//EN -VERSION:2.0 -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTART:19970701T200000Z -DTSTAMP:19970611T190000Z -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -UID:0981234-1234234-23@example.com -END:VEVENT -END:VCALENDAR diff --git a/libical/test-data/7 b/libical/test-data/7 deleted file mode 100644 index 0a255fc514..0000000000 --- a/libical/test-data/7 +++ /dev/null @@ -1,14 +0,0 @@ -BEGIN:VCALENDAR -METHOD:PUBLISH -VERSION:2.0 -PRODID:-//ACME/DesktopCalendar//EN -BEGIN:VEVENT -ORGANIZER:mailto:a@example.com -DTSTAMP:19970612T190000Z -DTSTART:19970701T210000Z -DTEND:19970701T230000Z -SEQUENCE:1 -UID:0981234-1234234-23@example.com -SUMMARY:ST. PAUL SAINTS -VS- DULUTH-SUPERIOR DUKES -END:VEVENT -END:VCALENDAR diff --git a/libical/test-data/smallcluster.vcd b/libical/test-data/smallcluster.vcd deleted file mode 100644 index c4e2dbae50..0000000000 --- a/libical/test-data/smallcluster.vcd +++ /dev/null @@ -1,18 +0,0 @@ -BEGIN:VCALENDAR -X-LIC-CLUSTERCOUNT - :0 -DTSTART - :00000000T000000 -DTEND - :00000000T000000 -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//hacksw/handcal//NONSGML v1.0//EN -BEGIN:VEVENT -DTSTART:19970714T170000Z -DTEND:19970715T035959Z -SUMMARY:Bastille Day Party -RRULE:FREQ=YEARLY;UNTIL=123456T123456;BYSETPOS=-1,2,-3,4,-5,6,-7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,4,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54;BYSECOND=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,4,25,26 -END:VEVENT -END:VCALENDAR -END:VCALENDAR diff --git a/libversit/.cvsignore b/libversit/.cvsignore deleted file mode 100644 index 36a99050c8..0000000000 --- a/libversit/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -vcc.c -vcc.lo -vobject.lo -vcaltmp.lo -libversit.la \ No newline at end of file diff --git a/libversit/Makefile.am b/libversit/Makefile.am deleted file mode 100644 index 5d42636c1c..0000000000 --- a/libversit/Makefile.am +++ /dev/null @@ -1,15 +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 - -YFLAGS=-pversit_ 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 -#include -#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 -#include -#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.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 fa314efeb5..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 -#endif -#endif - -#include -#ifndef __MWERKS__ -#include -#endif -#include -#include -#include -#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 - STRING ID - -%type name value - -%type 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;iRead(&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 -#include -#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 d685b04278..0000000000 --- a/libversit/vobject.c +++ /dev/null @@ -1,1452 +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 -#endif - -#include "vobject.h" -#include -#include -#include - - -#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 */ - 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; ifp = 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 writeString(OFile *fp, const char *s) -{ - appendsOFile(fp,s); -} - -static void writeQPString(OFile *fp, const char *s) -{ - char buf[4]; - int count=0; - const char *p = s; - - while (*p) { - /* break up lines biggger than 75 chars */ - if(count >=74){ - count=0; - appendsOFile(fp,"=\n"); - } - - /* escape any non ASCII characters and '=' as per rfc1521 */ - if (*p<= 0x1f || *p >=0x7f || *p == '=' ) { - sprintf(buf,"=%02X",(unsigned char)*p); - appendsOFile(fp,buf); - count+=3; - } else { - appendcOFile(fp,*p); - count++; - } - p++; - } -} - - - -static void writeVObject_(OFile *fp, VObject *o); - -static void writeValue(OFile *fp, VObject *o, unsigned long size,int quote) -{ - if (o == 0) return; - switch (VALUE_TYPE(o)) { - case VCVT_USTRINGZ: { - char *s = fakeCString(USTRINGZ_VALUE_OF(o)); - if(quote) writeQPString(fp, s); - else writeString(fp,s); - deleteStr(s); - break; - } - case VCVT_STRINGZ: { - if(quote) writeQPString(fp, STRINGZ_VALUE_OF(o)); - else writeString(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,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) -{ - int isQuoted=0; - 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 (stricmp(VCQPProp,s)==0 || stricmp(VCQuotedPrintableProp,s)==0) - isQuoted=1; - } - 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;iflags & 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 -#include - -#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/mail/.cvsignore b/mail/.cvsignore deleted file mode 100644 index be56e23078..0000000000 --- a/mail/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -Mail-stubs.c -Mail-skels.c -Mail-common.c -Mail.h -evolution-mail -test-mail \ No newline at end of file diff --git a/mail/ChangeLog b/mail/ChangeLog deleted file mode 100644 index 6aa072a42d..0000000000 --- a/mail/ChangeLog +++ /dev/null @@ -1,86 +0,0 @@ -2000-02-24 Christopher James Lahey - - * message-list.c: Changed to match new e_table_simple interface. - -2000-02-24 Dan Winship - - * message-list.c (message_list_set_folder): update for CamelFolder - changes - -2000-02-24 Christopher James Lahey - - * message-list.c: Changed this to not use the "x" and "y" - arguments to e-table-item. - -2000-02-23 Matt Loper - - * message-list.c (message_list_set_folder): Check 'desc'riptions - of exceptions. - -2000-02-22 bertrand - - * message-list.c (message_list_set_folder): - fix to show a sample correct implementation. - -2000-02-21 Matt Loper - - * Makefile.am: added -lunicode to evolution_mail_LDADD. - -2000-02-21 Dan Winship - - * session.c (session_store_new): Pass a CamelAuthCallback - (evolution_auth_callback) to camel_session_new. - -2000-02-21 Dan Winship - - * session.c (session_store_new): Update session_store_new to - deal with the fact that camel_session_get_store takes a - CamelException now. Doesn't actually do anything with the - exception yet, because nothing else does yet either. - -2000-02-19 Matt Loper - - * .cvsignore: added test-mail. - -2000-02-14 Miguel de Icaza - - * folder-browser.c (folder_browser_load_folder): New routine, - loads a camel folder. - (folder_browser_set_uri): redo. - - * session.c: new file. Implements SessionStores to keep track of - a Session/Store tuple. - -2000-02-13 Matt Loper - - * html-stream.c (html_stream_new): Second param of gtk_html_begin - should be "", not NULL. - (html_stream_new): gtk_html_parse() is deprecated, so the call was - removed. - - * html-stream.h: HTMLStreamClass's parent changed to - CamelStreamClass, not CamelStream. - -2000-02-11 Christopher James Lahey - - * Makefile.am: Add the e-text directory to the includes list. - - * message-list.c: Change the call to e_cell_text_new, since - there's an added argument. - -2000-02-09 Christopher James Lahey - - * Makefile.am: Added libetext as libetable depends on it. - -2000-02-08 Iain Holmes - - * Makefile.am: Changed the order of the compilation so the CORBA stuff - was made before it was needed. - -2000-01-19 Miguel de Icaza - - * Started work on the mail display engine. - - * html-stream.c, html-stream.h: New files, they are CamelStreams - used to write to the GtkHTML widget. - diff --git a/mail/Mail.idl b/mail/Mail.idl deleted file mode 100644 index 1d12a39c5c..0000000000 --- a/mail/Mail.idl +++ /dev/null @@ -1,30 +0,0 @@ -/* - * mail.idl: Mail interfaces for Evolution - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ - -#include - -module Evolution { - - interface MessageList : Bonobo::Unknown { - - void select_message (in long message_number); - void open_message (in long message_number); - }; - - /* - * FolderBrowser object. - * - * configuration of this widget is done trough - * Bonobo Properties - */ - interface FolderBrowser : Bonobo::Unknown { - MessageList get_message_list (); - }; -}; - diff --git a/mail/Makefile.am b/mail/Makefile.am deleted file mode 100644 index cc7bd2f144..0000000000 --- a/mail/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -bin_PROGRAMS = evolution-mail test-mail - -providerdir = $(libdir)/evolution/camel-providers/$(VERSION) - -INCLUDES = \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/e-text - -EVOLUTION_MAIL_CORBA_GENERATED = \ - Mail.h \ - Mail-common.c \ - Mail-skels.c \ - Mail-stubs.c - -evolution_mail_SOURCES = \ - $(EVOLUTION_MAIL_CORBA_GENERATED) \ - folder-browser.c \ - folder-browser.h \ - folder-browser-factory.c \ - folder-browser-factory.h \ - html-stream.c \ - html-stream.h \ - mail-display.h \ - mail-display.c \ - main.c \ - message-list.c \ - message-list.h \ - session.c \ - session.h - -evolution_mail_LDADD = \ - ../widgets/e-table/libetable.a \ - ../widgets/e-text/libetext.a \ - ../camel/libcamel.la \ - ../e-util/libeutil.a \ - $(BONOBO_HTML_GNOME_LIBS) \ - -lunicode - -test_mail_SOURCES = \ - test-mail.c - -test_mail_LDADD = \ - $(BONOBO_HTML_GNOME_LIBS) - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = evolution-mail.gnorba - -$(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Mail.idl - -EXTRA_DIST = Mail.idl evolution-mail.gnorba diff --git a/mail/evolution-mail.gnorba b/mail/evolution-mail.gnorba deleted file mode 100644 index 278c480384..0000000000 --- a/mail/evolution-mail.gnorba +++ /dev/null @@ -1,13 +0,0 @@ -[GOADID:Evolution:FolderBrowserFactory:1.0] -type=exe -repo_id=IDL:GNOME/GenericFactory:1.0 IDL:Bonobo/GenericFactory:1.0 -description=Evolution mail folder factory component. -location_info=evolution-mail - -[GOADID:Evolution:FolderBrowser:1.0] -type=factory -repo_id=IDL:Evolution/Mail:1.0 -description=Evolution mail folder display component. -location_info=GOADID:Evolution:FolderBrowserFactory:1.0 - - diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c deleted file mode 100644 index dc5afb79a6..0000000000 --- a/mail/folder-browser-factory.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include -#include -#include -#include "e-util/e-util.h" -#include "e-util/e-gui-utils.h" -#include "folder-browser.h" -#include "main.h" - -/* - * Creates the Folder Browser, wraps it in a Bonobo Control, and - * sets the Bonobo Control properties to point to the Folder Browser - * Properties - */ -static BonoboObject * -folder_browser_factory (BonoboGenericFactory *factory, void *closure) -{ - BonoboControl *control; - GtkWidget *folder_browser; - - folder_browser = folder_browser_new (); - if (folder_browser == NULL) - return NULL; - - folder_browser_set_uri (FOLDER_BROWSER (folder_browser), "inbox"); - - control = bonobo_control_new (folder_browser); - if (control == NULL){ - gtk_object_destroy (GTK_OBJECT (folder_browser)); - return NULL; - } - - bonobo_control_set_property_bag ( - control, - FOLDER_BROWSER (folder_browser)->properties); - - return BONOBO_OBJECT (control); -} - -void -folder_browser_factory_init (void) -{ - static BonoboGenericFactory *bonobo_folder_browser_factory = NULL; - - if (bonobo_folder_browser_factory != NULL) - return; - - bonobo_folder_browser_factory = - bonobo_generic_factory_new ( - "GOADID:Evolution:FolderBrowserFactory:1.0", - folder_browser_factory, NULL); - - if (bonobo_folder_browser_factory == NULL){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("We are sorry, Evolution's Folder Browser can not be initialized.")); - exit (1); - } -} diff --git a/mail/folder-browser.c b/mail/folder-browser.c deleted file mode 100644 index 85a09395a8..0000000000 --- a/mail/folder-browser.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * folder-browser.c: Folder browser top level component - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ - -#include -#include -#include "e-util/e-util.h" -#include "camel/camel-exception.h" -#include "folder-browser.h" -#include "session.h" - -#define PARENT_TYPE (gtk_table_get_type ()) - -static GtkObjectClass *folder_browser_parent_class; - -#define PROPERTY_FOLDER_URI "folder_uri" -#define PROPERTY_MESSAGE_PREVIEW "message_preview" - -static void -folder_browser_destroy (GtkObject *object) -{ - FolderBrowser *folder_browser = FOLDER_BROWSER (object); - - if (folder_browser->uri) - g_free (folder_browser->uri); - - if (folder_browser->folder) - gtk_object_unref (GTK_OBJECT (folder_browser->folder)); - - if (folder_browser->message_list) - bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list)); - - folder_browser_parent_class->destroy (object); -} - -static void -folder_browser_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = folder_browser_destroy; - - folder_browser_parent_class = gtk_type_class (PARENT_TYPE); -} - -static gboolean -folder_browser_load_folder (FolderBrowser *fb, const char *name) -{ - CamelFolder *new_folder; - CamelException *ex; - - ex = camel_exception_new (); - new_folder = camel_store_get_folder (default_session->store, name, ex); - - if (camel_exception_get_id (ex)){ - camel_exception_free (ex); - return FALSE; - } - camel_exception_free (ex); - - if (fb->folder) - gtk_object_unref (GTK_OBJECT (fb->folder)); - - fb->folder = new_folder; - - camel_folder_exists (new_folder, NULL); - printf ("In folder browser, folder = %p\n", new_folder); - - message_list_set_folder (fb->message_list, new_folder); - - return TRUE; -} - -#define EQUAL(a,b) (strcmp (a,b) == 0) - -void -folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri) -{ - /* FIXME: hardcoded uri */ - if (!folder_browser_load_folder (folder_browser, "inbox")) - return; - - if (folder_browser->uri) - g_free (folder_browser->uri); - - folder_browser->uri = g_strdup (uri); -} - -void -folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview) -{ - if (folder_browser->preview_shown == show_message_preview) - return; - - g_warning ("FIXME: implement me"); -} - -static void -folder_browser_property_changed (BonoboPropertyBag *properties, - const char *name, - const char *type, - gpointer old_value, - gpointer new_value, - gpointer user_data) -{ - FolderBrowser *folder_browser = FOLDER_BROWSER (user_data); - - if (EQUAL (name, PROPERTY_FOLDER_URI)){ - folder_browser_set_uri (folder_browser, new_value); - return; - } else if (EQUAL (name, PROPERTY_MESSAGE_PREVIEW)){ - folder_browser_set_message_preview (folder_browser, *((gboolean *)new_value)); - } -} - -static void -folder_browser_properties_init (FolderBrowser *fb) -{ - fb->properties = bonobo_property_bag_new (); - - bonobo_property_bag_add ( - fb->properties, PROPERTY_FOLDER_URI, "string", - NULL, NULL, _("The URI that the Folder Browser will display"), 0); - bonobo_property_bag_add ( - fb->properties, PROPERTY_MESSAGE_PREVIEW, "boolean", - NULL, NULL, _("Whether a message preview should be shown"), 0); - - gtk_signal_connect (GTK_OBJECT (fb->properties), "value_changed", - folder_browser_property_changed, fb); -} - -static void -folder_browser_gui_init (FolderBrowser *fb) -{ - /* - * The panned container - */ - fb->vpaned = gtk_vpaned_new (); - gtk_widget_show (fb->vpaned); - - gtk_table_attach ( - GTK_TABLE (fb), fb->vpaned, - 0, 1, 0, 2, - GTK_FILL | GTK_EXPAND, - GTK_FILL | GTK_EXPAND, - 0, 0); - - fb->message_list_w = message_list_get_widget (fb->message_list); - gtk_paned_add1 (GTK_PANED (fb->vpaned), fb->message_list_w); - gtk_widget_show (fb->message_list_w); -#if 0 - gtk_paned_add2 (GTK_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display)); - gtk_widget_show (GTK_WIDGET (fb->mail_display)); - gtk_widget_show (GTK_WIDGET (fb)); -#endif -} - -static void -folder_browser_init (GtkObject *object) -{ -} - -static void -my_folder_browser_init (GtkObject *object) -{ - FolderBrowser *fb = FOLDER_BROWSER (object); - - /* - * Setup parent class fields. - */ - GTK_TABLE (fb)->homogeneous = FALSE; - gtk_table_resize (GTK_TABLE (fb), 1, 2); - - /* - * Our instance data - */ - fb->message_list = MESSAGE_LIST (message_list_new ()); - fb->mail_display = MAIL_DISPLAY (mail_display_new ()); - - folder_browser_properties_init (fb); - folder_browser_gui_init (fb); -} - -GtkWidget * -folder_browser_new (void) -{ - FolderBrowser *folder_browser = gtk_type_new (folder_browser_get_type ()); - - my_folder_browser_init (GTK_OBJECT (folder_browser)); - - printf ("Widget started\n"); - return GTK_WIDGET (folder_browser); -} - - -E_MAKE_TYPE (folder_browser, "FolderBrowser", FolderBrowser, folder_browser_class_init, folder_browser_init, PARENT_TYPE); - - diff --git a/mail/folder-browser.h b/mail/folder-browser.h deleted file mode 100644 index f845c9f98b..0000000000 --- a/mail/folder-browser.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _FOLDER_BROWSER_H_ -#define _FOLDER_BROWSER_H_ - -#include -#include "camel/camel-stream.h" -#include -#include "message-list.h" -#include "mail-display.h" - -#define FOLDER_BROWSER_TYPE (folder_browser_get_type ()) -#define FOLDER_BROWSER(o) (GTK_CHECK_CAST ((o), FOLDER_BROWSER_TYPE, FolderBrowser)) -#define FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), FOLDER_BROWSER_TYPE, FolderBrowserClass)) -#define IS_FOLDER_BROWSER(o) (GTK_CHECK_TYPE ((o), FOLDER_BROWSER_TYPE)) -#define IS_FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), FOLDER_BROWSER_TYPE)) - -typedef struct { - GtkTable parent; - - BonoboPropertyBag *properties; - - /* - * The current URI being displayed by the FolderBrowser - */ - char *uri; - CamelFolder *folder; - - MessageList *message_list; - GtkWidget *message_list_w; - MailDisplay *mail_display; - GtkWidget *vpaned; - gboolean preview_shown; -} FolderBrowser; - -typedef struct { - GtkTableClass parent_class; -} FolderBrowserClass; - -GtkType folder_browser_get_type (void); -GtkWidget *folder_browser_new (void); -void folder_browser_set_uri (FolderBrowser *folder_browser, - const char *uri); -void folder_browser_set_message_preview (FolderBrowser *folder_browser, - gboolean show_message_preview); - -#endif /* _FOLDER_BROWSER_H_ */ diff --git a/mail/html-stream.c b/mail/html-stream.c deleted file mode 100644 index d3028dcdcd..0000000000 --- a/mail/html-stream.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * html-stream.c: A CamelStream class that feeds data into a GtkHTML widget - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include "html-stream.h" -#include "e-util/e-util.h" - -#define PARENT_TYPE camel_stream_get_type () - -static GtkObjectClass *html_stream_parent_class; - -/* - * CamelStream::read method - * - * Return 0 bytes read, as this is a write-only stream - */ -static gint -html_stream_read (CamelStream *stream, gchar *buffer, gint n) -{ - return 0; -} - -/* - * CamelStream::write method - * - * Writes @buffer into the HTML widget - */ -static gint -html_stream_write (CamelStream *stream, const gchar *buffer, gint n) -{ - HTMLStream *html_stream = HTML_STREAM (stream); - - gtk_html_write (html_stream->gtk_html, html_stream->gtk_html_stream, buffer, n); - - return n; -} - -/* - * CamelStream::available method - * - * Return 0, as this is only a write-stream - */ -static gint -html_stream_available (CamelStream *stream) -{ - return 0; -} - -/* - * CamelStream::eos method. - * - * We just return TRUE, as this is not a read-stream - */ -static gboolean -html_stream_eos (CamelStream *stream) -{ - return TRUE; -} - -static void -html_stream_close (CamelStream *stream) -{ - HTMLStream *html_stream = HTML_STREAM (stream); - - gtk_html_end (html_stream->gtk_html, html_stream->gtk_html_stream, GTK_HTML_STREAM_OK); -} - -static void -html_stream_destroy (GtkObject *object) -{ -} - -static void -html_stream_class_init (GtkObjectClass *object_class) -{ - CamelStreamClass *stream_class = (CamelStreamClass *) object_class; - - html_stream_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = html_stream_destroy; - - stream_class->read = html_stream_read; - stream_class->write = html_stream_write; - stream_class->available = html_stream_available; - stream_class->eos = html_stream_eos; - stream_class->close = html_stream_close; -} - -CamelStream * -html_stream_new (GtkHTML *html) -{ - HTMLStream *html_stream; - - g_return_val_if_fail (html != NULL, NULL); - g_return_val_if_fail (GTK_IS_HTML (html), NULL); - - html_stream = gtk_type_new (html_stream_get_type ()); - - gtk_object_ref (GTK_OBJECT (html)); - - html_stream->gtk_html_stream = gtk_html_begin (html, ""); - - html_stream->gtk_html = html; - - return CAMEL_STREAM (html_stream); -} - -E_MAKE_TYPE (html_stream, "HTMLStream", HTMLStream, html_stream_class_init, NULL, PARENT_TYPE); - - diff --git a/mail/html-stream.h b/mail/html-stream.h deleted file mode 100644 index ffa0f4751c..0000000000 --- a/mail/html-stream.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _HTML_STREAM_H_ -#define _HTML_STREAM_H_ 1 - -#include -#include "camel/camel-stream.h" - -#define HTML_STREAM_TYPE (html_stream_get_type ()) -#define HTML_STREAM(obj) (GTK_CHECK_CAST((obj), HTML_STREAM_TYPE, HTMLStream)) -#define HTML_STREAM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), HTML_STREAM_TYPE, HTMLStreamClass)) -#define IS_HTML_STREAM(o) (GTK_CHECK_TYPE((o), HTML_STREAM_TYPE)) - -typedef struct { - CamelStream parent_object; - GtkHTML *gtk_html; - GtkHTMLStreamHandle *gtk_html_stream; -} HTMLStream; - -typedef struct { - CamelStreamClass parent_class; -} HTMLStreamClass; - - -GtkType html_stream_get_type (void); -CamelStream *html_stream_new (GtkHTML *html); - -#endif /* _HTML_STREAM_H_ */ diff --git a/mail/mail-component.c b/mail/mail-component.c deleted file mode 100644 index d1fca42e65..0000000000 --- a/mail/mail-component.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * mail-component.c: The core of the mail component - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include "e-util/e-gui-utils.h" - -CORBA_Environment ev; -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - gnome_CORBA_init_with_popt_table ( - "evolution-mail-component", "1.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Mail Component: I could not initialize Bonobo")); - exit (1); - } -} - -static void -main (int argc, char *argv []) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - CORBA_exception_init (&ev); - - init_bonobo (argc, argv); - - mail_display_factory_init (); - - bonobo_main (); - - return 0; -} diff --git a/mail/mail-display.c b/mail/mail-display.c deleted file mode 100644 index 7b0246b31c..0000000000 --- a/mail/mail-display.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * mail-display.c: Mail display widget - * - * Author: - * Miguel de Icaza - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include "e-util/e-util.h" -#include "mail-display.h" -#include "html-stream.h" - -#define PARENT_TYPE (gtk_table_get_type ()) - -static GtkObjectClass *mail_display_parent_class; - -static void -mail_display_init (GtkObject *object) -{ - MailDisplay *mail_display = MAIL_DISPLAY (object); - - mail_display->html = (GtkHTML *) gtk_html_new (); - gtk_widget_show (GTK_WIDGET (mail_display->html)); -} - -static void -mail_display_destroy (GtkObject *object) -{ - MailDisplay *mail_display = MAIL_DISPLAY (object); - - mail_display_parent_class->destroy (object); -} - -static void -mail_display_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = mail_display_destroy; - mail_display_parent_class = gtk_type_class (PARENT_TYPE); -} - -GtkWidget * -mail_display_new (void) -{ - MailDisplay *mail_display = gtk_type_new (mail_display_get_type ()); - GtkTable *table = GTK_TABLE (mail_display); - - table->homogeneous = FALSE; - gtk_table_resize (table, 1, 2); - - gtk_table_attach (table, GTK_WIDGET (mail_display->html), - 0, 1, 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - return GTK_WIDGET (mail_display); -} - -CamelStream * -mail_display_get_stream (MailDisplay *mail_display) -{ - g_return_val_if_fail (mail_display != NULL, NULL); - g_return_val_if_fail (IS_MAIL_DISPLAY (mail_display), NULL); - - return html_stream_new (mail_display->html); -} - -E_MAKE_TYPE (mail_display, "MailDisplay", MailDisplay, mail_display_class_init, mail_display_init, PARENT_TYPE); - - diff --git a/mail/mail-display.h b/mail/mail-display.h deleted file mode 100644 index cb74d5c390..0000000000 --- a/mail/mail-display.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _MAIL_DISPLAY_H_ -#define _MAIL_DISPLAY_H_ - -#include -#include -#include "camel/camel-stream.h" - -#define MAIL_DISPLAY_TYPE (mail_display_get_type ()) -#define MAIL_DISPLAY(o) (GTK_CHECK_CAST ((o), MAIL_DISPLAY_TYPE, MailDisplay)) -#define MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_DISPLAY_TYPE, MailDisplayClass)) -#define IS_MAIL_DISPLAY(o) (GTK_CHECK_TYPE ((o), MAIL_DISPLAY_TYPE)) -#define IS_MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_DISPLAY_TYPE)) - -typedef struct { - GtkTable parent; - - GtkHTML *html; -} MailDisplay; - -typedef struct { - GtkTableClass parent_class; -} MailDisplayClass; - -GtkType mail_display_get_type (void); -GtkWidget *mail_display_new (void); - -CamelStream *mail_display_get_stream (MailDisplay *display); - -#endif /* _MAIL_DISPLAY_H_ */ diff --git a/mail/main.c b/mail/main.c deleted file mode 100644 index 2dceb6644e..0000000000 --- a/mail/main.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * mail-component.c: The core of the mail component - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include -#include "e-util/e-gui-utils.h" -#include "main.h" - -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - gnome_CORBA_init_with_popt_table ( - "evolution-mail-component", "1.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Mail Component: I could not initialize Bonobo")); - exit (1); - } - - CORBA_exception_free (&ev); -} - -int -main (int argc, char *argv []) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - init_bonobo (argc, argv); - - session_init (); - - folder_browser_factory_init (); - - bonobo_main (); - - return 0; -} - - - - diff --git a/mail/main.h b/mail/main.h deleted file mode 100644 index 2cb17b5e10..0000000000 --- a/mail/main.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _MAIL_MAIN_H_ -#define _MAIL_MAIN_H_ - -void folder_browser_factory_init (void); - -#endif /* _MAIL_MAIN_H_ */ diff --git a/mail/message-list.c b/mail/message-list.c deleted file mode 100644 index 6983b4ac78..0000000000 --- a/mail/message-list.c +++ /dev/null @@ -1,545 +0,0 @@ -/* - * message-list.c: Displays the messages. - * Implements CORBA's Evolution::MessageList - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include "e-util/e-util.h" -#include "camel/camel-exception.h" -#include "message-list.h" -#include "Mail.h" -#include "widgets/e-table/e-table-header-item.h" -#include "widgets/e-table/e-table-item.h" - -/* - * Default sizes for the ETable display - * - */ -#define N_CHARS(x) (CHAR_WIDTH * (x)) - -#define COL_ICON_WIDTH 16 -#define COL_FROM_WIDTH N_CHARS(24) -#define COL_FROM_WIDTH_MIN 32 -#define COL_SUBJECT_WIDTH N_CHARS(30) -#define COL_SUBJECT_WIDTH_MIN 32 -#define COL_SENT_WIDTH N_CHARS(20) -#define COL_SENT_WIDTH_MIN 32 -#define COL_RECEIVE_WIDTH N_CHARS(20) -#define COL_RECEIVE_WIDTH_MIN 32 -#define COL_TO_WIDTH N_CHARS(24) -#define COL_TO_WIDTH_MIN 32 -#define COL_SIZE_WIDTH N_CHARS(6) -#define COL_SIZE_WIDTH_MIN 32 - -#define PARENT_TYPE (bonobo_object_get_type ()) - -static BonoboObjectClass *message_list_parent_class; -static POA_Evolution_MessageList__vepv evolution_message_list_vepv; - -/* - * SimpleTableModel::col_count - */ -static int -ml_col_count (ETableModel *etm, void *data) -{ - return COL_LAST; -} - -/* - * SimpleTableModel::row_count - */ -static int -ml_row_count (ETableModel *etm, void *data) -{ - MessageList *message_list = data; - CamelException *ex; - int v; - - if (!message_list->folder) - return 0; - - ex = camel_exception_new (); - v = camel_folder_get_message_count (message_list->folder, ex); - camel_exception_free (ex); - - return v; -} - -static void * -ml_value_at (ETableModel *etm, int col, int row, void *data) -{ - static char buffer [10]; - - - switch (col){ - case COL_ONLINE_STATUS: - return GINT_TO_POINTER (0); - - case COL_MESSAGE_STATUS: - return GINT_TO_POINTER (1); - - case COL_PRIORITY: - return GINT_TO_POINTER (1); - - case COL_ATTACHMENT: - return GINT_TO_POINTER (0); - - case COL_FROM: - return "miguel@dudical.com"; - - case COL_SUBJECT: - return "MONEY FAST!"; - - case COL_SENT: - return "sent"; - - case COL_RECEIVE: - return "receive"; - - case COL_TO: - return "dudes@server"; - - case COL_SIZE: - sprintf (buffer, "%d", 20); - return buffer; - - default: - g_assert_not_reached (); - } - return NULL; -} - -static void -ml_set_value_at (ETableModel *etm, int col, int row, const void *value, void *data) -{ -} - -static gboolean -ml_is_cell_editable (ETableModel *etm, int col, int row, void *data) -{ - return FALSE; -} - -static void * -ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data) -{ - return value; -} - -static void -ml_free_value (ETableModel *etm, int col, void *value, void *data) -{ -} - -static void -ml_thaw (ETableModel *etm, void *data) -{ - e_table_model_changed(etm); -} - -static void -message_list_init_renderers (MessageList *message_list) -{ - g_assert (message_list); - g_assert (message_list->table_model); - - message_list->render_text = e_cell_text_new ( - message_list->table_model, - NULL, GTK_JUSTIFY_LEFT, FALSE); - - message_list->render_online_status = e_cell_checkbox_new (); - message_list->render_message_status = e_cell_checkbox_new (); - message_list->render_attachment = e_cell_checkbox_new (); - - /* - * FIXME: We need a real renderer here - */ - message_list->render_priority = e_cell_checkbox_new (); -} - -#define CHAR_WIDTH 10 -static void -message_list_init_header (MessageList *message_list) -{ - int i; - - /* - * FIXME: - * - * Use the font metric to compute this. - */ - - message_list->header_model = e_table_header_new (); - - message_list->table_cols [COL_ONLINE_STATUS] = - e_table_col_new (COL_ONLINE_STATUS, _("Online status"), - COL_ICON_WIDTH, COL_ICON_WIDTH, - message_list->render_online_status, - g_int_equal, FALSE); - - message_list->table_cols [COL_MESSAGE_STATUS] = - e_table_col_new (COL_MESSAGE_STATUS, _("Message status"), - COL_ICON_WIDTH, COL_ICON_WIDTH, - message_list->render_message_status, - g_int_equal, FALSE); - - message_list->table_cols [COL_PRIORITY] = - e_table_col_new (COL_PRIORITY, _("Priority"), - COL_ICON_WIDTH, COL_ICON_WIDTH, - message_list->render_priority, - g_int_equal, FALSE); - - message_list->table_cols [COL_ATTACHMENT] = - e_table_col_new (COL_ATTACHMENT, _("Attachment"), - COL_ICON_WIDTH, COL_ICON_WIDTH, - message_list->render_attachment, - g_int_equal, FALSE); - - message_list->table_cols [COL_FROM] = - e_table_col_new (COL_FROM, _("From"), - COL_FROM_WIDTH, COL_FROM_WIDTH_MIN, - message_list->render_text, - g_str_equal, TRUE); - - message_list->table_cols [COL_SUBJECT] = - e_table_col_new (COL_SUBJECT, _("Subject"), - COL_SUBJECT_WIDTH, COL_SUBJECT_WIDTH_MIN, - message_list->render_text, - g_str_equal, TRUE); - - message_list->table_cols [COL_SENT] = - e_table_col_new (COL_SENT, _("Sent"), - COL_SUBJECT_WIDTH, COL_SENT_WIDTH_MIN, - message_list->render_text, - g_str_equal, TRUE); - - message_list->table_cols [COL_RECEIVE] = - e_table_col_new (COL_SENT, _("Receive"), - COL_RECEIVE_WIDTH, COL_RECEIVE_WIDTH_MIN, - message_list->render_text, - g_str_equal, TRUE); - message_list->table_cols [COL_TO] = - e_table_col_new (COL_TO, _("To"), - COL_TO_WIDTH, COL_TO_WIDTH_MIN, - message_list->render_text, - g_str_equal, TRUE); - - message_list->table_cols [COL_SIZE] = - e_table_col_new (COL_SIZE, _("Size"), - COL_SIZE_WIDTH, COL_SIZE_WIDTH_MIN, - message_list->render_text, - g_str_equal, TRUE); - - /* - * Dummy init: It setups the headers to match the order in which - * they are defined. In the future e-table widget will take care - * of this. - */ - for (i = 0; i < COL_LAST; i++) - e_table_header_add_column (message_list->header_model, - message_list->table_cols [i], i); -} - -static void -set_header_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - printf ("Here\n"); - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -static void -set_content_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - printf ("Here2\n"); - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -static GtkWidget * -make_etable (MessageList *message_list) -{ - GtkTable *t; - GtkWidget *header, *content; - - t = (GtkTable *) gtk_table_new (0, 0, 0); - gtk_widget_show (GTK_WIDGET (t)); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - header = gnome_canvas_new (); - gtk_signal_connect (GTK_OBJECT (header), "size_allocate", - GTK_SIGNAL_FUNC (set_header_size), NULL); - gtk_widget_set_usize (header, 300, 20); - gtk_widget_show (header); - content = gnome_canvas_new (); - gtk_widget_set_usize (content, 300, 20); - gtk_signal_connect (GTK_OBJECT (content), "size_allocate", - GTK_SIGNAL_FUNC (set_content_size), NULL); - gtk_widget_show (content); - - gtk_widget_pop_colormap (); - gtk_widget_pop_visual (); - - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (header)), - e_table_header_item_get_type (), - "ETableHeader", message_list->header_model, - NULL); - - gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (content)), - e_table_item_get_type (), - "ETableHeader", message_list->header_model, - "ETableModel", message_list->table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); - - gtk_table_attach (t, header, - 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); - - gtk_table_attach (t, content, - 0, 1, 1, 2, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0); - - - return t; -} - -/* - * GtkObject::init - */ -static void -message_list_init (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - - message_list->table_model = e_table_simple_new ( - ml_col_count, ml_row_count, ml_value_at, - ml_set_value_at, ml_is_cell_editable, ml_duplicate_value, ml_free_value, - ml_thaw, message_list); - - message_list_init_renderers (message_list); - message_list_init_header (message_list); - - /* - * The etable - */ - - message_list->etable = make_etable (message_list); - - /* - * We do own the Etable, not some widget container - */ - gtk_object_ref (GTK_OBJECT (message_list->etable)); - gtk_object_sink (GTK_OBJECT (message_list->etable)); -} - -static void -message_list_destroy (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - int i; - - gtk_object_unref (GTK_OBJECT (message_list->table_model)); - gtk_object_unref (GTK_OBJECT (message_list->header_model)); - - /* - * Renderers - */ - gtk_object_unref (GTK_OBJECT (message_list->render_text)); - gtk_object_unref (GTK_OBJECT (message_list->render_online_status)); - gtk_object_unref (GTK_OBJECT (message_list->render_message_status)); - gtk_object_unref (GTK_OBJECT (message_list->render_priority)); - gtk_object_unref (GTK_OBJECT (message_list->render_attachment)); - - gtk_object_unref (GTK_OBJECT (message_list->etable)); - - for (i = 0; i < COL_LAST; i++) - gtk_object_unref (GTK_OBJECT (message_list->table_cols [i])); - - GTK_OBJECT_CLASS (message_list_parent_class)->destroy (object); -} - -/* - * CORBA method: Evolution::MessageList::select_message - */ -static void -MessageList_select_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: select message method\n"); -} - -/* - * CORBA method: Evolution::MessageList::open_message - */ -static void -MessageList_open_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: open message method\n"); -} - -static POA_Evolution_MessageList__epv * -evolution_message_list_get_epv (void) -{ - POA_Evolution_MessageList__epv *epv; - - epv = g_new0 (POA_Evolution_MessageList__epv, 1); - - epv->select_message = MessageList_select_message; - epv->open_message = MessageList_open_message; - - return epv; -} - -static void -message_list_corba_class_init (void) -{ - evolution_message_list_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - evolution_message_list_vepv.Evolution_MessageList_epv = evolution_message_list_get_epv (); -} - -/* - * GtkObjectClass::init - */ -static void -message_list_class_init (GtkObjectClass *object_class) -{ - message_list_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = message_list_destroy; - - message_list_corba_class_init (); -} - -static void -message_list_construct (MessageList *message_list, Evolution_MessageList corba_message_list) -{ - bonobo_object_construct (BONOBO_OBJECT (message_list), corba_message_list); -} - -static Evolution_MessageList -create_corba_message_list (BonoboObject *object) -{ - POA_Evolution_MessageList *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_MessageList *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &evolution_message_list_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_MessageList__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_MessageList) bonobo_object_activate_servant (object, servant); -} - -BonoboObject * -message_list_new (void) -{ - Evolution_MessageList corba_object; - MessageList *message_list; - - message_list = gtk_type_new (message_list_get_type ()); - - corba_object = create_corba_message_list (BONOBO_OBJECT (message_list)); - if (corba_object == CORBA_OBJECT_NIL){ - gtk_object_destroy (GTK_OBJECT (message_list)); - return NULL; - } - - message_list_construct (message_list, corba_object); - - return BONOBO_OBJECT (message_list); -} - -void -message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) -{ - CamelException ex; - gboolean folder_exists; - - g_return_if_fail (message_list != NULL); - g_return_if_fail (camel_folder != NULL); - g_return_if_fail (IS_MESSAGE_LIST (message_list)); - g_return_if_fail (CAMEL_IS_FOLDER (camel_folder)); - g_return_if_fail (camel_folder_has_summary_capability (camel_folder)); - - - camel_exception_init (&ex); - - if (message_list->folder) - gtk_object_unref (GTK_OBJECT (message_list->folder)); - - message_list->folder = camel_folder; - - folder_exists = camel_folder_exists (camel_folder, NULL); - - if (camel_exception_get_id (&ex)) { - printf ("Unable to test for folder existence: %s\n", - ex.desc?ex.desc:"unknown reason"); - return; - } - - if (!folder_exists) { - g_warning ("Folder does not exist, creating it\n"); - /* - if you don't want the directory to be created - automatically here remove this. - */ - camel_folder_create (camel_folder, &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to create folder: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - - } - - - camel_folder_open (camel_folder, FOLDER_OPEN_RW, &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to open folder: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - - message_list->folder_summary = - camel_folder_get_summary (camel_folder, &ex); - - if (camel_exception_get_id (&ex)) { - printf ("Unable to get summary: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - - - gtk_object_ref (GTK_OBJECT (camel_folder)); - - printf ("Modelo cambio!\n"); - e_table_model_changed (message_list->table_model); -} - -GtkWidget * -message_list_get_widget (MessageList *message_list) -{ - return message_list->etable; -} - -E_MAKE_TYPE (message_list, "MessageList", MessageList, message_list_class_init, message_list_init, PARENT_TYPE); diff --git a/mail/message-list.h b/mail/message-list.h deleted file mode 100644 index 40cc924e24..0000000000 --- a/mail/message-list.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _MESSAGE_LIST_H_ -#define _MESSAGE_LIST_H_ - -#include -#include -#include "camel/camel-folder.h" -#include "e-table/e-table.h" -#include "e-table/e-table-simple.h" -#include "e-table/e-cell-text.h" -#include "e-table/e-cell-toggle.h" -#include "e-table/e-cell-checkbox.h" - -#define MESSAGE_LIST_TYPE (message_list_get_type ()) -#define MESSAGE_LIST(o) (GTK_CHECK_CAST ((o), MESSAGE_LIST_TYPE, MessageList)) -#define MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MESSAGE_LIST_TYPE, MessageListClass)) -#define IS_MESSAGE_LIST(o) (GTK_CHECK_TYPE ((o), MESSAGE_LIST_TYPE)) -#define IS_MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_LIST_TYPE)) - -typedef struct _Renderer Renderer; - -enum { - COL_ONLINE_STATUS, - COL_MESSAGE_STATUS, - COL_PRIORITY, - COL_ATTACHMENT, - COL_FROM, - COL_SUBJECT, - COL_SENT, - COL_RECEIVE, - COL_TO, - COL_SIZE, - - COL_LAST -}; - -typedef struct { - BonoboObject parent; - - ETableModel *table_model; - ETableHeader *header_model; - ETableCol *table_cols [COL_LAST]; - - ECell *render_text; - ECell *render_online_status; - ECell *render_message_status; - ECell *render_priority; - ECell *render_attachment; - - GtkWidget *etable; - - CamelFolder *folder; - CamelFolderSummary *folder_summary; -} MessageList; - -typedef struct { - BonoboObjectClass parent_class; -} MessageListClass; - -GtkType message_list_get_type (void); -BonoboObject *message_list_new (void); -void message_list_set_folder (MessageList *message_list, - CamelFolder *camel_folder); -GtkWidget *message_list_get_widget (MessageList *message_list); - -#endif /* _MESSAGE_LIST_H_ */ diff --git a/mail/session.c b/mail/session.c deleted file mode 100644 index a97b70ed26..0000000000 --- a/mail/session.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * session.c: handles the session infomration and resource manipulation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 2000 Helix Code, Inc. http://www.helixcode.com - */ -#include -#include -#include "session.h" -#include "e-util/e-setup.h" -#include "camel/camel.h" - -SessionStore *default_session; - -static void -request_callback (gchar *string, gpointer data) -{ - char **ans = data; - - if (string) - *ans = g_strdup(string); - else - *ans = NULL; -} - -static char * -evolution_auth_callback (char *prompt, gboolean secret, - CamelService *service, char *item, - CamelException *ex) -{ - GtkWidget *dialog; - char *ans; - - /* XXX look up stored passwords */ - - /* XXX parent window? */ - dialog = gnome_request_dialog (secret, prompt, NULL, 0, - request_callback, &ans, NULL); - if (!dialog) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - "Could not create dialog box."); - return NULL; - } - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 || - ans == NULL) { - camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, - "User cancelled query."); - return NULL; - } - - return ans; -} - -static void -session_providers_init (void) -{ - camel_provider_register_as_module (CAMEL_PROVIDERDIR "/libcamelmbox.so"); -} - -SessionStore * -session_store_new (const char *uri) -{ - SessionStore *ss = g_new (SessionStore, 1); - CamelException *ex; - - ss->session = camel_session_new (evolution_auth_callback); - ex = camel_exception_new (); - ss->store = camel_session_get_store (ss->session, uri, ex); - camel_exception_free (ex); - - g_assert (ss->session); - g_assert (ss->store); - - return ss; -} - -void -session_store_destroy (SessionStore *ss) -{ - g_assert (ss != NULL); - - gtk_object_unref (GTK_OBJECT (ss->store)); - gtk_object_unref (GTK_OBJECT (ss->session)); - - g_free (ss); -} - -static void -init_default_session (void) -{ - char *url; - - url = g_strconcat ("mbox://", evolution_folders_dir, NULL); - default_session = session_store_new (url); - g_free (url); -} - -void -session_init (void) -{ - e_setup_base_dir (); - camel_init (); - session_providers_init (); - - init_default_session (); -} - - diff --git a/mail/session.h b/mail/session.h deleted file mode 100644 index 8b870f0383..0000000000 --- a/mail/session.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef EVOLUTION_MAIL_SESSION_H -#define EVOLUTION_MAIL_SESSION_H - -#include -#include -typedef struct { - CamelSession *session; - CamelStore *store; -} SessionStore; - -SessionStore *session_store_new (const char *uri); -void session_store_destroy (SessionStore *ss); -void session_init (void); - -extern SessionStore *default_session; - -#endif /* EVOLUTION_MAIL_SESSION_H */ diff --git a/mail/test-mail.c b/mail/test-mail.c deleted file mode 100644 index 1f8b217ce5..0000000000 --- a/mail/test-mail.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Tests the mail summary display bonobo component - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include - -static void -create_container (void) -{ - GtkWidget *window, *control; - BonoboUIHandler *uih; - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_show (window); - - uih = bonobo_ui_handler_new (); - control = bonobo_widget_new_control ("GOADID:Evolution:FolderBrowser:1.0", - bonobo_object_corba_objref (BONOBO_OBJECT (uih))); - - if (control == NULL){ - printf ("Could not launch mail control\n"); - exit (1); - } - gtk_container_add (GTK_CONTAINER (window), control); - - gtk_widget_show (window); - gtk_widget_show (control); -} - -int -main (int argc, char *argv []) -{ - CORBA_Environment ev; - CORBA_ORB orb; - - CORBA_exception_init (&ev); - - gnome_CORBA_init ("sample-control-container", "1.0", &argc, argv, 0, &ev); - - CORBA_exception_free (&ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) - g_error ("Could not initialize Bonobo\n"); - - bonobo_activate (); - - create_container (); - - /* - * Main loop - */ - gtk_main (); - - return 0; -} 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 - - * pt.po: Added Portuguese translation. - -1996-06-12 Tristan Tarrant - - * it.po : Italian translations added diff --git a/po/POTFILES.in b/po/POTFILES.in deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/shell/.cvsignore b/shell/.cvsignore deleted file mode 100644 index 0f718dcf79..0000000000 --- a/shell/.cvsignore +++ /dev/null @@ -1,13 +0,0 @@ -.deps -.libs -Shell-stubs.c -Shell-skels.c -Shell-common.c -Shell.h -evolution -Makefile.in -Makefile -Evolution-stubs.c -Evolution-skels.c -Evolution-common.c -Evolution.h \ No newline at end of file diff --git a/shell/Evolution.idl b/shell/Evolution.idl deleted file mode 100644 index 51b083c5d7..0000000000 --- a/shell/Evolution.idl +++ /dev/null @@ -1,28 +0,0 @@ -/* - * CORBA interface for the Evolution shell - * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include - -module Evolution { - interface Shell : Bonobo::Unknown { - enum NewType { - APPOINTMENT, - MEETING_REQUEST, - TASK, - TASK_REQUEST, - CONTACT, - MAIL_MESSAGE, - DISTRIBUTION_LIST, - JOURNAL_ENTRY, - NOTE - }; - - void new (in NewType type); - }; -}; - diff --git a/shell/Makefile.am b/shell/Makefile.am deleted file mode 100644 index dc568fc2bd..0000000000 --- a/shell/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ - -bin_PROGRAMS = evolution - -INCLUDES = \ - $(BONOBO_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -I$(srcdir)/../widgets - - -EVOLUTION_CORBA_GENERATED = \ - Evolution.h \ - Evolution-common.c \ - Evolution-skels.c \ - Evolution-stubs.c - -evolution_SOURCES = \ - $(EVOLUTION_CORBA_GENERATED) \ - main.c \ - e-folder.c \ - e-folder.h \ - e-init.c \ - e-init.h \ - e-shell.c \ - e-shell.h \ - e-shell-shortcut.c \ - e-shell-shortcut.h \ - e-shell-view.c \ - e-shell-view.h \ - e-shell-view-menu.c \ - e-shell-view-menu.h \ - e-shortcut.c \ - e-shortcut.h - -Evolution-impl.o: Evolution.h - -$(EVOLUTION_CORBA_GENERATED): Evolution.idl - orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Evolution.idl - -evolution_LDADD = \ - ../widgets/shortcut-bar/libshortcut-bar.a \ - ../widgets/e-text/libetext.a \ - ../e-util/libeutil.a \ - $(BONOBO_GNOME_LIBS) - -EXTRA_DIST = Evolution.idl diff --git a/shell/Shell.idl b/shell/Shell.idl deleted file mode 100644 index 0d615b6b3b..0000000000 --- a/shell/Shell.idl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * CORBA interface for the Evolution shell - * - * Authors: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include - -module GNOME { - - module Evolution { - - interface Shell : GNOME::Unknown { - - }; - }; -}; diff --git a/shell/e-folder-mail.c b/shell/e-folder-mail.c deleted file mode 100644 index 9765b7d946..0000000000 --- a/shell/e-folder-mail.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * e-folder-mail.c: Mail folder - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include -#include "e-util/e-util.h" -#include "e-folder-mail.h" - -#define PARENT_TYPE e_folder_get_type () - -static void -e_folder_mail_init (GtkObject *object) -{ -} - -E_MAKE_TYPE (e_folder_mail, "EFolderMail", EFolderMail, e_folder_mail_class_init, e_folder_mail_init, PARENT_TYPE) - -EFolder * -e_folder_mail_new (const char *uri, const char *name, const char *desc, - const char *home_page, const char *view_name) -{ - EFolderMail *efm = gtk_type_new (e_folder_mail_get_type ()); - - e_folder_construct (E_FOLDER (efm), E_FOLDER_MAIL, uri, name, desc, home_page, view_name); - - return E_FOLDER (efm); -} - - diff --git a/shell/e-folder-mail.h b/shell/e-folder-mail.h deleted file mode 100644 index 76098c6182..0000000000 --- a/shell/e-folder-mail.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _E_FOLDER_MAIL_H_ -#define _E_FOLDER_MAIL_H_ - -#include "e-folder.h" - -#define E_FOLDER_MAIL_TYPE (e_folder_mail_get_type ()) -#define E_FOLDER_MAIL(o) (GTK_CHECK_CAST ((o), E_FOLDER_MAIL_TYPE, EFolderMail)) -#define E_FOLDER_MAIL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_FOLDER_MAIL_TYPE, EFolderMailClass)) -#define E_IS_FOLDER_MAIL(o) (GTK_CHECK_TYPE ((o), E_FOLDER_MAIL_TYPE)) -#define E_IS_FOLDER_MAIL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_FOLDER_MAIL_TYPE)) - -typedef struct { - EFolder parent; -} EFolderMail; - -typedef struct { - EFolderClass parent; -} EFolderMailClass; - -GtkType e_folder_mail_get_type (void); -EFolder *e_folder_mail_new (const char *uri, const char *name, const char *desc, - const char *home_page, const char *view_name); - -#endif /* _E_FOLDER_MAIL_H_ */ - - - - diff --git a/shell/e-folder.c b/shell/e-folder.c deleted file mode 100644 index 8a7d5dfe6b..0000000000 --- a/shell/e-folder.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * e-folder.c: Abstract class for Evolution folders - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include "e-util/e-util.h" -#include "e-folder.h" - -#define PARENT_TYPE gtk_object_get_type () - -static GtkObjectClass *parent_class; - -#define EFC(o) E_FOLDER_CLASS (GTK_OBJECT (o)->klass) - -enum { - CHANGED, - LAST_SIGNAL -}; -static guint efolder_signals [LAST_SIGNAL] = { 0, }; - -static void -e_folder_destroy (GtkObject *object) -{ - EFolder *efolder = E_FOLDER (object); - - if (efolder->uri) - g_free (efolder->uri); - - if (efolder->desc) - g_free (efolder->desc); - - if (efolder->home_page) - g_free (efolder->home_page); - - parent_class->destroy (object); -} - -static void -e_folder_class_init (GtkObjectClass *object_class) -{ - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = e_folder_destroy; - - efolder_signals [CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EFolderClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, - 0); - /* Register our signals */ - gtk_object_class_add_signals ( - object_class, efolder_signals, LAST_SIGNAL); -} - -static void -e_folder_init (GtkObject *object) -{ -} - -E_MAKE_TYPE (e_folder, "EFolder", EFolder, e_folder_class_init, e_folder_init, PARENT_TYPE) - -void -e_folder_set_uri (EFolder *efolder, const char *uri) -{ - g_return_if_fail (efolder != NULL); - g_return_if_fail (E_IS_FOLDER (efolder)); - g_return_if_fail (uri != NULL); - - if (efolder->uri) - g_free (efolder->uri); - - efolder->uri = g_strdup (uri); -} - -const char * -e_folder_get_uri (EFolder *efolder) -{ - g_return_val_if_fail (efolder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); - - return efolder->uri; -} - -void -e_folder_set_description (EFolder *efolder, const char *desc) -{ - g_return_if_fail (efolder != NULL); - g_return_if_fail (E_IS_FOLDER (efolder)); - g_return_if_fail (desc != NULL); - - if (efolder->desc) - g_free (efolder->desc); - - efolder->desc = g_strdup (desc); -} - -const char * -e_folder_get_description (EFolder *efolder) -{ - g_return_val_if_fail (efolder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); - - return efolder->desc; -} - -void -e_folder_set_home_page (EFolder *efolder, const char *home_page) -{ - g_return_if_fail (efolder != NULL); - g_return_if_fail (E_IS_FOLDER (efolder)); - g_return_if_fail (home_page != NULL); - - if (efolder->home_page) - g_free (efolder->home_page); - - efolder->home_page = g_strdup (home_page); -} - -const char * -e_folder_get_home_page (EFolder *efolder) -{ - g_return_val_if_fail (efolder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); - - return efolder->home_page; -} - -const char * -e_folder_get_type_name (EFolder *efolder) -{ - g_return_val_if_fail (efolder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); - - switch (efolder->type){ - case E_FOLDER_MAIL: - return _("A folder containing mail items"); - - case E_FOLDER_CONTACTS: - return _("A folder containing contacts"); - - case E_FOLDER_CALENDAR: - return _("A folder containing calendar entries"); - - case E_FOLDER_TASKS: - return _("A folder containing tasks"); - - default: - g_assert_not_reached (); - } - - return NULL; -} - -void -e_folder_construct (EFolder *efolder, EFolderType type, - const char *uri, const char *name, - const char *desc, const char *home_page, - const char *view_name) -{ - g_return_if_fail (efolder != NULL); - g_return_if_fail (E_IS_FOLDER (efolder)); - - /* EFolders are self-owned */ - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (efolder), GTK_FLOATING); - - if (uri) - efolder->uri = g_strdup (uri); - if (name) - efolder->name = g_strdup (name); - if (desc) - efolder->desc = g_strdup (desc); - if (home_page) - efolder->home_page = g_strdup (home_page); - if (view_name) - efolder->view_name = g_strdup (view_name); - - efolder->type = type; -} - -EFolder * -e_folder_new (EFolderType type, - const char *uri, const char *name, - const char *desc, const char *home_page, - const char *view_name) -{ - EFolder *efolder; - - efolder = gtk_type_new (e_folder_get_type ()); - - e_folder_construct (efolder, type, uri, name, desc, home_page, view_name); - return efolder; -} - -const char * -e_folder_get_name (EFolder *efolder) -{ - g_return_val_if_fail (efolder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); - - return efolder->name; -} - -void -e_folder_set_name (EFolder *efolder, const char *name) -{ - g_return_if_fail (efolder != NULL); - g_return_if_fail (E_IS_FOLDER (efolder)); - - if (efolder->name) - g_free (efolder->name); - - efolder->name = g_strdup (name); -} - -const char * -e_folder_get_view_name (EFolder *efolder) -{ - g_return_val_if_fail (efolder != NULL, NULL); - g_return_val_if_fail (E_IS_FOLDER (efolder), NULL); - - return efolder->view_name; -} - -void -e_folder_set_view_name (EFolder *efolder, const char *view_name) -{ - g_return_if_fail (efolder != NULL); - g_return_if_fail (E_IS_FOLDER (efolder)); - - if (efolder->view_name) - g_free (efolder->view_name); - - efolder->view_name = g_strdup (view_name); - - gtk_signal_emit (GTK_OBJECT (efolder), - efolder_signals [CHANGED]); -} diff --git a/shell/e-folder.h b/shell/e-folder.h deleted file mode 100644 index d262859c3d..0000000000 --- a/shell/e-folder.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef _E_FOLDER_H_ -#define _E_FOLDER_H_ - -#include -#include - -#define E_FOLDER_TYPE (e_folder_get_type ()) -#define E_FOLDER(o) (GTK_CHECK_CAST ((o), E_FOLDER_TYPE, EFolder)) -#define E_FOLDER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_FOLDER_TYPE, EFolderClass)) -#define E_IS_FOLDER(o) (GTK_CHECK_TYPE ((o), E_FOLDER_TYPE)) -#define E_IS_FOLDER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_FOLDER_TYPE)) - -typedef enum { - E_FOLDER_DND_AS_FORWARD, - E_FOLDER_DND_AS_MOVE_COPY -} EFolderDragDropAction; - -typedef enum { - E_FOLDER_MAIL, - E_FOLDER_CONTACTS, - E_FOLDER_CALENDAR, - E_FOLDER_TASKS, - E_FOLDER_OTHER -} EFolderType; - -typedef struct { - GtkObject parent_object; - - EFolderType type; - - /* - * General properties - */ - char *uri; /* Location */ - char *name; /* Short name */ - char *desc; /* Full description */ - char *home_page; /* Home page for this folder */ - - /* - * Administration properties - */ - char *view_name; /* View name */ -} EFolder; - -typedef struct { - GtkObjectClass parent_class; - - /* - * Notifies views of visible changes in the Efolder - */ - void (*changed) (EFolder *efolder); -} EFolderClass; - -GtkType e_folder_get_type (void); -void e_folder_construct (EFolder *efolder, EFolderType type, - const char *uri, const char *name, - const char *desc, const char *home_page, - const char *view_name); -EFolder *e_folder_new (EFolderType type, - const char *uri, const char *name, - const char *desc, const char *home_page, - const char *view_name); - -void e_folder_set_uri (EFolder *efolder, const char *uri); -const char *e_folder_get_uri (EFolder *efolder); - -void e_folder_set_description (EFolder *efolder, const char *desc); -const char *e_folder_get_description (EFolder *efolder); - -void e_folder_set_home_page (EFolder *efolder, const char *desc); -const char *e_folder_get_home_page (EFolder *efolder); - -const char *e_folder_get_name (EFolder *efolder); -void e_folder_set_name (EFolder *efolder, const char *name); - -const char *e_folder_get_view_name (EFolder *efolder); -void e_folder_set_view_name (EFolder *efolder, const char *view_name); - -const char *e_folder_get_type_name (EFolder *efolder); - -#endif /* _E_FOLDER_H_ */ - diff --git a/shell/e-init.c b/shell/e-init.c deleted file mode 100644 index 34ccdbcfc3..0000000000 --- a/shell/e-init.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * e-init.c: Initializes Evolution for first time users - * - */ -#include -#include -#include "e-init.h" -#include -#include -#include -#include -#include "e-util/e-gui-utils.h" - -char *evolution_base_dir; - -static void -e_init_local (void) -{ - evolution_base_dir = g_concat_dir_and_file (g_get_home_dir (), "Evolution"); - - if (g_file_exists (evolution_base_dir)) - return; - - if (-1 == mkdir (evolution_base_dir, 0755)){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("Evolution can not create its local folders")); - exit (0); - } -} - -void -e_init (void) -{ - e_init_local (); -} diff --git a/shell/e-init.h b/shell/e-init.h deleted file mode 100644 index 5684f87b44..0000000000 --- a/shell/e-init.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef E_INIT_H -#define E_INIT_H - -extern char *evolution_base_dir; - -void e_init (void); - -#endif /* E_INIT_H */ diff --git a/shell/e-shell-shortcut.c b/shell/e-shell-shortcut.c deleted file mode 100644 index 56671dccd3..0000000000 --- a/shell/e-shell-shortcut.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * e-shell-shortcut.c: Handles events from the shortcut bar widget on the - * e-shell-view - * - * Authors: - * Damon Chaplin (damon@gtk.org) - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999, 2000 Helix Code, Inc. - */ -#include -#include -#include "shortcut-bar/e-shortcut-bar.h" -#include "e-shell-shortcut.h" -#include "e-shell-view.h" - -#define SMALL_ICONS 1 -#define LARGE_ICONS 2 - -typedef struct { - EShellView *eshell_view; - EShortcutGroup *sg; -} closure_group_t; - -static void -set_large_icons (GtkMenuItem *menu_item, closure_group_t *closure) -{ - e_shortcut_group_set_view_type (closure->sg, E_ICON_BAR_LARGE_ICONS); -} - -static void -set_small_icons (GtkMenu *menu_item, closure_group_t *closure) -{ - e_shortcut_group_set_view_type (closure->sg, E_ICON_BAR_SMALL_ICONS); -} - -static void -add_group (GtkMenu *menu, closure_group_t *closure) -{ - int group_num; - GtkWidget *entry; - - group_num = e_shortcut_bar_model_add_group (closure->eshell_view->eshell->shortcut_bar); - - /* - * FIXME: Figure out why this does not quite work - */ - entry = gtk_entry_new (); - gtk_widget_show (entry); - - e_group_bar_set_group_button_label ( - E_GROUP_BAR (closure->eshell_view->shortcut_bar), - group_num, - entry); -} - -static void -remove_group (GtkMenuItem *menu_item, closure_group_t *closure) -{ - e_shortcut_bar_model_remove_group (closure->eshell_view->eshell->shortcut_bar, closure->sg); -} - -static void -do_rename (GtkEntry *entry, EShortcutGroup *sg) -{ - e_shortcut_group_rename (sg, gtk_entry_get_text (entry)); -} - -static void -rename_group (GtkMenuItem *menu_item, closure_group_t *closure) -{ - GtkWidget *entry; - int item; - - item = e_group_num_from_group_ptr (closure->eshell_view->eshell->shortcut_bar, closure->sg); - e_shortcut_group_rename (closure->sg, "Ren Test"); - - return; - - entry = gtk_entry_new (); - gtk_widget_show (entry); - gtk_widget_grab_focus (entry); - - gtk_signal_connect (GTK_OBJECT (entry), "activate", GTK_SIGNAL_FUNC (do_rename), closure->sg); - - e_group_bar_set_group_button_label (E_GROUP_BAR (closure->eshell_view->shortcut_bar), item, entry); -} - -static void -add_shortcut (GtkMenu *menu, closure_group_t *closure) -{ -} - -static struct { - char *label; - int flags; - GtkSignalFunc callback; -} shortcut_menu [] = { - { N_("Large Icons"), SMALL_ICONS, GTK_SIGNAL_FUNC (set_large_icons) }, - { N_("Small Icons"), LARGE_ICONS, GTK_SIGNAL_FUNC (set_small_icons) }, - { NULL, 0, NULL }, - { N_("Add New Group"), 0, GTK_SIGNAL_FUNC (add_group) }, - { N_("Remove Group"), 0, GTK_SIGNAL_FUNC (remove_group) }, - { N_("Rename Group"), 0, GTK_SIGNAL_FUNC (rename_group) }, - { NULL, 0, NULL }, - { N_("Add Shortcut"), 0, GTK_SIGNAL_FUNC (add_shortcut) }, -}; - -#define ELEMENTS(x) (sizeof (x) / sizeof (x[0])) - -static void -shortcut_bar_show_standard_popup (EShellView *eshell_view, GdkEvent *event, EShortcutGroup *shortcut_group) -{ - GtkWidget *menu, *menuitem; - int i; - closure_group_t closure; - - menu = gtk_menu_new (); - - closure.sg = shortcut_group; - closure.eshell_view = eshell_view; - - for (i = 0; i < ELEMENTS (shortcut_menu); i++){ - gboolean disable = FALSE; - - if (shortcut_menu [i].flags & SMALL_ICONS) - if (shortcut_group->type != E_ICON_BAR_SMALL_ICONS) - disable = TRUE; - - if (shortcut_menu [i].flags & LARGE_ICONS) - if (shortcut_group->type != E_ICON_BAR_LARGE_ICONS) - disable = TRUE; - - if (shortcut_menu [i].label == NULL){ - menuitem = gtk_menu_item_new (); - gtk_widget_set_sensitive (menuitem, FALSE); - } else - menuitem = gtk_menu_item_new_with_label (_(shortcut_menu [i].label)); - - if (disable) - gtk_widget_set_sensitive (menuitem, FALSE); - - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - gtk_signal_connect ( - GTK_OBJECT (menuitem), "activate", - shortcut_menu [i].callback, &closure); - } - - gtk_signal_connect (GTK_OBJECT (menu), "deactivate", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, - event->button.button, event->button.time); - - gtk_main (); - - gtk_object_destroy (GTK_OBJECT (menu)); -} - -typedef struct { - EShellView *eshell_view; - EShortcutGroup *sg; - EShortcut *shortcut; -} closure_context_t; - -static void -shortcut_open (GtkMenuItem *menuitem, closure_context_t *closure) -{ - e_shell_view_set_view (closure->eshell_view, closure->shortcut->efolder); -} - -static void -shortcut_open_new_window (GtkMenuItem *menuitem, closure_context_t *closure) -{ - GtkWidget *toplevel; - - toplevel = e_shell_view_new (closure->eshell_view->eshell, closure->shortcut->efolder, FALSE); - gtk_widget_show (toplevel); -} - -static void -shortcut_remove (GtkMenuItem *menuitem, closure_context_t *closure) -{ - e_shortcut_group_remove (closure->sg, closure->shortcut); -} - -static void -shortcut_rename (GtkMenuItem *menuitem, closure_context_t *closure) -{ - printf ("Implement: %s %s\n", __FILE__, __FUNCTION__); -} - -static void -shortcut_properties (GtkMenuItem *menuitem, closure_context_t *closure) -{ - printf ("Implement: %s %s\n", __FILE__, __FUNCTION__); -} - -#define NOT_IMPLEMENTED 1 -static struct { - char *label; - char *stock_id; - int flags; - GtkSignalFunc callback; -} context_shortcut_menu [] = { - { N_("Open Folder"), GNOME_STOCK_MENU_OPEN, 0, GTK_SIGNAL_FUNC (shortcut_open) }, - { N_("Open in New Window"), NULL, 0, GTK_SIGNAL_FUNC (shortcut_open_new_window) }, - { N_("Advanced Find"), NULL, NOT_IMPLEMENTED, NULL }, - { NULL, }, - { N_("Remove From Shortcut Bar"), NULL, 0, GTK_SIGNAL_FUNC (shortcut_remove) }, - { N_("Rename Shortcut"), NULL, 0, GTK_SIGNAL_FUNC (shortcut_rename) }, - { NULL, }, - { N_("Properties"), NULL, 0, GTK_SIGNAL_FUNC (shortcut_properties) }, -}; - -static void -shortcut_bar_show_context_popup (EShellView *eshell_view, GdkEvent *event, - EShortcutGroup *shortcut_group, EShortcut *shortcut) -{ - closure_context_t closure; - GtkWidget *menu, *menuitem; - int i; - gboolean disable; - - menu = gtk_menu_new (); - - closure.eshell_view = eshell_view; - closure.sg = shortcut_group; - closure.shortcut = shortcut; - - for (i = 0; i < ELEMENTS (context_shortcut_menu); i++){ - disable = FALSE; - - if (context_shortcut_menu [i].flags & NOT_IMPLEMENTED) - disable = TRUE; - - if (context_shortcut_menu [i].label == NULL){ - menuitem = gtk_menu_item_new (); - gtk_widget_set_sensitive (menuitem, FALSE); - } else { - GtkWidget *label; - - if (context_shortcut_menu [i].stock_id){ - GtkWidget *stock; - - menuitem = gtk_pixmap_menu_item_new (); - stock = gnome_stock_pixmap_widget ( - menu, - context_shortcut_menu [i].stock_id); - if (stock){ - gtk_widget_show (stock); - gtk_pixmap_menu_item_set_pixmap ( - GTK_PIXMAP_MENU_ITEM (menuitem), stock); - } - } else - menuitem = gtk_menu_item_new (); - - label = gtk_label_new (_(context_shortcut_menu [i].label)); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_show (label); - gtk_container_add (GTK_CONTAINER (menuitem), label); - } - - if (disable) - gtk_widget_set_sensitive (menuitem, FALSE); - - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - gtk_signal_connect ( - GTK_OBJECT (menuitem), "activate", - context_shortcut_menu [i].callback, &closure); - } - - gtk_signal_connect (GTK_OBJECT (menu), "deactivate", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, - event->button.button, event->button.time); - - gtk_main (); - - gtk_object_destroy (GTK_OBJECT (menu)); -} - -void -shortcut_bar_item_selected (EShortcutBar *e_shortcut_bar, - GdkEvent *event, gint group_num, gint item_num, - EShellView *eshell_view) -{ - EShortcut *shortcut; - EShortcutGroup *shortcut_group; - EShortcutBarModel *shortcut_bar = eshell_view->eshell->shortcut_bar; - - shortcut_group = e_shortcut_group_from_pos (shortcut_bar, group_num); - if (shortcut_group == NULL) - return; - - shortcut = e_shortcut_from_pos (shortcut_group, item_num); - - if (shortcut == NULL) - return; - - if (event->button.button == 1) { - e_shell_view_set_view (eshell_view, shortcut->efolder); - } else if (event->button.button == 3) { - - if (shortcut == NULL) - shortcut_bar_show_standard_popup ( - eshell_view, event, shortcut_group); - else - shortcut_bar_show_context_popup ( - eshell_view, event, shortcut_group, shortcut); - } -} - diff --git a/shell/e-shell-shortcut.h b/shell/e-shell-shortcut.h deleted file mode 100644 index 2f526be6ab..0000000000 --- a/shell/e-shell-shortcut.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef E_SHELL_SHORTCUT_H -#define E_SHELL_SHORTCUT_H - -#include "e-shell-view.h" - - -void shortcut_bar_item_selected (EShortcutBar *shortcut_bar, - GdkEvent *event, gint group_num, gint item_num, - EShellView *eshell_view); - -#endif /* E_SHELL_SHORTCUT_H */ diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c deleted file mode 100644 index 8e8231d774..0000000000 --- a/shell/e-shell-view-menu.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * E-shell-view-menu.c: Controls the shell view's menus. - * - * This file provides API entry points for changing and updating - * the menus to reflect the status of Evolution. - * - * Authors: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ - -#include -#include -#include "e-shell-view.h" -#include "e-shell-view-menu.h" - -static void -esv_cmd_new_folder (GtkWidget *widget, EShellView *esv) -{ - e_shell_view_new_folder (esv); -} - -static void -esv_cmd_new_shortcut (GtkWidget *widget, EShellView *esv) -{ - e_shell_view_new_shortcut (esv); -} - -static void -esv_cmd_new_mail_message (GtkWidget *widget, EShellView *esv) -{ - e_shell_new_mail_message (esv->eshell); -} - -static void -esv_cmd_new_meeting_request (GtkWidget *widget, EShellView *esv) -{ - e_shell_new_meeting_request (esv->eshell); -} - -static void -esv_cmd_new_contact (GtkWidget *widget, EShellView *esv) -{ - e_shell_new_contact (esv->eshell); -} - -static void -esv_cmd_new_task (GtkWidget *widget, EShellView *esv) -{ - e_shell_new_task (esv->eshell); -} - -static void -esv_cmd_new_task_request (GtkWidget *widget, EShellView *esv) -{ - e_shell_new_task_request (esv->eshell); -} - -static void -esv_cmd_new_journal_entry (GtkWidget *widget, EShellView *esv) -{ - e_shell_new_journal_entry (esv->eshell); -} - -static void -esv_cmd_new_note (GtkWidget *widget, EShellView *esv) -{ - e_shell_new_note (esv->eshell); -} - -static void -esv_cmd_open_selected_items (GtkWidget *widget, EShellView *esv) -{ - printf ("Unimplemented open selected items\n"); -} - -static void -esv_cmd_save_as (GtkWidget *widget, EShellView *esv) -{ -} - -static void -quit_cmd (GtkWidget *widget, EShellView *esv) -{ - e_shell_quit (esv->eshell); -} - -static void -esv_cmd_close_open_items (GtkWidget *widget, EShellView *esv) -{ - printf ("Unimplemented function"); -} - -/* - * Fixme - * - * This menu is actually pretty dynamic, it changes de values of various entries - * depending on the current data being displayed - * - * This is currently only a placeholder. We need to figure what to do about this. - */ -static GnomeUIInfo esv_menu_file_new [] = { - - { GNOME_APP_UI_ITEM, N_("_Folder"), - NULL, esv_cmd_new_folder, NULL, - NULL, 0, 0, 'e', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - { GNOME_APP_UI_ITEM, N_("Evolution _Bar Shortcut"), - NULL, esv_cmd_new_shortcut, NULL, - NULL, 0, 0, 'e', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - GNOMEUIINFO_SEPARATOR, - - { GNOME_APP_UI_ITEM, N_("_Mail message"), - N_("Composes a new mail message"), esv_cmd_new_mail_message, NULL, - NULL, 0, 0, 'n', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Appointment"), - N_("Composes a new mail message"), esv_cmd_new_mail_message, NULL, - NULL, 0, 0, 'a', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("Meeting Re_quest"), NULL, - esv_cmd_new_meeting_request, NULL, - NULL, 0, 0, 'q', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Contact"), NULL, - esv_cmd_new_contact, NULL, - NULL, 0, 0, 'c', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Task"), NULL, - esv_cmd_new_task, NULL, - NULL, 0, 0, 'k', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("Task _Request"), NULL, - esv_cmd_new_task_request, NULL, - NULL, 0, 0, 'u', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Journal Entry"), NULL, - esv_cmd_new_journal_entry, NULL, - NULL, 0, 0, 'j', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - { GNOME_APP_UI_ITEM, N_("_Note"), NULL, - esv_cmd_new_note, NULL, - NULL, 0, 0, 'o', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu_file_open [] = { - { GNOME_APP_UI_ITEM, N_("_Selected Items"), NULL, - esv_cmd_open_selected_items, NULL, - NULL, 0, 0, 'o', GDK_CONTROL_MASK }, - - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu_folder [] = { - { GNOME_APP_UI_ITEM, N_("_New Folder"), NULL, - esv_cmd_new_folder, NULL, - NULL, 0, 0, 'e', GDK_CONTROL_MASK | GDK_SHIFT_MASK }, - - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu_file [] = { - GNOMEUIINFO_SUBTREE_STOCK (N_("_New"), esv_menu_file_new, GNOME_STOCK_MENU_NEW), - GNOMEUIINFO_SUBTREE_STOCK (N_("_Open"), esv_menu_file_open, GNOME_STOCK_MENU_NEW), - GNOMEUIINFO_ITEM_NONE (N_("Clos_e All Items"), N_("Closes all the open items"), esv_cmd_close_open_items), - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_MENU_SAVE_AS_ITEM (esv_cmd_save_as, NULL), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_SUBTREE (N_("_Folder"), esv_menu_folder), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_MENU_EXIT_ITEM(quit_cmd, NULL), - - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu_edit [] = { - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu_view [] = { - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu_tools [] = { - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu_actions [] = { - GNOMEUIINFO_END -}; - -static GnomeUIInfo esv_menu [] = { - GNOMEUIINFO_MENU_FILE_TREE (esv_menu_file), - GNOMEUIINFO_MENU_EDIT_TREE (esv_menu_edit), - GNOMEUIINFO_MENU_VIEW_TREE (esv_menu_view), - - /* FIXME: add Favorites here */ - - { GNOME_APP_UI_SUBTREE, N_("_Tools"), NULL, esv_menu_tools }, - { GNOME_APP_UI_SUBTREE, N_("_Actions"), NULL, esv_menu_actions }, -#warning Should provide a help menu here; Bonobo needs it - GNOMEUIINFO_END -}; - -/* - * Sets up the menus for the EShellView. - * - * Creates the Bonobo UI Handler, and then loads the menus from our - * GnomeUIInfo definitions - */ -void -e_shell_view_setup_menus (EShellView *eshell_view) -{ - BonoboUIHandlerMenuItem *list; - - eshell_view->uih = bonobo_ui_handler_new (); - bonobo_ui_handler_set_app (eshell_view->uih, GNOME_APP (eshell_view)); - bonobo_ui_handler_create_menubar (eshell_view->uih); - - list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (esv_menu, eshell_view); - bonobo_ui_handler_menu_add_list (eshell_view->uih, "/", list); - bonobo_ui_handler_menu_free_list (list); -} diff --git a/shell/e-shell-view-menu.h b/shell/e-shell-view-menu.h deleted file mode 100644 index f198efb806..0000000000 --- a/shell/e-shell-view-menu.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef E_SHELL_VIEW_MENU_H -#define E_SHELL_VIEW_MENU_H - -void e_shell_view_setup_menus (EShellView *eshell_view); - -#endif /* E_SHELL_VIEW_MENU_H */ diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c deleted file mode 100644 index bdbc34238b..0000000000 --- a/shell/e-shell-view.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * E-shell-view.c: Implements a Shell View of Evolution - * - * Authors: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include "shortcut-bar/e-shortcut-bar.h" -#include "e-util/e-util.h" -#include "e-shell-view.h" -#include "e-shell-view-menu.h" -#include "e-shell-shortcut.h" - -#define PARENT_TYPE gnome_app_get_type () - -static GtkObjectClass *parent_class; - -static void -esv_destroy (GtkObject *object) -{ - EShellView *eshell_view = E_SHELL_VIEW (object); - - e_shell_unregister_view (eshell_view->eshell, eshell_view); - - parent_class->destroy (object); -} - -static void -e_shell_view_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = esv_destroy; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -static void -e_shell_view_setup (EShellView *eshell_view) -{ - /* - * FIXME, should load the config if (load_config).... - */ - gtk_window_set_default_size (GTK_WINDOW (eshell_view), 600, 400); -} - -static void -e_shell_view_setup_shortcut_display (EShellView *eshell_view) -{ - eshell_view->shortcut_bar = e_shortcut_bar_view_new (eshell_view->eshell->shortcut_bar); - - eshell_view->shortcut_hpaned = gtk_hpaned_new (); - gtk_widget_show (eshell_view->shortcut_hpaned); - gtk_paned_set_position (GTK_PANED (eshell_view->shortcut_hpaned), 100); - - gtk_paned_pack1 (GTK_PANED (eshell_view->shortcut_hpaned), - eshell_view->shortcut_bar, FALSE, TRUE); - gtk_widget_show (eshell_view->shortcut_bar); - - gnome_app_set_contents (GNOME_APP (eshell_view), eshell_view->shortcut_hpaned); - - gtk_signal_connect ( - GTK_OBJECT (eshell_view->shortcut_bar), "item_selected", - GTK_SIGNAL_FUNC (shortcut_bar_item_selected), eshell_view); -} - -static GtkWidget * -get_view (EFolder *efolder) -{ - GtkWidget *w; - char buffer [80]; - - sprintf (buffer, "I am the view for %s\n", - e_folder_get_description (efolder)); - - w = gtk_label_new (buffer); - - gtk_widget_show (w); - - return w; -} - -void -e_shell_view_set_view (EShellView *eshell_view, EFolder *efolder) -{ - GtkWidget *w = get_view (efolder); - - if (eshell_view->contents){ - gtk_widget_destroy (eshell_view->contents); - } - - eshell_view->contents = w; - - if (eshell_view->shortcut_displayed){ - gtk_paned_pack2 (GTK_PANED (eshell_view->shortcut_hpaned), - eshell_view->contents, FALSE, TRUE); - } else { - gnome_app_set_contents (GNOME_APP (eshell_view), eshell_view->contents); - } -} - -GtkWidget * -e_shell_view_new (EShell *eshell, EFolder *efolder, gboolean show_shortcut_bar) -{ - EShellView *eshell_view; - - eshell_view = gtk_type_new (e_shell_view_get_type ()); - - gnome_app_construct (GNOME_APP (eshell_view), "Evolution", "Evolution"); - - eshell_view->eshell = eshell; - e_shell_view_setup (eshell_view); - e_shell_view_setup_menus (eshell_view); - - e_shell_register_view (eshell, eshell_view); - eshell_view->shortcut_displayed = show_shortcut_bar; - e_shell_view_setup_shortcut_display (eshell_view); - - e_shell_view_set_view (eshell_view, efolder); - - return (GtkWidget *) eshell_view; -} - -void -e_shell_view_display_shortcut_bar (EShellView *eshell_view, gboolean display) -{ - g_return_if_fail (eshell_view != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (eshell_view)); - - g_error ("Switching code for the shortcut bar is not written yet"); -} - -E_MAKE_TYPE (e_shell_view, "EShellView", EShellView, e_shell_view_class_init, NULL, PARENT_TYPE); - -void -e_shell_view_new_folder (EShellView *esv) -{ - g_return_if_fail (esv != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (esv)); -} - -void -e_shell_view_new_shortcut (EShellView *esv) -{ - g_return_if_fail (esv != NULL); - g_return_if_fail (E_IS_SHELL_VIEW (esv)); -} diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h deleted file mode 100644 index 5f5c5d39c6..0000000000 --- a/shell/e-shell-view.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef E_SHELL_VIEW_H -#define E_SHELL_VIEW_H - -#include -#include -#include "e-shell.h" - -#define E_SHELL_VIEW_TYPE (e_shell_view_get_type ()) -#define E_SHELL_VIEW(o) (GTK_CHECK_CAST ((o), E_SHELL_VIEW_TYPE, EShellView)) -#define E_SHELL_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHELL_VIEW_TYPE, EShellViewClass)) -#define E_IS_SHELL_VIEW(o) (GTK_CHECK_TYPE ((o), E_SHELL_VIEW_TYPE)) -#define E_IS_SHELL_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHELL_VIEW_TYPE)) - -struct _EShellView { - GnomeApp parent; - - /* Pointer to our model */ - EShell *eshell; - - /* Our user interface handler */ - BonoboUIHandler *uih; - - - EFolder *efolder; -/* - * - */ - char shortcut_displayed; - GtkWidget *shortcut_hpaned; - GtkWidget *shortcut_bar; - GtkWidget *contents; -}; - -typedef struct { - GnomeAppClass parent_class; -} EShellViewClass; - -GtkWidget *e_shell_view_new (EShell *eshell, EFolder *folder, - gboolean show_shortcut_bar); -GtkType e_shell_view_get_type (void); - -void e_shell_view_new_folder (EShellView *esv); -void e_shell_view_new_shortcut (EShellView *esv); - -void e_shell_view_set_view (EShellView *eshell_view, - EFolder *efolder); - -void e_shell_view_display_shortcut_bar (EShellView *eshell_view, gboolean display); - -#endif /* E_SHELL_VIEW_H */ diff --git a/shell/e-shell.c b/shell/e-shell.c deleted file mode 100644 index cd4be67bc6..0000000000 --- a/shell/e-shell.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * E-shell.c: Shell object for Evolution - * - * Authors: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 1999 Miguel de Icaza - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include "Evolution.h" -#include "e-util/e-util.h" -#include "e-shell.h" - -#define PARENT_TYPE (bonobo_object_get_type ()) - -static BonoboObjectClass *e_shell_parent_class; -POA_Evolution_Shell__vepv eshell_vepv; - -GtkType e_shell_get_type (void); - -void -e_shell_new_appointment (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_meeting_request (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_task (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_task_request (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_contact (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_mail_message (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_distribution_list (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_journal_entry (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -void -e_shell_new_note (EShell *eshell) -{ - printf ("Unimplemented function invoked: %s\n", __FUNCTION__); -} - -static void -EShell_cmd_new (PortableServer_Servant servant, - const Evolution_Shell_NewType type, - CORBA_Environment *ev) -{ - EShell *eshell = E_SHELL (bonobo_object_from_servant (servant)); - - switch (type){ - case Evolution_Shell_APPOINTMENT: - e_shell_new_appointment (eshell); - break; - - case Evolution_Shell_MEETING_REQUEST: - e_shell_new_meeting_request (eshell); - break; - - case Evolution_Shell_TASK: - e_shell_new_task (eshell); - break; - - case Evolution_Shell_TASK_REQUEST: - e_shell_new_task_request (eshell); - break; - - case Evolution_Shell_CONTACT: - e_shell_new_contact (eshell); - break; - - case Evolution_Shell_MAIL_MESSAGE: - e_shell_new_mail_message (eshell); - break; - - case Evolution_Shell_DISTRIBUTION_LIST: - e_shell_new_distribution_list (eshell); - break; - - case Evolution_Shell_JOURNAL_ENTRY: - e_shell_new_journal_entry (eshell); - break; - - case Evolution_Shell_NOTE: - e_shell_new_note (eshell); - break; - - default: - } -} - -static POA_Evolution_Shell__epv * -e_shell_get_epv (void) -{ - POA_Evolution_Shell__epv *epv; - - epv = g_new0 (POA_Evolution_Shell__epv, 1); - - epv->new = EShell_cmd_new; - - return epv; -} - -static void -init_e_shell_corba_class (void) -{ - eshell_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - eshell_vepv.Evolution_Shell_epv = e_shell_get_epv (); -} - -static void -es_destroy_default_folders (EShell *eshell) -{ - gtk_object_unref (GTK_OBJECT (eshell->default_folders.inbox)); - gtk_object_unref (GTK_OBJECT (eshell->default_folders.outbox)); - gtk_object_unref (GTK_OBJECT (eshell->default_folders.drafts)); - gtk_object_unref (GTK_OBJECT (eshell->default_folders.calendar)); - gtk_object_unref (GTK_OBJECT (eshell->default_folders.tasks)); -} - -static void -e_shell_destroy (GtkObject *object) -{ - EShell *eshell = E_SHELL (object); - - gtk_object_unref (GTK_OBJECT (eshell->shortcut_bar)); - es_destroy_default_folders (eshell); - - GTK_OBJECT_CLASS (e_shell_parent_class)->destroy (object); -} - -static void -e_shell_class_init (GtkObjectClass *object_class) -{ - e_shell_parent_class = gtk_type_class (PARENT_TYPE); - init_e_shell_corba_class (); - - object_class->destroy = e_shell_destroy; -} - -static void -e_shell_destroy_views (EShell *eshell) -{ - - /* - * Notice that eshell->views is updated by the various views - * during unregistration - */ - while (eshell->views){ - EShellView *view = eshell->views->data; - - gtk_object_destroy (GTK_OBJECT (view)); - } -} - -void -e_shell_quit (EShell *eshell) -{ - g_return_if_fail (eshell != NULL); - g_return_if_fail (E_IS_SHELL (eshell)); - - e_shell_destroy_views (eshell); - - gtk_main_quit (); -} - -static CORBA_Object -create_corba_eshell (BonoboObject *object) -{ - POA_Evolution_Shell *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_Shell *)g_new0 (BonoboObjectServant, 1); - servant->vepv = &eshell_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_Shell__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ - CORBA_exception_free (&ev); - g_free (servant); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - - return bonobo_object_activate_servant (object, servant); -} - -static void -e_shell_setup_default_folders (EShell *eshell) -{ - eshell->default_folders.summary = e_folder_new ( - E_FOLDER_MAIL, "internal:summary", _("Today"), _("Executive Summary"), - NULL, "internal:"); - eshell->default_folders.inbox = e_folder_new ( - E_FOLDER_MAIL, "internal:inbox", _("Inbox"), _("New mail messages"), - NULL, "internal:mail_view"); - eshell->default_folders.outbox = e_folder_new ( - E_FOLDER_MAIL, "internal:outbox", _("Sent messages"), _("Sent mail messages"), - NULL, "internal:mail_view"); - eshell->default_folders.drafts = e_folder_new ( - E_FOLDER_MAIL, "internal:drafts", _("Drafts"), _("Draft mail messages"), - NULL, "internal:mail_view"); - eshell->default_folders.calendar = e_folder_new ( - E_FOLDER_CALENDAR, "internal:personal_calendar", _("Calendar"), _("Your calendar"), - NULL, "internal:calendar_daily"); - eshell->default_folders.contacts = e_folder_new ( - E_FOLDER_CONTACTS, "internal:personal_contacts", _("Contacts"), _("Your contacts list"), - NULL, "internal:contact_view"); - eshell->default_folders.tasks = e_folder_new ( - E_FOLDER_TASKS, "internal:personal_calendar", _("Tasks"), _("Tasks list"), - NULL, "internal:tasks_view"); -} - -static EShortcutGroup * -setup_main_shortcuts (EShell *eshell) -{ - EShortcutGroup *m; - - m = e_shortcut_group_new (_("Main Shortcuts"), FALSE); - e_shortcut_group_append (m, e_shortcut_new (eshell->default_folders.summary)); - e_shortcut_group_append (m, e_shortcut_new (eshell->default_folders.inbox)); - e_shortcut_group_append (m, e_shortcut_new (eshell->default_folders.calendar)); - e_shortcut_group_append (m, e_shortcut_new (eshell->default_folders.contacts)); - e_shortcut_group_append (m, e_shortcut_new (eshell->default_folders.tasks)); - - return m; -} - -static EShortcutGroup * -setup_secondary_shortcuts (EShell *eshell) -{ - EShortcutGroup *sec; - - sec = e_shortcut_group_new (_("Other Shortcuts"), TRUE); - - e_shortcut_group_append (sec, e_shortcut_new (eshell->default_folders.drafts)); - e_shortcut_group_append (sec, e_shortcut_new (eshell->default_folders.outbox)); - - return sec; -} - -static void -e_shell_setup_default_shortcuts (EShell *eshell) -{ - eshell->shortcut_bar = e_shortcut_bar_model_new (); - e_shortcut_bar_model_append ( - eshell->shortcut_bar, - setup_main_shortcuts (eshell)); - e_shortcut_bar_model_append ( - eshell->shortcut_bar, - setup_secondary_shortcuts (eshell)); -} - -static void -e_shell_init (GtkObject *object) -{ - EShell *eshell = E_SHELL (object); - - e_shell_setup_default_folders (eshell); - e_shell_setup_default_shortcuts (eshell); -} - -static void -e_shell_construct (EShell *eshell, Evolution_Shell corba_eshell) -{ - bonobo_object_construct (BONOBO_OBJECT (eshell), corba_eshell); -} - -EShell * -e_shell_new (void) -{ - Evolution_Shell corba_eshell; - EShell *eshell; - - eshell = gtk_type_new (e_shell_get_type ()); - - corba_eshell = create_corba_eshell (BONOBO_OBJECT (eshell)); - if (corba_eshell == CORBA_OBJECT_NIL){ - gtk_object_destroy (GTK_OBJECT (eshell)); - return NULL; - } - - e_shell_construct (eshell, corba_eshell); - - return eshell; -} - -void -e_shell_register_view (EShell *eshell, EShellView *eshell_view) -{ - g_return_if_fail (eshell != NULL); - g_return_if_fail (E_IS_SHELL (eshell)); - g_return_if_fail (eshell_view != NULL); - - eshell->views = g_slist_prepend (eshell->views, eshell_view); -} - -void -e_shell_unregister_view (EShell *eshell, EShellView *eshell_view) -{ - g_return_if_fail (eshell != NULL); - g_return_if_fail (E_IS_SHELL (eshell)); - g_return_if_fail (eshell_view != NULL); - - eshell->views = g_slist_remove (eshell->views, eshell_view); -} - -E_MAKE_TYPE (e_shell, "EShell", EShell, e_shell_class_init, e_shell_init, PARENT_TYPE); - - - - diff --git a/shell/e-shell.h b/shell/e-shell.h deleted file mode 100644 index 64de044fb4..0000000000 --- a/shell/e-shell.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef E_SHELL_H -#define E_SHELL_H - -#include -#include "evolution.h" -#include "e-folder.h" -#include "e-shortcut.h" - -#define E_SHELL_GOAD_ID "GOADID:GNOME:Evolution:Shell:1.0" -#define E_SHELL_FACTORY_GOAD_ID "GOADID:GNOME:Evolution:ShellFactory:1.0" - -#define E_SHELL_TYPE (e_shell_get_type ()) -#define E_SHELL(o) (GTK_CHECK_CAST ((o), E_SHELL_TYPE, EShell)) -#define E_SHELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHELL_TYPE, EShellClass)) -#define E_IS_SHELL(o) (GTK_CHECK_TYPE ((o), E_SHELL_TYPE)) -#define E_IS_SHELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHELL_TYPE)) - -struct _EShell { - BonoboObject base_object; - - /* A list of EShellViews */ - GSList *views; - - struct { - EFolder *inbox; - EFolder *outbox; - EFolder *drafts; - EFolder *calendar; - EFolder *tasks; - EFolder *summary; - EFolder *contacts; - } default_folders; - - EShortcutBarModel *shortcut_bar; -}; - -typedef struct { - BonoboObjectClass parent_class; -} EShellClass; - -EShell *e_shell_new (void); -void e_shell_register_view (EShell *eshell, EShellView *eshell_view); -void e_shell_unregister_view (EShell *eshell, EShellView *eshell_view); - -/* - * New - */ -void e_shell_new_appointment (EShell *eshell); -void e_shell_new_meeting_request (EShell *eshell); -void e_shell_new_task (EShell *eshell); -void e_shell_new_task_request (EShell *eshell); -void e_shell_new_contact (EShell *eshell); -void e_shell_new_mail_message (EShell *eshell); -void e_shell_new_distribution_list (EShell *eshell); -void e_shell_new_journal_entry (EShell *eshell); -void e_shell_new_note (EShell *eshell); - -void e_shell_quit (EShell *eshell); - -#endif /* EVOLUTION_SHELL_H */ diff --git a/shell/e-shortcut.c b/shell/e-shortcut.c deleted file mode 100644 index 767f9e4067..0000000000 --- a/shell/e-shortcut.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Shortcut.c: implements shortcuts and shortcut group models - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - * - */ -#include -#include -#include -#include -#include "e-util/e-util.h" -#include "e-shortcut.h" -#include "shortcut-bar/e-shortcut-bar.h" -#include "shortcut-bar/e-clipped-label.h" - -#define SHORTCUT_PARENT_TYPE gtk_object_get_type () -#define SHORTCUT_BAR_MODEL_PARENT_TYPE gtk_object_get_type () -#define SHORTCUT_GROUP_PARENT_TYPE gtk_object_get_type () - -static GtkObjectClass *shortcut_parent_class; -static GtkObjectClass *shortcut_group_parent_class; -static GtkObjectClass *shortcut_bar_model_parent_class; - -enum { - STRUCTURE_CHANGED, - LAST_SIGNAL -}; - -static void -es_destroy (GtkObject *object) -{ - EShortcut *ef = E_SHORTCUT (object); - - gtk_object_unref (GTK_OBJECT (ef->efolder)); - - shortcut_parent_class->destroy (object); -} - -static void -e_shortcut_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = es_destroy; - shortcut_parent_class = gtk_type_class (SHORTCUT_PARENT_TYPE); -} - -static void -esg_destroy (GtkObject *object) -{ - EShortcutGroup *efg = E_SHORTCUT_GROUP (object); - const int shortcut_count = efg->shortcuts->len; - int i; - - g_free (efg->title); - - for (i = 0; i < shortcut_count; i++){ - EShortcut *es = g_array_index (efg->shortcuts, EShortcut *, i); - - gtk_object_unref (GTK_OBJECT (es)); - } - - g_array_free (efg->shortcuts, TRUE); - efg->model = NULL; - - shortcut_group_parent_class->destroy (object); -} - -static void -e_shortcut_group_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = esg_destroy; - shortcut_parent_class = gtk_type_class (SHORTCUT_GROUP_PARENT_TYPE); -} - -static void -e_shortcut_group_init (GtkObject *object) -{ - EShortcutGroup *esg = E_SHORTCUT_GROUP (object); - - GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (object), GTK_FLOATING); - - esg->shortcuts = g_array_new (FALSE, FALSE, sizeof (EShortcut *)); -} - -EShortcut * -e_shortcut_new (EFolder *efolder) -{ - EShortcut *shortcut = gtk_type_new (e_shortcut_get_type ()); - - shortcut->efolder = efolder; - gtk_object_ref (GTK_OBJECT (efolder)); - - return shortcut; -} - -EShortcutGroup * -e_shortcut_group_new (const char *title, EIconBarViewType type) -{ - EShortcutGroup *shortcut_group = gtk_type_new (e_shortcut_group_get_type ()); - - shortcut_group->title = g_strdup (title); - shortcut_group->type = type; - return shortcut_group; -} - -void -e_shortcut_group_append (EShortcutGroup *sg, EShortcut *shortcut) -{ - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - g_return_if_fail (shortcut != NULL); - g_return_if_fail (E_IS_SHORTCUT (shortcut)); - - gtk_object_ref (GTK_OBJECT (shortcut)); - gtk_object_sink (GTK_OBJECT (shortcut)); - - g_array_append_val (sg->shortcuts, shortcut); - - /* FIXME: Broadcast change */ -} - -void -e_shortcut_group_remove (EShortcutGroup *sg, EShortcut *shortcut) -{ - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - g_return_if_fail (shortcut != NULL); - g_return_if_fail (E_IS_SHORTCUT (sg)); - - { - const int len = sg->shortcuts->len; - int i; - - for (i = 0; i < len; i++){ - EShortcut *es = g_array_index (sg->shortcuts, EShortcut *, i); - - if (es == shortcut){ - g_array_remove_index (sg->shortcuts, i); - /* FIXME: Broadcast change */ - return; - } - } - } -} - -void -e_shortcut_group_move (EShortcutGroup *sg, int from, int to) -{ - EShortcut *t; - - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - g_return_if_fail (from < sg->shortcuts->len); - g_return_if_fail (to < sg->shortcuts->len); - g_return_if_fail (from >= 0); - g_return_if_fail (to >= 0); - - if (from == to) - return; - - t = g_array_index (sg->shortcuts, EShortcut *, from); - g_array_index (sg->shortcuts, EShortcut *, from) = - g_array_index (sg->shortcuts, EShortcut *, to); - g_array_index (sg->shortcuts, EShortcut *, to) = t; - - /* FIXME: Broadcast change */ -} - -void -e_shortcut_group_rename (EShortcutGroup *sg, const char *text) -{ - GSList *l; - int id; - - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - id = e_group_num_from_group_ptr (sg->model, sg); - for (l = sg->model->views; l; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - GtkWidget *label; - - label = e_clipped_label_new (text); - - gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); - gtk_widget_show (label); - - e_group_bar_set_group_button_label ( - E_GROUP_BAR (shortcut_bar), id, label); - } -} - -static void -esb_destroy (GtkObject *object) -{ - EShortcutBarModel *esb = E_SHORTCUT_BAR_MODEL (object); - const int count = esb->groups->len; - int i; - - for (i = 0; i < count; i++){ - EShortcutGroup *esg = g_array_index (esb->groups, EShortcutGroup *, i); - - gtk_object_destroy (GTK_OBJECT (esg)); - } - - g_array_free (esb->groups, TRUE); - shortcut_bar_model_parent_class->destroy (object); -} - -static void -e_shortcut_bar_model_class_init (GtkObjectClass *object_class) -{ - object_class->destroy = esb_destroy; - shortcut_bar_model_parent_class = gtk_type_class (SHORTCUT_BAR_MODEL_PARENT_TYPE); -} - -static void -e_shortcut_bar_model_init (GtkObject *object) -{ - EShortcutBarModel *esb = E_SHORTCUT_BAR_MODEL (object); - - /* The shortcut bar model is self owned */ - GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING); - - esb->groups = g_array_new (FALSE, FALSE, sizeof (EShortcutGroup *)); -} - -EShortcutBarModel * -e_shortcut_bar_model_new (void) -{ - EShortcutBarModel *bm; - - bm = gtk_type_new (e_shortcut_bar_model_get_type ()); - - return bm; -} - -void -e_shortcut_bar_model_append (EShortcutBarModel *bm, EShortcutGroup *sg) -{ - g_return_if_fail (bm != NULL); - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_BAR_MODEL (bm)); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - gtk_object_ref (GTK_OBJECT (sg)); - gtk_object_sink (GTK_OBJECT (sg)); - - sg->model = bm; - - g_array_append_val (bm->groups, sg); -} - -EShortcutGroup * -e_shortcut_group_from_pos (EShortcutBarModel *bm, int group_num) -{ - EShortcutGroup *group; - - if (group_num == -1) - return NULL; - - group = g_array_index (bm->groups, EShortcutGroup *, group_num); - return group; -} - -EShortcut * -e_shortcut_from_pos (EShortcutGroup *group, int item_num) -{ - EShortcut *shortcut; - - g_return_val_if_fail (group != NULL, NULL); - g_return_val_if_fail (E_IS_SHORTCUT_GROUP (group), NULL); - - if (item_num == -1) - return NULL; - - g_return_val_if_fail (item_num < group->shortcuts->len, NULL); - - shortcut = g_array_index (group->shortcuts, EShortcut *, item_num); - return shortcut; -} - -static void -populate_group (EShortcutBarModel *bm, EShortcutGroup *esg, EShortcutBar *shortcut_bar) -{ - int group_num, i; - const int items = esg->shortcuts->len; - - group_num = e_shortcut_bar_add_group (shortcut_bar, esg->title); - e_shortcut_bar_set_view_type (shortcut_bar, group_num, esg->type); - - for (i = 0; i < items; i++){ - EShortcut *shortcut = E_SHORTCUT (g_array_index (esg->shortcuts, EShortcut *, i)); - EFolder *folder = shortcut->efolder; - char *type = NULL; - - switch (folder->type){ - case E_FOLDER_MAIL: - type = "folder:"; - break; - - case E_FOLDER_CONTACTS: - type = "contacts:"; - break; - - case E_FOLDER_CALENDAR: - type = "calendar:"; - break; - - case E_FOLDER_TASKS: - type = "todo:"; - break; - - case E_FOLDER_OTHER: - type = "file:"; - break; - - default: - g_assert_not_reached (); - } - - e_shortcut_bar_add_item (shortcut_bar, group_num, type, folder->name); - } -} - -static void -populate_from_model (EShortcutBarModel *bm, EShortcutBar *shortcut_bar) -{ - const int groups = bm->groups->len; - int i; - - for (i = 0; i < groups; i++){ - EShortcutGroup *esg; - - esg = g_array_index (bm->groups, EShortcutGroup *, i); - - populate_group (bm, esg, shortcut_bar); - } - -} - -static void -view_destroyed (EShortcutBar *shortcut_bar, EShortcutBarModel *bm) -{ - bm->views = g_slist_remove (bm->views, shortcut_bar); -} - -GtkWidget * -e_shortcut_bar_view_new (EShortcutBarModel *bm) -{ - GtkWidget *shortcut_bar; - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - shortcut_bar = e_shortcut_bar_new (); - - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - - populate_from_model (bm, E_SHORTCUT_BAR (shortcut_bar)); - - bm->views = g_slist_prepend (bm->views, shortcut_bar); - gtk_signal_connect (GTK_OBJECT (shortcut_bar), "destroy", GTK_SIGNAL_FUNC (view_destroyed), bm); - - return shortcut_bar; -} - -int -e_group_num_from_group_ptr (EShortcutBarModel *bm, EShortcutGroup *group) -{ - const int n = bm->groups->len; - int i; - - for (i = 0; i < n; i++) - if (g_array_index (bm->groups, EShortcutGroup *, i) == group) - return i; - return -1; -} - -/* - * Sets the view mode in all the views - */ -void -e_shortcut_group_set_view_type (EShortcutGroup *group, EIconBarViewType type) -{ - GSList *l; - int group_num; - - g_return_if_fail (group != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (group)); - - group_num = e_group_num_from_group_ptr (group->model, group); - - g_assert (group_num != -1); - - group->type = type; - - for (l = group->model->views; l ; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - - e_shortcut_bar_set_view_type (shortcut_bar, group_num, type); - } -} - -gint -e_shortcut_bar_model_add_group (EShortcutBarModel *model) -{ - int id = -1; - GSList *l = NULL; - - g_return_val_if_fail (model != NULL, -1); - g_return_val_if_fail (E_IS_SHORTCUT_BAR_MODEL (model), -1); - - for (l = model->views; l; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - - id = e_shortcut_bar_add_group (shortcut_bar, _("New group")); - } - - return id; -} - -void -e_shortcut_bar_model_remove_group (EShortcutBarModel *model, EShortcutGroup *sg) -{ - GSList *l = NULL; - int group_num; - - g_return_if_fail (model != NULL); - g_return_if_fail (E_IS_SHORTCUT_BAR_MODEL (model)); - g_return_if_fail (sg != NULL); - g_return_if_fail (E_IS_SHORTCUT_GROUP (sg)); - - group_num = e_group_num_from_group_ptr (model, sg); - - for (l = model->views; l; l = l->next){ - EShortcutBar *shortcut_bar = l->data; - - e_shortcut_bar_remove_group (shortcut_bar, group_num); - } - -} - -E_MAKE_TYPE (e_shortcut, "EShortcut", EShortcut, e_shortcut_class_init, NULL, SHORTCUT_PARENT_TYPE); -E_MAKE_TYPE (e_shortcut_group, "EShortcutGroup", EShortcutGroup, e_shortcut_group_class_init, e_shortcut_group_init, SHORTCUT_GROUP_PARENT_TYPE); -E_MAKE_TYPE (e_shortcut_bar_model, "EShortcutBarModel", EShortcutBarModel, e_shortcut_bar_model_class_init, e_shortcut_bar_model_init, SHORTCUT_BAR_MODEL_PARENT_TYPE); - diff --git a/shell/e-shortcut.h b/shell/e-shortcut.h deleted file mode 100644 index e7dde69124..0000000000 --- a/shell/e-shortcut.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef SHELL_SHORTCUT_H -#define SHELL_SHORTCUT_H - -#include -#include "e-folder.h" -#include "shortcut-bar/e-icon-bar.h" - -typedef struct _EShortcut EShortcut; -typedef struct _EShortcutGroup EShortcutGroup; -typedef struct _EShortcutBarModel EShortcutBarModel; - -#define E_SHORTCUT_TYPE (e_shortcut_get_type ()) -#define E_SHORTCUT(o) (GTK_CHECK_CAST ((o), E_SHORTCUT_TYPE, EShortcut)) -#define E_SHORTCUT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHORTCUT_TYPE, EShortcutClass)) -#define E_IS_SHORTCUT(o) (GTK_CHECK_TYPE ((o), E_SHORTCUT_TYPE)) -#define E_IS_SHORTCUT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHORTCUT_TYPE)) - -struct _EShortcut { - GtkObject object; - EFolder *efolder; -}; - -typedef struct { - GtkObjectClass parent_class; -} EShortcutClass; - -#define E_SHORTCUT_GROUP_TYPE (e_shortcut_group_get_type ()) -#define E_SHORTCUT_GROUP(o) (GTK_CHECK_CAST ((o), E_SHORTCUT_GROUP_TYPE, EShortcutGroup)) -#define E_SHORTCUT_GROUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHORTCUT_GROUP_TYPE, EShortcutGroupClass)) -#define E_IS_SHORTCUT_GROUP(o) (GTK_CHECK_TYPE ((o), E_SHORTCUT_GROUP_TYPE)) -#define E_IS_SHORTCUT_GROUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHORTCUT_GROUP_TYPE)) - -struct _EShortcutGroup { - GtkObject object; - EShortcutBarModel *model; - char *group_name; - GArray *shortcuts; - char *title; - EIconBarViewType type; -}; - -typedef struct { - GtkObjectClass parent_class; -} EShortcutGroupClass; - -GtkType e_shortcut_get_type (void); -EShortcut *e_shortcut_new (EFolder *efolder); - -GtkType e_shortcut_group_get_type (void); -EShortcutGroup *e_shortcut_group_new (const char *name, EIconBarViewType type); -void e_shortcut_group_append (EShortcutGroup *sg, EShortcut *shortcut); -void e_shortcut_group_destroy (EShortcutGroup *sg); -void e_shortcut_group_remove (EShortcutGroup *sg, EShortcut *shortcut); -void e_shortcut_group_move (EShortcutGroup *sg, int from, int to); -void e_shortcut_group_set_view_type (EShortcutGroup *sg, EIconBarViewType type); -void e_shortcut_group_rename (EShortcutGroup *sg, const char *text); - -#define E_SHORTCUT_BAR_MODEL_TYPE (e_shortcut_bar_model_get_type ()) -#define E_SHORTCUT_BAR_MODEL(o) (GTK_CHECK_CAST ((o), E_SHORTCUT_BAR_MODEL_TYPE, EShortcutBarModel)) -#define E_SHORTCUT_BAR_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SHORTCUT_BAR_MODEL_TYPE, EShortcutBarMNodelClass)) -#define E_IS_SHORTCUT_BAR_MODEL(o) (GTK_CHECK_TYPE ((o), E_SHORTCUT_BAR_MODEL_TYPE)) -#define E_IS_SHORTCUT_BAR_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SHORTCUT_BAR_MODEL_TYPE)) - -struct _EShortcutBarModel { - GtkObject object; - - GArray *groups; - GSList *views; -}; - -typedef struct { - GtkObjectClass object_class; -} EShortcutBarModelClass; - -GtkType e_shortcut_bar_model_get_type (void); -EShortcutBarModel *e_shortcut_bar_model_new (void); -void e_shortcut_bar_model_append (EShortcutBarModel *shortcut_bar, - EShortcutGroup *group); -int e_shortcut_bar_model_add_group (EShortcutBarModel *shortcut_bar); -void e_shortcut_bar_model_remove_group - (EShortcutBarModel *model, - EShortcutGroup *sg); - -/* Ugly api name */ -int e_group_num_from_group_ptr (EShortcutBarModel *bm, - EShortcutGroup *group); - -/* - * Produces a new view of the Shortcut Bar model - */ -GtkWidget *e_shortcut_bar_view_new (EShortcutBarModel *bm); - -/* - * Locating objects - */ -EShortcutGroup *e_shortcut_group_from_pos (EShortcutBarModel *bm, - int group_num); -EShortcut *e_shortcut_from_pos (EShortcutGroup *group, - int item_num); - -#endif - diff --git a/shell/evolution.h b/shell/evolution.h deleted file mode 100644 index 11e5b342f9..0000000000 --- a/shell/evolution.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _EVOLUTION_H_ -#define _EVOLUTION_H_ - -typedef struct _EShell EShell; -typedef struct _EShellView EShellView; - -#endif diff --git a/shell/main.c b/shell/main.c deleted file mode 100644 index 1d6d8bed7c..0000000000 --- a/shell/main.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Main evolution shell application - * - * Authors: - * Miguel de Icaza (miguel@helixcode.com) - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "e-shell.h" -#include "e-shell-view.h" - -int shell_debugging = 0; - -poptContext ctx; - -EShell *eshell; - -const struct poptOption shell_popt_options [] = { - { "debug", '\0', POPT_ARG_INT, &shell_debugging, 0, - N_("Enables some debugging functions"), N_("LEVEL") }, - { NULL, '\0', 0, NULL, 0 } -}; - -static void -corba_init (int *argc, char *argv []) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - gnome_CORBA_init_with_popt_table ( - "Evolution", VERSION, argc, argv, - shell_popt_options, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev); - CORBA_exception_free (&ev); - - if (bonobo_init (gnome_CORBA_ORB (), NULL, NULL) == FALSE){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Failed to initialize the Bonobo component system")); - exit (1); - } -} - -static void -gui_init (void) -{ - e_cursors_init (); - - glade_gnome_init (); - - bonobo_activate (); -} - -static void -gui_shutdown (void) -{ - /* shutdown */ - e_cursors_shutdown (); -} - -static void -evolution_boot (void) -{ - EShellView *e_shell_view; - - eshell = e_shell_new (); - e_shell_view = E_SHELL_VIEW ( - e_shell_view_new (eshell, - eshell->default_folders.inbox, - TRUE)); - - gtk_widget_show (GTK_WIDGET (e_shell_view)); -} - -int -main (int argc, char *argv []) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - corba_init (&argc, argv); - gui_init (); - - evolution_boot (); - - gtk_main (); - - gui_shutdown (); - - return 0; -} diff --git a/stamp.h.in b/stamp.h.in deleted file mode 100644 index 8b13789179..0000000000 --- a/stamp.h.in +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/.cvsignore b/tests/.cvsignore deleted file mode 100644 index a97edbf737..0000000000 --- a/tests/.cvsignore +++ /dev/null @@ -1,19 +0,0 @@ -test1 -test2 -test3 -test4 -test5 -test6 -test7 -test8 -test9 -test10 -test11 -Makefile.in -Makefile -.deps -.libs -mail1.test -mail2.test -test-formatter - diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 3291d6035c..0000000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,50 +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 \ - -I$(top_srcdir)/camel/providers/mbox -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/libibex/libibex.la \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) $(INTLLIBS) $(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) - -#test11_LDADD = \ -# $(LDADD) \ -# $(top_builddir)/filter/libfilter.la \ -# $(top_builddir)/libibex/libibex.a - -test9_LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/camel/providers/mbox/libcamelmbox.la \ - $(top_builddir)/libibex/libibex.la \ - $(GNOME_LIBDIR) \ - $(GNOMEUI_LIBS) $(INTLLIBS) $(EXTRA_GNOME_LIBS) - -if ENABLE_THREADS -THREAD_RELATED_TESTS=test8 -else -THREAD_RELATED_TESTS= -endif - - -noinst_PROGRAMS = \ - test1 \ - test2 \ - test3 \ - test7 \ - test9 \ - test10 \ - test11 \ - test-formatter \ - $(THREAD_RELATED_TESTS) diff --git a/tests/test-formatter.c b/tests/test-formatter.c deleted file mode 100644 index 536d3e9bbf..0000000000 --- a/tests/test-formatter.c +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Based on 'test2.c'; tests the camel-formatter class */ -#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 "camel-formatter.h" - -static void -convert_to_html_and_print (CamelMimeMessage *msg) -{ - CamelFormatter* cmf = camel_formatter_new(); - gchar* header_str; - gchar* body_str; - - CamelStream* header_stream = - camel_stream_mem_new (CAMEL_STREAM_FS_WRITE); - CamelStream* body_stream = - camel_stream_mem_new (CAMEL_STREAM_FS_WRITE); - camel_formatter_mime_message_to_html ( - cmf, msg, header_stream, body_stream); - - header_str = g_strndup ( - CAMEL_STREAM_MEM (header_stream)->buffer->data, - CAMEL_STREAM_MEM (header_stream)->buffer->len); - body_str = g_strndup ( - CAMEL_STREAM_MEM (body_stream)->buffer->data, - CAMEL_STREAM_MEM (body_stream)->buffer->len); - g_print ("Header follows\n----------------------\n%s\n", - header_str); - g_print ("Body follows\n----------------------\n%s\n", - body_str); - - g_free (header_str); - g_free (body_str); -} - -static void -print_usage_and_quit() -{ - g_print ("\nUsage: test-formatter [MIME-MESSAGE-FILE]\n\n"); - g_print ("Where MIME-MESSAGE-FILE is in the \"message/rfc822\"\n"); - g_print ("mime format.\n\n"); - - exit(0); -} - - -int -main (int argc, char**argv) -{ - GHashTable *header_table; - CamelMimeMessage *message; - CamelStream *input_stream; - -// CamelStream *foo = CAMEL_STREAM(NULL); - - gtk_init (&argc, &argv); - if (argc == 1 || argc > 2) - print_usage_and_quit(); - - 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 ( - argv[1], 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_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; - convert_to_html_and_print (message); - - - camel_stream_close (input_stream); - gtk_object_unref (GTK_OBJECT (input_stream)); - - return 0; -} diff --git a/tests/test1.c b/tests/test1.c deleted file mode 100644 index 048b36e1ec..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 - -#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 []\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@inria.fr")); - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC, - g_strdup ("Francois.fleuret@inria.fr")); - 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/test10.c b/tests/test10.c deleted file mode 100644 index 1d1d2904b9..0000000000 --- a/tests/test10.c +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - - -#include "camel.h" -#include "camel-mbox-folder.h" -#include "camel-mbox-parser.h" -#include "camel-mbox-utils.h" -#include "camel-mbox-summary.h" -#include "camel-log.h" -#include "camel-exception.h" -#include "md5-utils.h" -#include -#include -#include -#include -#include -#include -#include - - -static CamelMimeMessage * -create_sample_mime_message () -{ - CamelMimeMessage *message; - CamelMimeBodyPart *body_part; - CamelMultipart *multipart; - - - 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_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@inria.fr")); - camel_mime_message_add_recipient (message, CAMEL_RECIPIENT_TYPE_CC, - g_strdup ("Francois.fleuret@inria.fr")); - 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); - camel_medium_set_content_object (CAMEL_MEDIUM (message), CAMEL_DATA_WRAPPER (multipart)); - - return message; -} - -static char * -auth_callback(char *prompt, gboolean secret, - CamelService *service, char *item, - CamelException *ex) -{ - printf ("auth_callback called: %s\n", prompt); - return NULL; -} - - - - -int -main (int argc, char**argv) -{ - CamelSession *session; - CamelException *ex; - CamelStore *store; - gchar *store_url = "mbox:///tmp/evmail"; - CamelFolder *folder; - CamelMimeMessage *message; - GList *uid_list; - camel_debug_level = 10; - - gtk_init (&argc, &argv); - camel_init (); - ex = camel_exception_new (); - camel_provider_register_as_module ("../camel/providers/mbox/.libs/libcamelmbox.so"); - - session = camel_session_new (auth_callback); - store = camel_session_get_store (session, store_url, ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught in camel_session_get_store\n" - "Full description : %s\n", camel_exception_get_description (ex)); - return -1; - } - - folder = camel_store_get_folder (store, "Inbox", ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught in camel_store_get_folder\n" - "Full description : %s\n", camel_exception_get_description (ex)); - return -1; - } - - camel_folder_open (folder, FOLDER_OPEN_RW, ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught when trying to open the folder\n" - "Full description : %s\n", camel_exception_get_description (ex)); - return -1; - } - - message = create_sample_mime_message (); - camel_folder_append_message (folder, message, ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught when trying to append a message to the folder\n" - "Full description : %s\n", camel_exception_get_description (ex)); - return -1; - } - - uid_list = camel_folder_get_uid_list (folder, ex); - - - camel_folder_get_message_by_uid (folder, (gchar *)uid_list->data, ex); - camel_folder_close (folder, FALSE, ex); - return 1; -} - - - - diff --git a/tests/test11.c b/tests/test11.c deleted file mode 100644 index 36ec9c6159..0000000000 --- a/tests/test11.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - Test search api - */ - - -#include "camel.h" -#include "camel-mbox-folder.h" -#include "camel-mbox-parser.h" -#include "camel-mbox-utils.h" -#include "camel-mbox-summary.h" -#include "camel-log.h" -#include "camel-exception.h" -#include "camel-folder-summary.h" -#include "md5-utils.h" -#include -#include -#include -#include -#include -#include -#include - -static char * -auth_callback(char *prompt, gboolean secret, - CamelService *service, char *item, - CamelException *ex) -{ - printf ("auth_callback called: %s\n", prompt); - return NULL; -} - -int -main (int argc, char**argv) -{ - CamelSession *session; - CamelException *ex; - CamelStore *store; - gchar *store_url = "mbox:///tmp/evmail"; - CamelFolder *folder; - CamelMimeMessage *message; - GList *uid_list; - int camel_debug_level = 10; - GList *matches; - - gtk_init (&argc, &argv); - camel_init (); - ex = camel_exception_new (); - camel_provider_register_as_module ("../camel/providers/mbox/.libs/libcamelmbox.so.0"); - - session = camel_session_new (auth_callback); - store = camel_session_get_store (session, store_url, ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught in camel_session_get_store\n" - "Full description : %s\n", camel_exception_get_description (ex)); - return -1; - } - - printf("get folder\n"); - - folder = camel_store_get_folder (store, "Inbox", ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught in camel_store_get_folder\n" - "Full description : %s\n", camel_exception_get_description (ex)); - return -1; - } - - printf("open folder\n"); - - camel_folder_open (folder, FOLDER_OPEN_READ, ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught when trying to open the folder\n" - "Full description : %s\n", camel_exception_get_description (ex)); - return -1; - } - - - printf("Search for messages\n"); - - matches = camel_folder_search_by_expression (folder, "(or (match-all (header-contains \"subject\" \"term\")) (match-all (header-contains \"subject\" \"gnome\")))", ex); - - if (matches) { - GList *n; - printf("search found matches:\n"); - n = matches; - while (n) { - printf("uid: %s\n", n->data); - n = g_list_next(n); - } - - } else { - printf("no matches?\n"); - } - - camel_folder_close (folder, FALSE, ex); - - return 0; -} - - - - diff --git a/tests/test2.c b/tests/test2.c deleted file mode 100644 index 17fd4ffc9a..0000000000 --- a/tests/test2.c +++ /dev/null @@ -1,53 +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\n"); - printf ("You must create the file mail.test before running this test\n"); - exit(2); - } - - - camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; - - camel_data_wrapper_set_input_stream ( CAMEL_DATA_WRAPPER (message), input_stream); - - camel_medium_get_content_object (CAMEL_MEDIUM (message)); - -#if 0 - 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)); -#endif - 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 -#include - -#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?= ", - "=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= ", - "=?ISO-8859-1?Q?Andr=E9?= Pirard ", - "=?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=", - "=?ISO-8859-1?Q?Olle_J=E4rnefors?= ", - "=?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= ", - "Nathaniel Borenstein (=?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 -#include - -#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/test9.c b/tests/test9.c deleted file mode 100644 index d645ec821a..0000000000 --- a/tests/test9.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include "camel.h" -#include "camel-mbox-folder.h" -#include "camel-mbox-parser.h" -#include "camel-mbox-utils.h" -#include "camel-mbox-summary.h" -#include "camel-log.h" -#include "camel-exception.h" -#include "md5-utils.h" -#include -#include -#include -#include -#include -#include -#include - -int -main (int argc, char**argv) -{ - GArray *message_info_array; - gint test_file_fd; - CamelException *ex; - CamelMboxSummary *sum1, *sum2; - GArray *mbox_summary_info; - CamelMboxSummaryInformation *msg_info; - int i; - guint32 next_uid; - guint32 mbox_file_size; - - //camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; - camel_debug_level = 0; - - gtk_init (&argc, &argv); - camel_init (); - - ex = camel_exception_new (); - test_file_fd = open (argv[1], O_RDONLY); - message_info_array = camel_mbox_parse_file (test_file_fd, - "From ", - 0, - &mbox_file_size, - &next_uid, - TRUE, - NULL, - 0, - ex); - - close (test_file_fd); - camel_mbox_write_xev (argv[1], message_info_array, &mbox_file_size, 1, ex); - if (camel_exception_get_id (ex)) { - printf ("Exception caught in camel_mbox_write_xev : %s\n", camel_exception_get_description (ex)); - } - - - mbox_summary_info = - parsed_information_to_mbox_summary (message_info_array); - sum1 = g_new (CamelMboxSummary, 1); - - md5_get_digest_from_file (argv[1], sum1->md5_digest); - sum1->nb_message = mbox_summary_info->len; - - sum1->message_info = mbox_summary_info; - - camel_mbox_save_summary (sum1, "ev-summary.mbox", ex); - - sum2 = camel_mbox_load_summary ("ev-summary.mbox", ex); - - for (i=0; inb_message; i++) { - - msg_info = (CamelMboxSummaryInformation *)(sum1->message_info->data) + i; - printf ("Message %d :\n" - " From : %s\n", i, msg_info->sender); - } - - printf ("Taille du fichier mbox : %ld\n", mbox_file_size); - printf ("\t in the summary : %ld\n", sum1->mbox_file_size ); - - return 1; - -} - - - diff --git a/tests/ui-tests/.cvsignore b/tests/ui-tests/.cvsignore deleted file mode 100644 index 1306f0397b..0000000000 --- a/tests/ui-tests/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile.in -Makefile -.deps -.libs -store_listing -msg-composer-test -message-browser diff --git a/tests/ui-tests/Makefile.am b/tests/ui-tests/Makefile.am deleted file mode 100644 index af391305ea..0000000000 --- a/tests/ui-tests/Makefile.am +++ /dev/null @@ -1,28 +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) - -message_browser_LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(INTLLIBS) \ - $(EXTRA_GNOME_LIBS) \ - $(PTHREAD_LIB) \ - $(EXTRA_GNOME_LIBS) \ - -lgtkhtml -lgnomeprint ../../mail/html-stream.o - - -noinst_PROGRAMS = \ - message-browser diff --git a/tests/ui-tests/message-browser.c b/tests/ui-tests/message-browser.c deleted file mode 100644 index fbd0550571..0000000000 --- a/tests/ui-tests/message-browser.c +++ /dev/null @@ -1,596 +0,0 @@ -/*--------------------------------*-C-*---------------------------------* - * - * Copyright 2000, Matt Loper . - * - * 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 Street #330, Boston, MA 02111-1307, USA. - * - *----------------------------------------------------------------------*/ - -#include -#include -#include -#include -#include -#include -#include "../../mail/html-stream.h" -#include - -/* gtkhtml stuff */ -#include - -static void -print_usage_and_quit() -{ - g_print ("Usage: message-browser [FILENAME]\n"); - g_print ("Where FILENAME is the filename of a mime message "); - g_print ("in \"message/rfc822\" format.\n"); - exit (0); -} - - -/*----------------------------------------------------------------------* - * Filling out the tree control view of a mime-message - *----------------------------------------------------------------------*/ - -static void -handle_tree_item (CamelDataWrapper* object, GtkWidget* tree_ctrl) -{ - GtkWidget* tree_item; - gchar* label = gmime_content_field_get_mime_type (object->mime_type); - - CamelDataWrapper* containee; - GtkWidget* containee_tree_item; - gchar* containee_label; - - GtkWidget* subtree = NULL; - - tree_item = gtk_tree_item_new_with_label (label); - gtk_object_set_data (GTK_OBJECT (tree_item), - "camel_data_wrapper", object); - gtk_tree_append (GTK_TREE (tree_ctrl), tree_item); - - gtk_widget_show(tree_item); - - /* If our object is a leaf, we're done */ - if (!CAMEL_IS_MEDIUM (object)) - return; - - containee = - camel_medium_get_content_object ( - CAMEL_MEDIUM (object)); - - g_assert (containee); - - /* If it is a container, insert its contents into the tree */ - containee_label = camel_data_wrapper_get_mime_type (containee); - - subtree = gtk_tree_new(); - - containee_tree_item = - gtk_tree_item_new_with_label (containee_label); - gtk_object_set_data (GTK_OBJECT (containee_tree_item), - "camel_data_wrapper", - containee); - gtk_tree_append (GTK_TREE (subtree), containee_tree_item); - - gtk_tree_item_set_subtree (GTK_TREE_ITEM(tree_item), - GTK_WIDGET (subtree)); - gtk_widget_show(containee_tree_item); - - if (CAMEL_IS_MULTIPART (containee)) - { - CamelMultipart* multipart = - CAMEL_MULTIPART (containee); - int max_multiparts = - camel_multipart_get_number (multipart); - int i; - - if (max_multiparts > 0) { - subtree = gtk_tree_new(); - gtk_tree_item_set_subtree ( - GTK_TREE_ITEM(containee_tree_item), - GTK_WIDGET (subtree)); - } - - for (i = 0; i < max_multiparts; i++) { - CamelMimeBodyPart* body_part = - camel_multipart_get_part ( - multipart, i); - - handle_tree_item ( - CAMEL_DATA_WRAPPER (body_part), - GTK_WIDGET (subtree)); - } - - } - gtk_tree_item_expand ( - GTK_TREE_ITEM (containee_tree_item)); - gtk_tree_item_expand (GTK_TREE_ITEM (tree_item)); -} - -static GtkWidget* -get_gtk_html_contents_window (CamelDataWrapper* data); - -static void -tree_selection_changed( GtkWidget *tree ) -{ - GList *i; - - i = GTK_TREE_SELECTION(tree); - while (i){ - gchar* name; - GtkLabel* label; - GtkWidget* item; - CamelDataWrapper* camel_data_wrapper; - - /* Get a GtkWidget pointer from the list node */ - item = GTK_WIDGET (i->data); - camel_data_wrapper = - gtk_object_get_data (GTK_OBJECT (item), - "camel_data_wrapper"); - - g_assert (camel_data_wrapper); - get_gtk_html_contents_window (camel_data_wrapper); - - label = GTK_LABEL (GTK_BIN (item)->child); - gtk_label_get (label, &name); - g_print ("\t%s on level %d\n", name, GTK_TREE - (item->parent)->level); - i = i->next; - } -} - -static GtkWidget* -get_message_tree_ctrl (CamelMimeMessage* message) -{ - static GtkWidget* scroll_wnd = NULL; - static GtkWidget* tree_ctrl = NULL; - - /* create the tree control, if it doesn't exist already */ - if (!tree_ctrl) { - - tree_ctrl = gtk_tree_new (); - - gtk_signal_connect (GTK_OBJECT(tree_ctrl), - "selection_changed", - GTK_SIGNAL_FUNC(tree_selection_changed), - tree_ctrl); - - scroll_wnd = gtk_scrolled_window_new (NULL,NULL); - - gtk_scrolled_window_add_with_viewport ( - GTK_SCROLLED_WINDOW(scroll_wnd), - tree_ctrl); - - gtk_widget_set_usize (scroll_wnd, 225, 200); - } - else - gtk_tree_clear_items (GTK_TREE (tree_ctrl), 0, 1); - - - /* Recursively insert tree items in the tree */ - if (message) - handle_tree_item (CAMEL_DATA_WRAPPER (message), tree_ctrl); - gtk_scrolled_window_set_policy ( - GTK_SCROLLED_WINDOW (scroll_wnd), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - return scroll_wnd; -} - -static CamelMimeMessage* -filename_to_camel_msg (gchar* filename) -{ - CamelMimeMessage* message; - CamelStream* input_stream; - - camel_init(); - - input_stream = camel_stream_fs_new_with_name ( - filename, CAMEL_STREAM_FS_READ); - - if (!input_stream) - return NULL; - - message = camel_mime_message_new_with_session ( - (CamelSession *)NULL); - - camel_data_wrapper_set_input_stream ( - CAMEL_DATA_WRAPPER (message), input_stream); - - return message; -} - -/*----------------------------------------------------------------------* - * Filling out the HTML view of a mime message - *----------------------------------------------------------------------*/ - -static void -data_wrapper_to_html (CamelDataWrapper *msg, gchar** body_string) -{ - CamelFormatter* cmf = camel_formatter_new(); - CamelStream* body_stream = - camel_stream_mem_new (CAMEL_STREAM_FS_WRITE); - - g_assert (body_string); - - camel_formatter_wrapper_to_html ( - cmf, msg, body_stream); - - *body_string = g_strndup ( - CAMEL_STREAM_MEM (body_stream)->buffer->data, - CAMEL_STREAM_MEM (body_stream)->buffer->len); -} - -static void -mime_message_header_to_html (CamelMimeMessage *msg, gchar** header_string) -{ - CamelFormatter* cmf = camel_formatter_new(); - CamelStream* header_stream = - camel_stream_mem_new (CAMEL_STREAM_FS_WRITE); - - g_assert (header_string); - - camel_formatter_mime_message_to_html ( - cmf, CAMEL_MIME_MESSAGE (msg), header_stream, NULL); - - *header_string = g_strndup ( - CAMEL_STREAM_MEM (header_stream)->buffer->data, - CAMEL_STREAM_MEM (header_stream)->buffer->len); -} - - -static void -on_link_clicked (GtkHTML *html, const gchar *url, gpointer data) -{ - GtkWidget* message_box; - CamelStream *stream; - CamelStream *save_stream; - gchar tmp_buffer[4096]; - gint nb_bytes_read; - - gchar* message = - g_strdup_printf ("You have clicked on this link:\n%s", url); - - if (sscanf (url, "camel://%p", &stream)) - { - save_stream = - camel_stream_fs_new_with_name ("saved-file", - CAMEL_STREAM_FS_WRITE); - - - do { - - /* read next chunk of text */ - nb_bytes_read = camel_stream_read (stream, - tmp_buffer, - 4096); - - /* If there's any text, write it to the stream */ - if (nb_bytes_read > 0) { - camel_stream_write (save_stream, - tmp_buffer, - nb_bytes_read); - } - - - } while (!camel_stream_eos (stream)); - - camel_stream_close (save_stream); - } - - message_box = gnome_message_box_new (message, - GNOME_MESSAGE_BOX_INFO, - "Okay", NULL); - - gnome_dialog_set_default (GNOME_DIALOG (message_box), 1); - gnome_dialog_run (GNOME_DIALOG (message_box)); - g_free (message); -} - - -static GtkWidget* -get_gtk_html_contents_window (CamelDataWrapper* data) -{ - static GtkWidget* frame_wnd = NULL; - static GtkWidget* scroll_wnd = NULL; - static GtkWidget* html_widget = NULL; - HTMLStream* html_stream; - gchar *body_string; - - /* create the html widget and scroll window, if they haven't - already been created */ - if (!html_widget) { - html_widget = gtk_html_new(); - - gtk_signal_connect (GTK_OBJECT (html_widget), - "link_clicked", - GTK_SIGNAL_FUNC (on_link_clicked), - NULL); - - scroll_wnd = gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (scroll_wnd), html_widget); - } - - if (data) { - - html_stream = - HTML_STREAM (html_stream_new (GTK_HTML (html_widget))); - - /* turn the mime message into html, and - write it to the html stream */ - data_wrapper_to_html (data, &body_string); - - camel_stream_write (CAMEL_STREAM (html_stream), - body_string, - strlen (body_string)); - - camel_stream_close (CAMEL_STREAM (html_stream)); - - g_free (body_string); - } - - - if (!frame_wnd) { - - frame_wnd = gtk_frame_new (NULL); - gtk_frame_set_shadow_type ( - GTK_FRAME (frame_wnd), GTK_SHADOW_IN); - - gtk_widget_set_usize (scroll_wnd, 500, 400); - gtk_scrolled_window_set_policy ( - GTK_SCROLLED_WINDOW (scroll_wnd), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - gtk_container_add (GTK_CONTAINER (frame_wnd), scroll_wnd); - } - - return frame_wnd; -} - - -static GtkWidget* -get_gtk_html_header_window (CamelMimeMessage* mime_message) -{ - static GtkWidget* frame_wnd = NULL; - static GtkWidget* scroll_wnd = NULL; - static GtkWidget* html_widget = NULL; - HTMLStream* html_stream; - gchar* header_string; - - /* create the html widget and scroll window, if they haven't - already been created */ - if (!html_widget) { - html_widget = gtk_html_new(); - scroll_wnd = gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (scroll_wnd), html_widget); - } - - if (mime_message) { - - html_stream = - HTML_STREAM (html_stream_new (GTK_HTML (html_widget))); - - /* turn the mime message into html, and - write it to the html stream */ - mime_message_header_to_html (mime_message, &header_string); - - camel_stream_write (CAMEL_STREAM (html_stream), - header_string, - strlen (header_string)); - - camel_stream_close (CAMEL_STREAM (html_stream)); - - g_free (header_string); - } - - if (!frame_wnd) { - - frame_wnd = gtk_frame_new (NULL); - gtk_frame_set_shadow_type ( - GTK_FRAME (frame_wnd), GTK_SHADOW_OUT); - - gtk_widget_set_usize (scroll_wnd, 500, 75); - gtk_scrolled_window_set_policy ( - GTK_SCROLLED_WINDOW (scroll_wnd), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - gtk_container_add (GTK_CONTAINER (frame_wnd), scroll_wnd); - } - - - return frame_wnd; -} - -static GtkWidget* -get_gtk_html_window (CamelMimeMessage* mime_message) -{ - static GtkWidget* vbox = NULL; - GtkWidget* html_header_window = NULL; - GtkWidget* html_content_window = NULL; - - html_content_window = - get_gtk_html_contents_window ( - CAMEL_DATA_WRAPPER (mime_message)); - - html_header_window = - get_gtk_html_header_window (mime_message); - - if (!vbox) { - vbox = gtk_vbox_new (FALSE, 0); - - gtk_box_pack_start ( - GTK_BOX (vbox), - html_header_window, - TRUE, TRUE, 5); - - gtk_box_pack_start ( - GTK_BOX (vbox), - html_content_window, - TRUE, FALSE, 5); - } - - return vbox; -} - - - -/*----------------------------------------------------------------------* - * Menu callbacks and information - *----------------------------------------------------------------------*/ - -static gchar* fileselection_prev_file = NULL; - -static void -open_ok (GtkWidget *widget, GtkFileSelection *fs) -{ - int ret; - GtkWidget *error_dialog; - - if (fileselection_prev_file) - g_free (fileselection_prev_file); - - 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 { - gchar *filename = gtk_file_selection_get_filename (fs); - CamelMimeMessage* message = filename_to_camel_msg (filename); - - if (message) { - fileselection_prev_file = g_strdup (filename); - get_message_tree_ctrl (message); - get_gtk_html_window (message); - } - else - gnome_message_box_new ("Couldn't load message.", - GNOME_MESSAGE_BOX_WARNING); - - gtk_widget_destroy (GTK_WIDGET (fs)); - } -} - - -static void -file_menu_open_cb (GtkWidget *widget, void* data) -{ - GtkFileSelection *fs; - - fs = GTK_FILE_SELECTION ( - gtk_file_selection_new (_("Open Mime Message"))); - - if (fileselection_prev_file) - gtk_file_selection_set_filename (fs, fileselection_prev_file); - - 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)); /* Make it modal */ -} - -static void -file_menu_exit_cb (GtkWidget *widget, void *data) -{ - gtk_main_quit (); -} - - -static GnomeUIInfo file_menu [] = { - GNOMEUIINFO_MENU_OPEN_ITEM (file_menu_open_cb, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_EXIT_ITEM (file_menu_exit_cb, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo main_menu[] = { - GNOMEUIINFO_MENU_FILE_TREE (file_menu), - GNOMEUIINFO_END -}; - - -/*----------------------------------------------------------------------* - * Main() - *----------------------------------------------------------------------*/ - -int -main (int argc, char *argv[]) -{ - /* app contains hbox, hbox contains other 2 windows */ - GtkWidget* app; - GtkWidget* hpane; - GtkWidget* tree_ctrl_window; - GtkWidget* html_window; - - CamelMimeMessage* message = NULL; - - /* initialization */ - gnome_init ("MessageBrowser", "1.0", argc, argv); - app = gnome_app_new ("Message Browser Test", NULL); - gnome_app_create_menus (GNOME_APP (app), main_menu); - - /* parse command line */ - if (argc > 2 || - (argc==2 && strstr (argv[1], "--help") != 0)) - print_usage_and_quit(); - if (argc == 2) { - if (strstr (argv[1], "--help") != 0) - print_usage_and_quit(); - message = filename_to_camel_msg (argv[1]); - if (!message) { - g_print ("Couldn't load message."); - } - } - - hpane = gtk_hpaned_new(); - - /* add the tree control view of the message*/ - tree_ctrl_window = get_message_tree_ctrl (message); - gtk_paned_add1 (GTK_PANED (hpane), tree_ctrl_window); - - /* add the HTML view of the message */ - html_window = get_gtk_html_window (message); - gtk_paned_add2 (GTK_PANED (hpane), html_window); - - /* rock n roll */ - gnome_app_set_contents (GNOME_APP (app), - hpane); - gtk_widget_show_all (app); - gtk_signal_connect (GTK_OBJECT (app), "destroy", - GTK_SIGNAL_FUNC(gtk_main_quit), - &app); - if (!message) - file_menu_open_cb (NULL, NULL); - - gtk_main(); - - return 1; -} 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 -#include - -#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; idata; - 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 @@ - - - - - store_listing - store_listing - - src - pixmaps - C - True - True - False - True - True - True - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h - - - - - GnomeApp - app1 - 600 - 400 - store_listing - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - True - - - GnomeDock - GnomeApp:dock - dock1 - True - - 0 - True - True - - - - GnomeDockItem - dockitem1 - 2 - GNOME_DOCK_TOP - 0 - 0 - 0 - False - True - False - True - False - GTK_SHADOW_OUT - - - GtkMenuBar - menubar1 - GTK_SHADOW_NONE - - - GtkMenuItem - file1 - GNOMEUIINFO_MENU_FILE_TREE - - - GtkMenu - file1_menu - - - GtkMenuItem - separator1 - False - - - - GtkPixmapMenuItem - exit - - activate - on_exit_activate - Tue, 10 Aug 1999 12:06:35 GMT - - GNOMEUIINFO_MENU_EXIT_ITEM - - - - - - GtkMenuItem - store2 - - False - - - GtkMenu - store2_menu - - - GtkPixmapMenuItem - new_store - - activate - on_new_store_activate - Tue, 10 Aug 1999 10:29:12 GMT - - GNOMEUIINFO_MENU_NEW_ITEM - - - - - - - GtkMenuItem - folder1 - - activate - on_folder1_activate - Sat, 14 Aug 1999 17:23:25 GMT - - - False - - - GtkMenu - folder1_menu - - - GtkPixmapMenuItem - expunge - - activate - on_expunge_activate - Sat, 14 Aug 1999 16:36:03 GMT - - - False - GNOME_STOCK_MENU_CONVERT - - - - - - GtkMenuItem - message_menu - - False - - - GtkMenu - message_menu_menu - - - GtkPixmapMenuItem - message_delete - - activate - on_message_delete_activate - Sat, 14 Aug 1999 14:54:04 GMT - - - False - GNOME_STOCK_MENU_TRASH - - - - - - GtkMenuItem - help1 - GNOMEUIINFO_MENU_HELP_TREE - - - GtkMenu - help1_menu - - - GtkPixmapMenuItem - about - - activate - on_about_activate - Tue, 10 Aug 1999 12:06:58 GMT - - GNOMEUIINFO_MENU_ABOUT_ITEM - - - - - - - - GnomeDockItem - dockitem2 - 1 - GNOME_DOCK_TOP - 1 - 0 - 0 - False - True - False - False - False - GTK_SHADOW_OUT - - - GtkToolbar - toolbar1 - 1 - GTK_ORIENTATION_HORIZONTAL - GTK_TOOLBAR_BOTH - 16 - GTK_TOOLBAR_SPACE_LINE - GTK_RELIEF_NONE - True - - - GtkButton - Toolbar:button - new_store_button - - clicked - on_new_store_activate - Tue, 10 Aug 1999 12:17:17 GMT - - - GNOME_STOCK_PIXMAP_NEW - - - - - - GtkHPaned - GnomeDock:contents - hpaned1 - 10 - 6 - 0 - - - GtkCTree - store-and-mailbox-tree - 150 - True - - button_press_event - on_store_and_mailbox_tree_button_press_event - Mon, 16 Aug 1999 13:06:15 GMT - - 1 - 80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_IN - - True - False - - - - GtkLabel - CTree:title - store_and_inbox_name - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - GtkCList - message-clist - True - 3 - 80,80,80 - GTK_SELECTION_SINGLE - True - GTK_SHADOW_IN - - True - True - - - - GtkLabel - CList:title - message_date_label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - CList:title - message_sender_label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkLabel - CList:title - message_subject_label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - - GnomeAppBar - GnomeApp:appbar - appbar1 - True - True - - 0 - True - True - - - - - - GnomeAbout - about_widget - False - True - - Bertrand Guiheneuf <Bertrand.Guiheneuf@aful.org> - - This is a very simple program to test Camel - - - - GnomeDialog - new_store_dialog - False - New store - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - True - True - - - GtkVBox - GnomeDialog:vbox - dialog-vbox1 - False - 8 - - 4 - True - True - - - - GtkVBox - vbox1 - False - 0 - - 0 - True - True - - - - GtkLabel - new_store_label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 29 - - 0 - False - False - - - - - GnomeEntry - new-store-entry - store_name_history - 15 - - 0 - False - False - - - - GtkEntry - GnomeEntry:entry - new-store-dialog-combo-entry - True - True - True - 0 - - - - - - - GtkHButtonBox - GnomeDialog:action_area - dialog-action_area1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CANCEL - - - - - - diff --git a/tests/ui-tests/test-multipart-alt.msg b/tests/ui-tests/test-multipart-alt.msg deleted file mode 100644 index aa0da18b82..0000000000 --- a/tests/ui-tests/test-multipart-alt.msg +++ /dev/null @@ -1,17738 +0,0 @@ -From - Sat Jun 1 19:00:50 1996 -X-Mozilla-Status: 0001 -Message-ID: <31B0F5D1.41C6@netscape.com> -Date: Sat, 01 Jun 1996 19:00:49 -0700 -From: Jamie Zawinski -Organization: Netscape Communications Corporation, Mozilla Division -X-Mailer: Mozilla 2.0 (X11; U; IRIX 5.3 IP22) -MIME-Version: 1.0 -To: Jamie Zawinski -Subject: multipart/alternative -Content-Type: multipart/mixed; boundary="------------outer" - -This is a multi-part message in MIME format. - ---------------outer - -Here comes some multipart/alternative junk. It's rilly rilly big. - ---------------outer -Content-Type: multipart/alternative; boundary="------------167E2781446B" - ---------------167E2781446B -Content-Type: text/plain; charset=iso-8859-1; name="album-list.txt" -Content-Transfer-Encoding: 8bit -Content-Disposition: inline; filename="album-list.txt" - - jwz's tunes - Last modified: 1-jun-96. - -This is a list of all of the music I have on CD, tape, and vinyl (including -all of the old, embarrasing stuff...) This page may look a little funny if -you aren't using a browser that supports HTML tables, like Mozilla. - - ``Publishing CD lists and tape collections evokes images of - lonely, pathetic men who talk about their cats incessantly.'' -- - Paul Phillips - -I used to have this set up so that clicking on any name would take you to -the appropriate entry of the All Music Guide at -gopher://allmusic.ferris.edu; but they have since moved their database from -there to cdnow.com, and in the process, have obfuscated access to the -database to such an extent that this is no longer possible. In order to get -at the discographies, you need to weed your way through dozens of pages, and -there seems to be no even semi-reliable way to pre-compute the URL that they -will use. Arrgh! - -The Internet Movie Database has an excellent interface for this sort of -thing; I really wish more people would emulate that system. - -In this list, I've included links to various related web pages that I've -come across; one very cool and well-organized database to which many of -these links point is The Ultimate Band List; check it out! - - Jamie Zawinski - ----------------------------------------------------------------------------- - - * Act UBL Card: 4637 - 1988: Laughter, Tears, and Rage See also: rt66.com - See also: - hcl.chass.ncsu.edu - * Age of Chance - 1987: Kiss (single) - 1987: Don't Get Mad, Get Even (single) - * Alien Sex Fiend UBL Card: 5291 - 1983-1992: Drive My Rocket (comp) See also: cent1.lancs.ac.uk - 1989: Too Much Acid? (live) - 1990: Curse - 1992: Open Head Surgery - 1993: Altered States of America (live) - 1995: Inferno: The Odyssey Continuestm - (soundtrack) - * Alio Die - 1993: Under a Holy Ritual - UBL Card: 1266 - See also: www.projekt.com - * Alphaville UBL Card: 3056 - 1984: Forever Young See also: www.escape.com - * Altered Images - 1981: Happy Birthday - 1983: Bite - 1984: Collected Images (comp) - * An April March - 1995: Lessons in Vengance - 1995: Instruments of Lust and Fury - * And Also the Trees - 1983-1992: From Horizon to Horizon - (comp) - UBL Card: 1867 - See also: - www.ugcs.caltech.edu - See also: - onyx.dartmouth.edu - * Anderson, Laurie UBL Card: 1494 - 1982: Big Science See also: www.voyagerco.com - 1983: United States Live, parts 1-4 (5 - albums) See also: www.netpart.com - 1984: Mister Heartbreak See also: www.c3.lanl.gov - 1986: Home of the Brave (live - soundtrack) - 1995: Bright Red - * Ant, Adam - 1980: Kings of the Wild Frontier - 1981: Prince Charming - 1982: Friend or Foe - 1983: Dirk Wears White Sox - 1985: Viva Le Rock - 1979-1986: Antics in the Forbidden Zone - (comp) - UBL Card: 1205 - See also: www.uhs.uga.edu - See also: caprec.com - - * Anthrax UBL Card: 2710 - 1991: Attack of the Killer B's (comp) - * Aphex Twin - 1993: On (EP) - 1994: Analogue Bubblebath (EP) - 1995: Ventolin (EP) - UBL Card: 5279 - See also: hyperreal.com - See also: pathfinder.com - - * Arcadia UBL Card: 1259 - 1985: So Red the Rose - * Armageddon Dildos - 1995: Lost - UBL Card: 2538 - - * Ash, Daniel See also: - 1991: Coming Down isvpc146.isv.uit.no - 1992: Foolish Thing Desire - * Archangel, Nathalie - 1992: Owl - * Art of Noise UBL Card: 1918 - 1983: Who's Afraid of the Art of Noise? See also: rt66.com - - 1983: The Art of Noise Have Closed Up - 1983: Beatbox - 1983: Daft - 1984: Edited (picture disc) - * Attrition - 1985: Smiling, at the Hypogonder Club - (comp) - UBL Card: 4232 - See also: www.projekt.com - - * AUTECHRe - 1994: INCUNABULA - 1994: BASSCAD,EP (EP) - 1994: Amber - 1995: Garbage - * B52's - 1979: B52's - 1980: Wild Planet - 1982: Mesopotamia - 1983: Whammy! - 1981: Party Mix - UBL Card: 2268 - - * Babes in Toyland UBL Card: 3190 - 1989: Spanking Machine - 1991: To Mother - 1992: Fontanelle - 1993: Pain Killers - 1995: Nemesisters - * Battery - 1992: Meat Market (EP) - 1993: Mutate - 1994: Lillith 3.2 (EP) - 1995: nv - * Bauhaus UBL Card: 1235 - 1979: Bela Lugosi's Dead (EP) See also: - 1981: In the Flat Field gothic.acs.csulb.edu - 1981: Mask See also: - 1981: Press the Eject and Give Me the isvpc146.isv.uit.no - Tape (live) - 1983: Burning from the Inside - 1979-1984: 1979-1984 (comp) - 1985: The Sky's Gone Out - 1984: The Last Temptation (live boot) - 1984: Rest In Peace: The Final Concert - (double live) - 1996: The Passion of Covers: A Tribute - (various) - * Belly - 1993: Star - 1993: Moon (EP) - 1995: Baby Silvertooth (EP) - 1995: King - UBL Card: 1360 - See also: - isvpc146.isv.uit.no - - * Berlin UBL Card: 4156 - 1981: Love Life - 1981: Dancing in Berlin / Lost in the - Crowd (single) - 1982: Pleasure Victim - 1986: Count 3 and Pray - * Big Black - 1983: The Hammer Party - 1987: Songs About Fucking - 1992: The Rich Man's Eight-Track Tape - (comp) - UBL Card: 2410 - - * Big Hat UBL Card: 1217 - 1993: Selena at my Window See also: www.cec.wustl.edu - * Bigod 20 - 1990: The Bog (EP) - 1991: Carpe Diem (EP) - * Bikini Kill UBL Card: 4444 - 1991-1992: The C.D. Version of the See also: www.columbia.edu - First Two Records - * Billy Nayer Show, The - 1994: The Ketchup and Mustard Man - * Billy and the Boingers - 1987: U Stink but I Love You (flexydisk) - * Birdsongs of the Messozoic - 1980-1987: The Fossil Record - 1983: Sonic Geology - * Birmingham 6 UBL Card: 4348 - 1995: Police State - * Black Tape for a Blue Girl - 1986: The Rope - 1987: Mesmerized by the Sirens - 1989: Ashes in the Brittle Air - 1993: This Lush Garden Within - UBL Card: 1202 - See also: www.projekt.com - - * Bleeding Stone, The - 1994: Silent Insanity (EP) - * Blondie - 1980: Autoamerican - 1983: Best of Blondie - UBL Card: 2070 - - * Blotto - 1994: Collected Works - * Body Count - 1992: Body Count - UBL Card: 1277 - - * Bowie, David UBL Card: 1098 - 1995: Outside - * Bow Wow Wow - 1982: See Jungle - 1981-1982: I Want Candy (comp) - 1983: When the Going Gets Tough - 1981-1983: Girl Bites Dog (comp) - UBL Card: 2301 - - * Breeders, The UBL Card: 1242 - 1993: Last Splash See also: - isvpc146.isv.uit.no - * Brücken, Claudia - 1991: Love and a Million Other Things - UBL Card: 4636 - See also: rt66.com - See also: - hcl.chass.ncsu.edu - * Buggles, The - 1979: The Age of Plastic - 1981: Adventures in Modern Recording - * Bush, Kate - 1977: The Kick Inside - 1980: Never For Ever - 1983: The Dreaming - 1985: Hounds of Love - UBL Card: 1032 - See also: actor.cs.vt.edu - See also: - www.jrc.flinders.edu.au - See also: - holly.city.unisa.edu.au - * Buzzcocks UBL Card: 1351 - 1976-1979: Operators Manual - * Cabaret Voltaire - 1974-1976: 1974-1976 (comp) - 1978-1983: The Golden Moments of CV - (comp) - 1978: Nag Nag Nag (EP) - 1979: Mix-Up (EP) - 1980: Red Mecca - 1981: The Voice of America - 1981: Johnny Yesno (soundtrack) - 1982: 2X45 - 1982: Eight Crepescule Tracks - 1983: The Crackdown - 1984: Micro-Phonies - 1985: I Want You (single) - 1985: Drinking Gasoline - 1985: The Arm of the Lord - 1985: The Convenant, the Sword, and the - Arm of the Lord - 1986: The Drain Train - 1987: Code - 1990: Listen Up (double comp) - 1991: Body and Soul - 1991: Colors - 1992: Plasticity - 1992: Western Reworks - UBL Card: 2307 - - * Cave, Nick UBL Card: 1273 - 1984: From Her to Eternity - 1988: Tender Prey - * Chemlab - 1993: Burnout at the Hydrogen Bar - 1994: Magnetic Field Remixes (EP) - UBL Card: 3774 - - * Children on Stun - 1994: Tourniquets of Love's Desire - * Christian Death - 1982: Only Theatre of Pain - 1988: Sex and Drugs and Jesus - Christ - 1989: All the Love All the Hate - part Two: All the Hate - 1994: Sexy Death God - UBL Card: 1218 - See also: - christian-death.acc.brad.ac.uk - - * Chris and Cosey - 1989: Trust - * Ciccone Youth - 1988: The Whitey Album - UBL Card: 1087 - - * ClockDVA UBL Card: 3999 - 1981: Thirst - 1988: The Hacker/The Act - * Cocteau Twins - 1982: Garlands - 1983: Head over Heels - 1984: The Spangle Maker (EP) - 1984: Treasure - 1985: Aikea-Guinea (EP) - 1985: Echoes in a Shallow Bay - 1985: Tiny Dynamine (EP) - 1982-1985: The Pink Opaque - UBL Card: 1074 - See also: - garnet.berkeley.edu - See also: - isvpc146.isv.uit.no - - * Coil UBL Card: 1388 - 1986?: The Angelic Conversation - (soundtrack) - 1988: Gold is the Metal - 1990: The Unreleased Themes for - Hellraiser (EP) - 1990: Panic / Tainted Love (single) - 1991: Out of Light Cometh Darkness - 1992: Snow (EP) - * Concrete Blonde - 1986: Concrete Blonde - 1989: Free - 1990: Bloodletting - 1993: Walking in London (single) - 1993: Mexican Moon - UBL Card: 1396 - - * Cop Shoot Cop - 1993: Ask Questions Later - * Course of Empire - 1990: Course of Empire - 1993: Infested! (EP) - 1994: Initiation - UBL Card: 2889 - See also: - homepage.seas.upenn.edu - - * Cranes UBL Card: 2400 - 1990: Inescapable (EP) See also: - 1991: Wings of Joy busop.cit.wayne.edu - 1992: Self-Non-Self - 1993: Forever - 1993: Jewel (EP) - 1994: Loved - 1994: Shining Road (limited edition - double EP) - * Crash Worship - 1992: ADRV - UBL Card: 1901 - See also: www.meer.net - See also: www.tyrell.net - * Creatures, The UBL Card: 1216 - 1983: Feast - 1990: Boomerang - 1990: Fury Eyes (EP) - 1990: Standing There (single) - * Cure, The - 1980: Boys Don't Cry - 1980: Seventeen Seconds - 1981: Faith - 1982: Pornography - 1982: The Walk - 1982?: Looking for a Forest (live boot) - - 1983: Japanese Whispers - 1983: Lovecats (EP) - 1984: Concert (live) - 1984: The Top - 1985: The Head on the Door - 1987: Staring at the Sea (comp) - 1988: Kiss Me Kiss Me Kiss Me - 1989: Disintegration - 1989: Fascination Street (single) - 1990: Never Enough (single) - 1995?: Give Me the Cure: 18 DC Bands - (various) - UBL Card: 1159 - See also: - www.acpub.duke.edu - See also: pathfinder.com - - * Current 93 UBL Card: 3465 - 1986-1991: Island - * Curve - 1991: Frozen (EP) - 1991: Cherry (EP) - 1992: Doppelganger - 1993: Cuckoo - UBL Card: 1355 - See also: - quark.stack.urc.tue.nl - See also: - blade.stack.urc.tue.nl - * Cyber-Tec - 1995: Cyber-Tec - * Daisy Chainsaw - 1992: Hope All Your Dreams Come True (single) - 1992: Love Sick Pleasure (EP) - 1992: Eleventeen - 1994: For They Know Not What They Do - * Dance or Die - 1993: Psychoburbia - * Danse Society, The - 1984: Heaven is Waiting - 1986: Looking Through - * Das Ich UBL Card: 2337 - 1990: Satanische Verse - * Dax, Danielle - 1986-1988: Dark Adapted Eye (comp +5) - 1988: Whistling for his Love (single) - 1988: Cat House (single) - 1990: Blast the Human Flower - 1992: Pop-Eyes - 1995: Timber Tongue (EP) - UBL Card: 1746 - - * Death in June - 1992: But, What Ends When the Symbols Shatter? - * Definition FX - 1993: Something Inside (single) - 1993: Light Speed Collision - See also: www.geko.com.au - - * Depeche Mode UBL Card: 1041 - 1981: Speak & Spell See also: www.cis.ufl.edu - 1981: Just Can't Get Enough / Any See also: - Second Now (single) www.coma.sbg.ac.at - 1982: A Broken Frame - 1982: live singles (comp) - 1983: Construction Time Again - 1984: People Are People (comp +2) - 1984: Some Great Reward - 1985: Catching Up With Depeche Mode - (comp +4) - 1985: It's Called a Heart / Fly on the - Windscreen (single) - 1986: Black Celebration - 1986: Stripped (single) - 1986: A Question of Lust (single) - 1989: 101 (double live) - 1987: Music for the Masses - 1987: Never Let Me Down (single) - 1990: Personal Jesus (single) - 199?: I Sometimes Wish I Was Famous: A - Swedish Tribute (various) - * Dessau - 1995: Dessau - 1995: Details Sketchy - * Devo UBL Card: 1088 - 1978: Q: Are We Not Men? A: We Are See also: - DEVO! hartke.lib.ohio-state.edu - 1979: Freedom of Choice See also: unsane.enc.org - 1977-1990: Greatest Hits See also: rt66.com - 1978-1990: Greatest Misses - * Die Krupps - 1995: Rings of Steel - * Die Monster Die - 1994: Withdrawl Method - * Die Warzau - 1991: Big Electric Metal Bass Face - 1994: Engine - 1994: allgoodgirls (EP) - * Disposable Heroes of Hiphoprisy - 1992: Hypocrisy is the Greatest Luxury - * Dolby, Thomas - 1983: The Golden Age of Wireless - 1983: The Golden Age of Wireless (2nd - release: 2 new) - 1984: The Flat Earth - UBL Card: 1961 - See also: kspace.com - See also: rt66.com - - * Doubting Thomas UBL Card: 1166 - 1991: Father Don't Cry (EP) See also: www.eecs.nwu.edu - 1991: The Infidel - * Duran Duran - 1981: Duran Duran - 1982: Carnival (EP) - 1982: live (live boot) - 1982: Rio - 1983: Union of the Snake / Secret - Oktober (single) - 1983: The Wild Boys / Cracks in the - Pavement (single) - 1983: Seven and the Ragged Tiger - 1987: Notorious - 1981-1988: Decade (comp) - UBL Card: 1259 - - * Durutti Column UBL Card: 4853 - 1988: The Guitar and Other Machines - * Ebn Ozn - 1984: Feeling Cavalier - * Elastica - 1995: Elastica - * Elastic Purejoy, The - 1994: The Elastic Purejoy - See also: - http2.brunel.ac.uk - * Electric Hellfire Club, The - 1993: Burn, Baby, Burn - 1995: Kiss the Goat - * Elfman, Danny - 1984: So-Lo - UBL Card: 1089 - - * Emergency Broadcast Network - 1995: Telecommunication Breakdown - * Engorged with Blood - 1993: Engorged with Blood (EP) - * Eno, Brian UBL Card: 1064 - 1977: Before and After Science See also: www.nwu.edu - * Eon - 1991: Fear: the Mindkiller (EP) - 1992: Basket Case (EP) - * Erasure UBL Card: 1029 - 1984-1986: various singles See also: www.cec.wustl.edu - 1986: Wonderland - See also: rt66.com - * Estep, Maggie - 1994: No More Mister Nice Girl - * Ethyl Meatplow UBL Card: 5232 - 1993: Happy Days Sweetheart - 1993: Devil's Johnson (single) - * Eurythmics - 1981: In the Garden - 1982: Love is a Stranger (EP) - 1982: This is the House (live EP) - 1983: Sweet Dreams - 1983: Touch - 1984: 1984 (For the Love of Big Brother) (soundtrack) - * Executive Slacks - 1986: Fire and Ice - * Faith and the Muse - 1994: Elyria - * Fixx, The UBL Card: 4603 - 1982: Shuttered Room - 1983: Reach the Beach - 1984: Phantoms - 1986: Walkabout - 1987: React (live) - * Foetus - 19??: Rife - 1995: Gash - UBL Card: 2750 - - * Fortran 5 UBL Card: 3469 - 1991: Blues See also: rt66.com - 1993: Bad Head Park - * 45 Grave - 1993: Debasement Tapes - * Frankie goes to Hollywood UBL Card: 3222 - 1984: Welcome to the Pleasure Dome See also: rt66.com - * Freur - 1983: Doot Doot - See also: rt66.com - - * Front 242 UBL Card: 1059 - 1979: Masterhit (EP) See also: www.ifi.uio.no - 1983: Geography See also: www.eecs.nwu.edu - 1987: Official Version - 1985: No Comment - 1982: Two In One (EP) - 1982-1985: Backcatalogue (comp) - 1989: Headhunter (EP) - 1989: Front by Front - 1989: Never Stop (EP) - 1991: Tyrrany For You - 1991: Tragedy For You (EP) - 1991: Rhythm of Time (EP) - 1993: Religion (EP) - 1993: Animal (single) - 1993: 06:21:03:11 Up Evil - 1993: 05:22:09:12 Off - * Front Line Assembly - 1988: Convergence - 1989: Digital Tension Dementia (EP) - 1990: Gashed Senses and Crossfire - 1991: Caustic Grip - 1992: Tactical Neural Implant - UBL Card: 1161 - - * Fugazi UBL Card: 2053 - 1989: 13 Songs - * Fun Boy Three - 1982: It Ain't What You Do / Just Do It / Funrama Theme (single) - 1981-1983: The Best of Fun Boy Three (comp) - * Fuzzbox See also: world.std.com - 1986: We've got a Fuzzbox and We're - Gonna Use It!! - 1986: Love is the Slug (single) - 1986: Rules and Regulations (single) - * Gabriel, Peter - 1977: Peter Gabriel I - 1978: Peter Gabriel II - 1980: Peter Gabriel III - 1982: Security - 1983: Peter Gabriel Plays Live (double - live) - 1985: Birdy (soundtrack) - 1986: So - 1986: Live at the Civic Arena (live - boot) - 1989: Passion (soundtrack) - UBL Card: 1016 - See also: www.nwu.edu - See also: - www.cs.clemson.edu - - * Garbage See also: - 1995: Garbage hamp.hampshire.edu - * Game Theory - 1987: Lolita Nation - * Gang of 4 See also: - 1979: Entertainment http2.brunel.ac.uk - 1979: Peel Sessions (live) - 1981: Solid Gold - 1981: Another Day / Another Dollar - 1982: I Love a Man In a Uniform - (single) - 1982: Songs of the Free - 1983: Is It Love (single) - 1983: Hard - 1983: At the Palace (live) - 1979-1983: A Brief History of the - Twentieth Century (comp) - 1990: To Hell With Poverty (single) - 1990: Mall - 1990: Money Talks (single) - 1995: Tatoo (single) - 1995: Shrinkwrapped - * Glove, The - 1982: Blue Sunshine - UBL Card: 1159 - See also: www.dcs.gla.ac.uk - * God is my Copilot - 1993: Speed Yr Trip - * Gracious Shades - 1995: Aberkash - * Grind - 1995: Kittymuzzle - * Grotus - 1993: Slow Motion Apocalypse - UBL Card: 5482 - - * Pizzicato Five - 1995: The Sound of Music - * PJ Harvey - 1992: Dry - 1993: Rid of Me - 1993: 4-Track Demos - 1995: Down by the Water (single) - 1995: To Bring You My Love - UBL Card: 1221 - See also: - www.louisville.edu - - * Psychick Warriors ov Gaia - 1992: Ov Biospheres and Sacred Groves - * Hagen, Nina - 1985: In Ekstasy - 1978-1982: nunsexmonkrock / Nina Hagen Band - * Hate Dept. See also: www.iuma.com - 1994: Meat Your Maker - 1995: Mainline (EP) - * Haysi Fantayzee - 1982: Shiny Shiny remix (single) - * Heaven 17 - 1981: Penthouse and Pavement - 1982: Heaven 17 - 1983: The Luxury Gap - 1984: How Men Are - * Hope, Peter and Kirk, Richard - 1988: Hoodoo Talk - UBL Card: 2307 - - * Kershaw, Nik - 1983: Human Racing - * Kirk, Richard - 1993: Virtual State - UBL Card: 2307 - - * Human League UBL Card: 4631 - 1979: Reproduction See also: pathfinder.com - 1980: Travelogue - 1981: Dare - 1983: Fascination - 1984: Hysteria - 1995: Octopus - * Hunters and Collectors - 1987: Human Frailty - UBL Card: 4553 - - * Ice T UBL Card: 2342 - 1991: New Jack Hustler (EP) - * In the Nursery - 19??: L'Esprit - * INXS UBL Card: 1284 - 1982: Shabooh Shoobah - 1984: The Swing - 1985: Listen Like Thieves - 1988: Kick - 1990: X - * J., David - 1983-1986: On Glass (comp) - 1985: Crocodile Tears and the Velvet - Cosh - UBL Card: 1215 - See also: - gothic.acs.csulb.edu - See also: - isvpc146.isv.uit.no - * Jesus and Mary Chain, The UBL Card: 1228 - 1992: Reverence (EP) See also: - 1992: Honey's Dead american.recordings.com - 1995: Hate Rock and Roll (comp) - * Jones, Grace - 1993: Sex Drive (single) - * Jones, Howard - 1983: Humans' Lib - 1985: Dream Into Action - * Joy Division - 1977-1978: Warsaw (comp) - 1979: Unknown Pleasures - 1980: Closer - 1980: Transmission / Novelty (single) - 1980: Still - 1977-1980: Substance (comp) - 1995: Ceremonial: A Tribute (various) - UBL Card: 1214 - See also: www.fys.uio.no - See also: - csclub.uwaterloo.ca - - * King Crimson UBL Card: 1323 - 1969: In the Court of the Crimson King - 1973: Larks' Tongues in Aspic - 1974: Starless and Bible Black - 1981: Dicipline - 1982: Beat - 1984: Three of a Perfect Pair - * KMFDM - 1993: Angst - UBL Card: 1452 - - * Kraftwerk UBL Card: 1027 - 1977: Trans-Europe Express (EP) See also: wwwtdb.cs.umu.se - See also: rt66.com - * L7 - 1988: L7 - 1990: Smell the Magic - 1992: Bricks are Heavy - 1994: Hungry for Stink - UBL Card: 1998 - - * Le&ae;ther Strip - 1995: Legacy of Hate and Lust - * Lemon Kittens - 1978-1980: We Buy a Hammer for Daddy - UBL Card: 1746 - - * Letters to Cleo UBL Card: 3000 - 1994: Aurora Gory Alice - * LFO - 1991: Frequencies - 1996: Advance - * London After Midnight - 1989: Selected Scenes from the End of the World - * Lords of Acid - 1991: Rough Sex (single) - 1993: Voodoo U - 1994: The Crablouse: Variations on a - Species (single) - UBL Card: 2356 - - * Lords of the New Church, The - 1983: Is Nothing Sacred? - * Love and Rockets - 1985: Ball of Confusion / Inside the - Outside (single) - 1985: Seventh Dream of Teenage Heaven - 1986: Express - 1986: Kundalini Express / Lucifer Sam / - Holiday on the Moon (single) - 1987: Earth, Sun, Moon - 1989: No Big Deal (single) - 1989: Motorcycle (single) - 1989: Love and Rockets - 1994: This Heaven (EP) - 1994: Body and Soul (EP) - 1994: Hot Trip to Heaven - 1995: The Glittering Darkness (EP) - 1996: Sweet F. A. - UBL Card: 1215 - See also: - american.recordings.com - See also: - gothic.acs.csulb.edu - - * Love is Colder than Death - 1993: Oxeia - 19??: Mental Traveller - 19??: Teignmouth - * Low Pop Suicide - 1992: Disengagement (EP) - 1992: On the Cross of Commerce - 1994: Kiss Your Lips (remixes) - 1995: The Death of Excellence - UBL Card: 1984 - - * Luscious Jackson - 1992: In Search of Manny - 1994: Natural Ingredients - * Lush - 1990: Gala - 1992: Spooky - 1994: Split - UBL Card: 2359 - See also: - isvpc146.isv.uit.no - - * Lwin, Annabella UBL Card: 2301 - 1986: War Boys (single) - 1994: Car Sex (EP) - * Lycea - 1993: A Day in the Stark Corner - See also: www.projekt.com - - * M - 1979: Pop Musik (7inch) - * Machines of Loving Grace - 1991: Rite of Shiva (single) - 1991: Machines of Loving Grace - 1992: Burn Like Brilliant Trash (EP) - 1993: Concentration - 1995: Gilt - UBL Card: 1219 - See also: www.nando.net - - * M|A|R|R|S - 1987: Pump Up the Volume / Anitina (single) - * Mallinder, Stephen - 1982: Pow Wow - UBL Card: 2307 - - * Manufacture - 1988: Terrorvision - * March Violets, The - 1984: Natural History - 1982-1984: The Botanic Verses (comp) - 1983-1985: Electric Shades (comp) - 1985: Deep (EP) - 1986: A Turn to the Sky / Never Look - Back / Deep / Rebirth (single) - UBL Card: 1114 - See also: www.cm.cf.ac.uk - - * Martha and the Muffins UBL Card: 2529 - 1980-1984: Far Away in Time (comp) - * Mary's Danish - 1991: Circa - UBL Card: 3727 - - * MC 900 Foot Jesus UBL Card: 1229 - 1989: Hell With the Lid Off See also: - 1989: UFOs Are Real (EP) american.recordings.com - 1990: Welcome to My Dream - 1990: Killer Inside Me (EP) - * McLachlan, Sarah - 1992: Into the Fire (single) - UBL Card: 1389 - - * Meat Beat Manifesto UBL Card: 3626 - 1988: Armed Audio Warfare - 1990: Dog Star Man (EP) - 1990: 99% - 1990: Psyche Out (EP) - 1990: Now (EP) - 1992: Satryicon - 1993: Peel Session (EP) - * Medicine - 1993: The Buried Life - 1994: Shot Forth Self Living - UBL Card: 1432 - See also: kspace.com - - * Mephisto Walz - 1986-1992: Crocosmia - 1993: Terra-Regina (comp) - 1994: The Eternal Deep - 1995: Thalia - * Midnight Oil - 1979: Head Injuries - 1981: Place without a Postcard - 1983: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1... - 1985: Red Sails in the Sunset - UBL Card: 1102 - See also: - www.stevens-tech.edu - - * Miller, Roger - 1987: Maximum Electric Piano - * Ministry - 1983: With Sympathy - 1984: Halloween Remix / The Nature of - Outtakes (EP) - 1981-1984: various singles - 1985: Cold Life - 1985: Over the Shoulder / Isle of Man - (EP) - 1986: Twitch - 1988: 12 Inch Singles (comp) - 1988: The Land of Rape and Honey - 1988: Stigmata / Tonight we Murder (EP) - - 1989: The Mind is a Terrible Thing to - Taste - 1991: Jesus Built my Hotrod (EP) - 1992: Psalm 69 - UBL Card: 1100 - See also: - csclub.uwaterloo.ca - - * Miranda Sex Garden UBL Card: 3007 - 1991: Gush Forth my Tears See also: - 1991: Madra sksol1.physics.sunysb.edu - 1992: Iris - 1993: Suspiria - 1994: Fairytales of Slavery - * Missing Persons - 1982: Missing Persons (EP) - 1982: Spring Session M - 1984: Rhyme & Reason - 1982-1984: Best of (comp) - * Mistle Thrush - 199?: Silt - 1994: Agus Amàrach - * Mission, The - 1986: God's Own Medicine - 1987: the First Chapter - UBL Card: 2045 - - * Mission of Burma - 1987: Forget - * Morissette, Alanis - 1995: Jagged Little Pill - UBL Card: 3127 - - * Morrison, Patricia UBL Card: 1062 - 1994: Reflect on This - * Moyet, Allison - 1985: ALF - UBL Card: 3410 - See also: rt66.com - * Murder Inc. - 1992: Murder Inc. - * Mussolini Headkick - 1990: Blood on the Flag - * Murphy, Peter UBL Card: 1235 - 1986: Should the World Fail to Fall See also: - Apart gothic.acs.csulb.edu - See also: - isvpc146.isv.uit.no - * My Bloody Valentine - 1988: Isn't Anything - 1991: Loveless - UBL Card: 1912 - - * My Life with the Thrill Kill Kult UBL Card: 3478 - 1988: I See Good Spirits and I See Bad - Spirits - 1989: K00Ler than Jesus - 1990: Confessions of a Knife... - 1990: Swine & Roses / Naive (KMFDM) - (single) - * Neither/Neither World - 1994: Tales of True Crime - * Neotek - 1995: Brain over Muscle - * New Fast Automatic Daffodils - 1991: Pigeonhole - 1992: Bong - * New Order UBL Card: 1126 - 1981: Movement See also: - 1981: Temptation / Hurt (single) topquark.cecer.army.mil - 1982: Factus 8 - 1984: Power, Corruption, and Lies - 1984: Blue Monday (single) - 1985: The Perfect Kiss (single) - 1985: Confusion (single) - 1985: Low Life - 1983-5: various singles - 1986: Brotherhood - * Nine Inch Nails - 1989: Pretty Hate Machine - 1989: Head Like a Hole (remixes) - 1990: Sin (remixes) - 1992: Broken (EP) - 1992: Fixed (remixes) - 1994: March of the Pigs (EP) - 1994: The Downward Spiral - 1994: Closer to God (EP) - 1994: Closer (Further Away) (EP) - 1994: Further Down the Spiral (remixes) - UBL Card: 1046 - See also: www.scri.fsu.edu - See also: metaverse.com - - * Nirvana UBL Card: 1052 - 1991: Nevermind See also: www.ludd.luth.se - See also: - home.earthlink.net - * Nitzer Ebb - 1987: That Total Age - 1987: Warsaw Ghetto (EP) - 1987: So Bright So Strong (remixes) - 1987: Get Clean (remixes) - 1988: Control: I'm Here (single) - 1989: Hearts and Minds (single) - 1989: Belief - 1990: Showtime - 1991: I Give to You (single) - 1991: As Is (single) - 1991: Ebbhead - 1991: Godhead (EP) - UBL Card: 1164 - See also: www.eecs.nwu.edu - - * No Doubt - 1995: Tragic Kingdom - * Noise Unit - 1989: Grinding Into Emptiness - * Nosferatu - 1993: Rise - * Numan, Gary - 1978: Tubeway Army - 1978: The Plan - 1979: Replicas - 1979: The Pleasure Principle - 1980: Telekon - 1981: Warriors - 1981: Dance - 1982: I, Assassin - 1984: White Noise (double live) - 1987: Ghost (double live) - UBL Card: 1409 - - * Offspring - 1994: Smash - * Oingo Boingo - 1980: Forbidden Zone (soundtrack) - 1981: Only a Lad - 1983: Good for Your Soul - 1986: Dead Man's Party - 1987: Nothing to Fear - UBL Card: 1089 - See also: rhino.harvard.edu - - * Orb, The UBL Card: 1121 - 1991: The Orb's Adventures Beyond the See also: www.hyperlink.com - Ultraworld - 1991: Aubrey Mixes, the Ultraworld See also: - Excursions www.phlab.missouri.edu - 1991: Little Fluffy Clouds (EP) See also: rt66.com - 1992: U.F.Orb - 1993: live 93 (double live) - 1994: Pomme Fritz - * Orbital - 1993: Orbital 2 - UBL Card: 2049 - See also: rt66.com - * Orchestral Manoeuvers in the Dark UBL Card: 5370 - 1980: OMD (US release) - 1980: OMD (UK release) - 1981: Bunker Soldiers - 1981: Architecture & Morality - 1983: Dazzle Ships - 1984: Junk Culture - 1985: Crush - * Oxygiene 23 - 1995: Blue - * 187 Calm - 1995: One Eighty Seven Calm (EP) - * 1000 Homo DJs - 1990: Supernaut (EP) - * Opus III - 1991: Mind Fruit - 1994: Guru Mother - * Pain Teens - 1990: Born in Blood / Case Histories - 1992: Stimulation Festival - 1993: Destroy Me, Lover - 1995: Beast of Dreams - * Paralysed Age - 1994: Nocturne - * Pigface - 1990: Gub - UBL Card: 1165 - See also: www.eecs.nwu.edu - * Pink Floyd UBL Card: 1008 - 1973: Dark Side of the Moon - 1975: Wish You were Here - 1978: The Wall (double soundtrack) - 1981: A Collection of Great Dance Songs - (comp) - 1995: A Saucerful of Pink: a Tribute - (double, various) - * Polygon Window - 1993: Surfing on Sine Waves - UBL Card: 5279 - - * Police UBL Card: 1172 - 1979: Outlandos D'Amour - 1980: Ghost in the Machine - 1981: Zenyatta Mondatta - 1983: Synchronicity - * Poe - 1995: Hello - * Pop, Iggy UBL Card: 4345 - 1977: Lust for Life - * Powerman 5000 - 1995: The Blood Splat Rating System - * Powerstation, The UBL Card: 1259 - 1985: The Powerstation - * Pram - 199?: Iron Lung (EP) - 1995: Helium - 1995: Sargasso Sea - * Prick UBL Card: 3683 - 1995: Prick - * Primus - 1991: Sailing on the Seas of Cheese - UBL Card: 1055 - - * Project Pitchfork - 1991: Dhyani - * Propaganda - 1985: A Secret Wish, US version - 1985: A Secret Wish, UK version - (remixes) - 1985: p:machinery (polish / passive) / - Frozen Faces (single) - 1985: Duel / Jewel (single) - 1985: Wishful Thinking (remixes) - 1990: Heaven Give Me Words (EP) - 1995: p:machinery t-empo remix (single) - UBL Card: 4636 - See also: rt66.com - See also: - hcl.chass.ncsu.edu - - * Prophetess, The - 1993: The Prophetess - * Public Image Limited - 1985: Album - * Rage Against the Machine UBL Card: 1424 - 1992: Rage Against the Machine - * Romeo Void - 1981: Never Say Never / Present Tense (single) - * Blaine Reininger - 1989: Expatriate Journals - * Red Aunts - 1993: Drag - 1994: Bad Motherfucker 400-Z - 1995: #1 Chicken - UBL Card: 4619 - - * Re-Flex - 1983: The Politics of Dancing / Re-Flex It (single) - * Revolting Cocks - 1986: Big Sexy Land - 1988: You Goddamned Son of a Bitch - (double live) - 1989: Stainless Steel Providers (EP) - 1990: Beers, Steers, and Queers - 1993: Linger Ficken' Good - UBL Card: 1100 - - * Ridgway, Stan UBL Card: 2904 - 1986: The Big Heat - * Rosemarys, The - 1993: Providence - * Rosetta Stone - 1993: Adrenaline - 1995: The Tyrrany of Inaction - * Ruby - 1995: Salt Peter - * Rump - 1994: Hating Brenda - * Rush - 1984: Grace Under Pressure - UBL Card: 1039 - - * Sandoz - 1993: Digital Lifeforms - * Scatterbrain - 1990: Here Comes Trouble - * Scar Tissue - 1995: Scar Tissue - * Scritti Politti - 1985: Cupid & Psyche - * Severed Heads UBL Card: 1480 - 1983: Since the Accident - 1986: Come Visit the Big Bigot - 1987: Bad Mood Guy - * Sex Gang, Andi - 1994: Arco Valley - * Sex Gang Children - 1992: Blind - 1993: Dieche - 1993: Medea - * Shadow Project - 1991: Shadow Project - * Sharkbait - 1991: Blowtorch Facelift - 1993: Crushits - * Sheep on Drugs - 1993: Greatest Hits (comp) - 1995: Suck (EP) - * Shriekback UBL Card: 1248 - 1982: Tench See also: - 1983: Care http2.brunel.ac.uk - 1983: Care (Y version) - 1983: Lined Up / Hapax Legomena - (single) - 1983: Lined Up / My Spine / Accretions - /Into Method (single) - 1983: My Spine / Accretions / Clear - Trails (single) - 1983: Sexthinkone / Here Comes My Hand - (single) - 1984: Jamscience (UK release) - 1984: Jamscience (Holland release) - 1984: Knowledge, Power, Truth, and Sex - 1984: Mercy Dash (picture disc, single) - - 1984: Hand on my Heart (picture disc, - single) - 1985: The Infinite (comp) - 1985: Oil and Gold - 1985: Fish Below the Ice (EP) - 1983-1985: Priests and Kannibals (comp) - - 1986: Big Night Music - 1986: Islam Grotto (live boot) - 1988: Evolution (comp) - 1990: The Dancing Years (remixes) - 1993: Sacred City - * Siglo XX - 1983-1986: Antler Tracks I (comp) - 1986: Fear and Desire - * Single Gun Theory UBL Card: 1404 - 1989?: Exorcise this Wasteland See also: www.magna.com.au - 1991: Like Stars in my Hands - 1993: Burning Bright (but Unseen) (EP) - 1994: Flow, River of my Soul - * Siouxsie and the Banshees - 1977: Peel Sessions (live EP) - 1978: Peel Sessions 2 (live EP) - 1978: The Scream - 1979: Join Hands - 1980: Kaleidoscope - 1981: juju - 1981: Once Upon a Time (comp) - 1981: Spellbound / Follow the Sun / Slap - Dash Snap (single) - 1982: Slowdive / Obsession II / Cannibal - Roses (single) - 1982: A Kiss in the Dream House - 1983: Nocturne (double live) - 1984: Hyaena - 1985: Tinderbox - 1986: Through the Looking Glass - 1987: Song from the Edge of the World - (single) - 1988: Peekaboo / False Face / Catwalk - (single) - 1988: Peepshow - 1991: Superstition - 1991: Kiss Them for Me (EP) - 1995: The Rapture - UBL Card: 1216 - - * Sister Machine Gun UBL Card: 3612 - 1992: Sins of the Flesh - 1994: The Torture Technique - 1994: Nothing (single) - 1994: Wired / Lung (single) - 1995: Burn - * Sisterhood, The - 1986: Gift - UBL Card: 1115 - See also: www.cm.cf.ac.uk - * Sisters of Mercy UBL Card: 1062 - 1985: First and Last and Always See also: www.cm.cf.ac.uk - 1988: Floodland - 1988: More / You Could be the One - (single) - 1990: Vision Thing - 1992: Some Girls Wander by Mistake - (comp) - 1992: Temple of Love 1992 (single) - 1993: First and Last and Forever: A - Tribute (various) - 1993: Under the Gun / Alice 1993 - (single) - * Skeletal Family - 1984-1985: Burning Oil / Futile Combat - * Skinny Puppy UBL Card: 1166 - 1983: Back and Forth, Series Two See also: www.eecs.nwu.edu - 1984: Bites - 1984: Remission - 1984: Bites and Remission - 1986: Mind: the Perpetual Intercourse - 1986: Dig It (EP) - 1987: Cleanse, Fold, and Manipulate - 1988: Vivisect VI - 1989: Rabies - 1990: Too Dark Park - 1990: Censor (EP) - 1992: 12 Inch Anthology (comp) - 1992: Last Rights - * Sky Cries Mary - 1993: A Return to the Inner Experience - 1994: This Timeless Turning - 1994: Every Iceberg is Afire / Deep - Sunless Sea / Cornerman (single) - UBL Card: 1437 - See also: www.starwave.com - - * Snog - 1995: Dear Valued Customer - * Soh Daiko - 1990: Taiko Drum Ensemble - * Some, Belouis - 1984: Some People (single) - * Southern Death Cult - 1982-1983: Southern Death Cult (comp) - * Spahn Ranch - 1995: The Coiled One - * SSQ - 1984: Playback - 1986: Insecurity (single) - * Stabbing Westward UBL Card: 2415 - 1993: Violent Mood Swings (EP) - 1994: Ungod - 1995: What Do I Have to Do / Falls - Apart (single) - 1995: Wither Blister Burn and Peel - * Strange Boutique - 199?: Charm - 199?: The Kindest Words - 199?: The Loved One - See also: www.iuma.com - - * Steroid Maximus UBL Card: 2750 - 1991: Quilombo - 1992: Gondwanaland - * Sugarcubes, The - 1988: Life's Too Good - UBL Card: 3419 - See also: math-www.uio.no - * Sunscreem - 1992: O3 - * Switchblade Symphony - 1992: Fable (tape/EP) - 1993: Elegy (tape/EP) - 1995: Serpentine Gallery - * Talking Heads UBL Card: 1012 - 1977: Talking Heads '77 - 1978: More Songs About Buildings and - Food - 1979: The Name of This Band is Talking - Heads (double live) - 1981: Fear of Music - 1983: Sp eak in gI n To ngu es - 1985: Stop Making Sense (live - soundtrack) - 1985: Little Creatures - * Tears For Fears - 1983: The Hurting - 1985: Songs From the Big Chair - UBL Card: 2763 - - * Tel Basta - 1996: Lickerish - * Thanatos - 1995: An Embassy in Gaius - * Therapy? UBL Card: 2044 - 1992: Caucasian Psychosis - 1992: Nurse - * 13 Mg. - 1995: Trust and Obey - * This Ascension - 1991: Light and Shade - 1994: Walk Softly, a Dream Lies Here - * Throwing Muses - 1986: Throwing Muses - UBL Card: 1357 - - * Tinfed - 1993: Synaptic Hardware - * Tin Machine - 1989: Tin Machine - UBL Card: 1098 - - * Tit Wrench United - 1993: Full Employment - * Tom Tom Club - 1981: Tom Tom Club - 1983: Close to the Bone - UBL Card: 1012 - - * Tones on Tail UBL Card: 1235 - 1982: Tones on Tail See also: - 1984: Pop gothic.acs.csulb.edu - 1984: Performance / Shakes (single) See also: - 1982-1984: Night Music (comp) isvpc146.isv.uit.no - * Trance Mission - 1993: Trance Mission - * Trance to the Sun - 1994: Ghost Forest - 1995: Bloom, Flowers, Bloom! - 1995: Venomous Eve - * Transvision Vamp - 1991: Little Magnets versus the Bubble - of Babble - UBL Card: 5305 - - * Trio - 1983: Trio and Error - * Tubes, The - 1981: Tubes Rarities And Smash Hits [T.R.A.S.H] - * Tuxedomoon - 1980: Half-Mute - 1983: A Thousand Lives by Picture - 1985: Holy Wars - * Underflowers - 1995: Underflowers - * Urban Dance Squad UBL Card: 4626 - 1991: Life'n Perspectives of a Genuine - Crossover - * Usherhouse - 1993: Molting - 1994: Flux - * Ultravox - 1978: Systems of Romance - * Van Acker, Luc - 1980: Taking Snapshots, Volume 1 - UBL Card: 1100 - - * Vangelis UBL Card: 1023 - 1994: Blade Runner (soundtrack) See also: rt66.com - * various - 1980: URGH! A Music War (live comp) - 1981-1994: Wax Trax Black Box (comp) - 1982-198?: In Goth Daze (Anagram version) (comp) - 1982-1994: In Goth Daze (Cleopatra version) (comp) - 1982-1993: The Whip (Cleopatra) (comp) - 1984-1985: IQ6: Zang Tumb Tuum Sampled (comp) - 1984-1995: DEC ADE NCE (Nettwerk) (comp) - 1988: This is Electronic Body Music (comp) - 1990: From Across This Gray Land #2 (Projekt) (comp) - 1990: Doctor Death IV: The Marvels of Insect Life (double comp) - 1990: Red Hot + Blue (comp) - 1991: Bouquet of Dreams (comp) - 1980-1992: Gothic Rock (comp) - 1992: Mindfield (Third Mind) (comp) - 1992: From Across This Gray Land #3 (Projekt) (comp) - 1992: The Cyberflesh Conspiracy (comp) - 1992: Gárgula Mecânica: World Electrostatic Assembly (comp) - 1992: CCCC: California Cyber Crash Compilation (Cop) (comp) - 1993: Shut Up Kitty (comp) - 1988-1993: Can You See It Yet? (Invisible) (comp) - 1994: Mysterious Encounters (Cleopatra) (comp) - 1994: The Crow (comp) - 1994: Totentanz: The Best of Zoth Ommog (double comp) - 1992: Hy! (Hyperium Compilation volume 1) (comp) - 1993: World Domination Sampler (comp) - 1993: Rivet Head Culture (comp) - 1993: Artificial Intelligence (Warp) (comp) - 1994: Artificial Intelligence II (Warp) (comp) - 1994: Big Hard Disk #2 (Smash) (comp) - 1994: Kindred Spirits (Bedazzled) (comp) - 1994: Plug In + Turn On (Instinct) (comp) - 1994: The Disease of Lady Madeline (Anubis) (comp) - 1994: Natural Born Killers (soundtrack comp) - 1994: Afterburn (Wax Trax) (comp) - 1994: Chaos Compilation (Cop) (comp) - 1994: Electrocity Vol. 5 (comp) - 1995: Gothik (Cleopatra) (double comp) - 1995: Godfathers of German Gothic (comp) - 1995: Heavenly Voices III (Hyperium) (comp) - 1995: Mortal Kombat (soundtrack comp) - 1995: The Tyranny Off the Beat (Off Beat/Cleopatra) (comp) - 1995: Forced Cranial Removal (Fifth Colvmn) (comp) - 1995: Dreams in the Witch House (Grave News) (comp) - * Vega, Suzanne UBL Card: 2088 - 1992: 99.9F - * Vinyl Devotion - 1994: If They Know You're Trying - * Volume Magazine - 1991: Volume: 1 (comp) - 1991: Volume: 2 (comp) - 1992: Volume: 3 (comp) - 1992: Volume: 4 (comp) - 1995: Wasted: The Best of Volume (double comp) - * Waitresses, The - 1981: Wasn't Tomorrow Wonderful? - 1982: Bruiseology - 1978-1981: Best Of (comp) - * Wake, The - 1993: Masked - * Wall of Voodoo - 1980: fpfpfpfpfpfp - 1981: Dark Continent - 1982: Call of the West - 1986: Seven Days in Sammystown - 1987: Happy Planet - * Wang Chung UBL Card: 2245 - 1983: Points On the Curve - 1985: To Live and Die in L.A. - (soundtrack) - * Westworld - 1987: Rockulator - 1991: Movers and Shakers - 1991: Do No Wrong (single) - * Whale UBL Card: 3790 - 1994: Hobo Humpin Slobo Babe / Eye 842 See also: www.vmg.co.uk - (single) - 1994: Hobo Humpin Slobo Babe / Lips / - Eye 842 (single) - 1994: Pay for Me (EP) - 1995: We Care - 1995: I'll Do Ya (EP) - 1995: Hobo Humpin Slobo Babe (3 mixes) - (single) - 1995: Hobo Humpin Slobo Babe / You and - Your Sister / Singer Star (single) - * White Zombie - 1992: Nightcrawlers: the KMFDM Remixes (EP) - * Wilde, Kim - 1981: Kim Wilde - 1984: Teases & Dares - 1981-1993: The Singles Collection (comp) - * X - 1988: Live at the Whiskey-a-Go-Go (double live) - * X Marks the Pedwalk - 1994: The Killing Had Begun - * Xorcist - 1991: Damned Souls - 1993: Bitches (EP) - * XTC UBL Card: 1044 - 1982: Waxworks - 1983: Mummer - 1984: The Big Express - 1985: 25 O'Clock - * Xymox - 1985: Clan of Xymox - UBL Card: 1295 - See also: - isvpc146.isv.uit.no - * Yamashirogumi, Geinoh - 1990: Akira (soundtrack) - * Yazoo - 1982: Upstairs at Eric's - 1982: The Other Side of Love (single) - 1983: You and Me Both - 1983: Nobody's Diary / State Farm - (single) - 1983: Situation (EP) - UBL Card: 4309 - See also: rt66.com - - * Yello UBL Card: 1506 - 1980: Solid Pleasure See also: newton.space.net - 1981: Stella See also: rt66.com - 1983: You Gotta Say Yes to Another - Excess - 1987: One Second - 1988: Flag - * Yes - 1972: Fragile - 1975: Classic Yes - 1980: Drama - 1983: 90125 - UBL Card: 1038 - ---------------167E2781446B -Content-Type: text/html; charset=us-ascii; name="album-list.html" -Content-Transfer-Encoding: 7bit -Content-Disposition: inline; filename="album-list.html" - - - -

jwz's tunes
Last modified: 06-Apr-96.

- - -jwz's tunes -This is a list of all of the music I have on CD, tape, and vinyl -(including all of the old, embarrasing stuff...) This page may look -a little funny if you aren't using a browser that supports HTML -tables, like -
Mozilla.

- -

-``Publishing CD lists and tape collections evokes images of -lonely, pathetic men who talk about their cats incessantly.'' --- Paul Phillips -
- -I used to have this set up so that clicking on any name would take -you to the appropriate entry of the All Music Guide at -gopher://allmusic.ferris.edu; but they have since moved their -database from there to -cdnow.com, -and in the process, have obfuscated access to the database to such an extent -that this is no longer possible. In order to get at the discographies, you -need to weed your way through dozens of pages, and there seems to be no even -semi-reliable way to pre-compute the URL that they will use. Arrgh!

- -The Internet Movie -Database has an excellent interface for this sort of thing; I really -wish more people would emulate that system.

- -In this list, I've included links to various related web pages that I've -come across; one very cool and well-organized database to which many of -these links point is -The -Ultimate Band List; check it out!

- -

-Jamie Zawinski -<jwz@netscape.com> -

- -


    - -
  • - Act - -
    1988: Laughter, Tears, and Rage -
    -UBL Card: 4637 -
    See also: rt66.com -
    See also: hcl.chass.ncsu.edu -
    - -
  • - Age of Chance - -
    1987: Kiss (single) -
    1987: Don't Get Mad, Get Even (single) -
    - -
  • - Alien Sex Fiend - -
    1983-1992: Drive My Rocket (comp) -
    1989: Too Much Acid? (live) -
    1990: Curse -
    1992: Open Head Surgery -
    1993: Altered States of America (live) -
    1995: Inferno: The Odyssey Continuestm (soundtrack) -
    -UBL Card: 5291 -
    See also: cent1.lancs.ac.uk -
    - -
  • - Alio Die - -
    1993: Under a Holy Ritual -
    -UBL Card: 1266 -
    See also: www.projekt.com -
    - -
  • - Alphaville - -
    1984: Forever Young -
    -UBL Card: 3056 -
    See also: www.escape.com -
    - -
  • - Altered Images - -
    1981: Happy Birthday -
    1983: Bite -
    1984: Collected Images (comp) -
    - -
  • - An April March - -
    1995: Lessons in Vengance -
    1995: Instruments of Lust and Fury -
    - -
  • - And Also the Trees - -
    1983-1992: From Horizon to Horizon (comp) -
    -UBL Card: 1867 -
    See also: www.ugcs.caltech.edu -
    See also: onyx.dartmouth.edu -
    - -
  • - Anderson, Laurie - -
    1982: Big Science -
    1983: United States Live, parts 1-4 (5 albums) -
    1984: Mister Heartbreak -
    1986: Home of the Brave (live soundtrack) -
    1995: Bright Red -
    -UBL Card: 1494 -
    See also: www.voyagerco.com -
    See also: www.netpart.com -
    See also: www.c3.lanl.gov -
    - -
  • - Ant, Adam - -
    1980: Kings of the Wild Frontier -
    1981: Prince Charming -
    1982: Friend or Foe -
    1983: Dirk Wears White Sox -
    1985: Viva Le Rock -
    1979-1986: Antics in the Forbidden Zone (comp) -
    -UBL Card: 1205 -
    See also: www.uhs.uga.edu -
    See also: caprec.com -
    - -
  • - Anthrax - -
    1991: Attack of the Killer B's (comp) -
    -UBL Card: 2710 -
    - -
  • - Aphex Twin - -
    1993: On (EP) -
    1994: Analogue Bubblebath (EP) -
    1995: Ventolin (EP) -
    -UBL Card: 5279 -
    See also: hyperreal.com -
    See also: pathfinder.com -
    - -
  • - Arcadia - -
    1985: So Red the Rose -
    -UBL Card: 1259 -
    - -
  • - Armageddon Dildos - -
    1995: Lost -
    -UBL Card: 2538 -
    - -
  • - Ash, Daniel - -
    1991: Coming Down -
    1992: Foolish Thing Desire -
    -See also: isvpc146.isv.uit.no -
    - -
  • - Archangel, Nathalie - -
    1992: Owl -
    - -
  • - Art of Noise - -
    1983: Who's Afraid of the Art of Noise? -
    1983: The Art of Noise Have Closed Up -
    1983: Beatbox -
    1983: Daft -
    1984: Edited (picture disc) -
    -UBL Card: 1918 -
    See also: rt66.com -
    - -
  • - Attrition - -
    1985: Smiling, at the Hypogonder Club (comp) -
    -UBL Card: 4232 -
    See also: www.projekt.com -
    - -
  • - AUTECHRe - -
    1994: INCUNABULA -
    1994: BASSCAD,EP (EP) -
    1994: Amber -
    1995: Garbage -
    - -
  • - B52's - -
    1979: B52's -
    1980: Wild Planet -
    1982: Mesopotamia -
    1983: Whammy! -
    1981: Party Mix -
    -UBL Card: 2268 -
    - -
  • - Babes in Toyland - -
    1989: Spanking Machine -
    1991: To Mother -
    1992: Fontanelle -
    1993: Pain Killers -
    1995: Nemesisters -
    -UBL Card: 3190 -
    - -
  • - Battery - -
    1992: Meat Market (EP) -
    1993: Mutate -
    1994: Lillith 3.2 (EP) -
    1995: nv -
    - -
  • - Bauhaus - -
    1979: Bela Lugosi's Dead (EP) -
    1981: In the Flat Field -
    1981: Mask -
    1981: Press the Eject and Give Me the Tape (live) -
    1983: Burning from the Inside -
    1979-1984: 1979-1984 (comp) -
    1985: The Sky's Gone Out -
    1984: The Last Temptation (live boot) -
    1984: Rest In Peace: The Final Concert (double live) -
    1996: The Passion of Covers: A Tribute (various) -
    -UBL Card: 1235 -
    See also: gothic.acs.csulb.edu -
    See also: isvpc146.isv.uit.no -
    - -
  • - Belly - -
    1993: Star -
    1993: Moon (EP) -
    1995: Baby Silvertooth (EP) -
    1995: King -
    -UBL Card: 1360 -
    See also: isvpc146.isv.uit.no -
    - -
  • - Berlin - -
    1981: Love Life -
    1981: Dancing in Berlin / Lost in the Crowd (single) -
    1982: Pleasure Victim -
    1986: Count 3 and Pray -
    -UBL Card: 4156 -
    - -
  • - Big Black - -
    1983: The Hammer Party -
    1987: Songs About Fucking -
    1992: The Rich Man's Eight-Track Tape (comp) -
    -UBL Card: 2410 -
    - -
  • - Big Hat - -
    1993: Selena at my Window -
    -UBL Card: 1217 -
    See also: www.cec.wustl.edu -
    - -
  • - Bigod 20 - -
    1990: The Bog (EP) -
    1991: Carpe Diem (EP) -
    - -
  • - Bikini Kill - -
    1991-1992: The C.D. Version of the First Two Records -
    -UBL Card: 4444 -
    See also: www.columbia.edu -
    - -
  • - Billy Nayer Show, The - -
    1994: The Ketchup and Mustard Man -
    - -
  • - Billy and the Boingers - -
    1987: U Stink but I Love You (flexydisk) -
    - -
  • - Birdsongs of the Messozoic - -
    1980-1987: The Fossil Record -
    1983: Sonic Geology -
    - -
  • - Birmingham 6 - -
    1995: Police State -
    -UBL Card: 4348 -
    - -
  • - Black Tape for a Blue Girl - -
    1986: The Rope -
    1987: Mesmerized by the Sirens -
    1989: Ashes in the Brittle Air -
    1993: This Lush Garden Within -
    -UBL Card: 1202 -
    See also: www.projekt.com -
    - -
  • - Bleeding Stone, The - -
    1994: Silent Insanity (EP) -
    - -
  • - Blondie - -
    1980: Autoamerican -
    1983: Best of Blondie -
    -UBL Card: 2070 -
    - -
  • - Blotto - -
    1994: Collected Works -
    - -
  • - Body Count - -
    1992: Body Count -
    -UBL Card: 1277 -
    - -
  • - Bowie, David - -
    1995: Outside -
    -UBL Card: 1098 -
    - -
  • - Bow Wow Wow - -
    1982: See Jungle -
    1981-1982: I Want Candy (comp) -
    1983: When the Going Gets Tough -
    1981-1983: Girl Bites Dog (comp) -
    -UBL Card: 2301 -
    - -
  • - Breeders, The - -
    1993: Last Splash -
    -UBL Card: 1242 -
    See also: isvpc146.isv.uit.no -
    - -
  • - Brücken, Claudia - -
    1991: Love and a Million Other Things -
    -UBL Card: 4636 -
    See also: rt66.com -
    See also: hcl.chass.ncsu.edu -
    - -
  • - Buggles, The - -
    1979: The Age of Plastic -
    1981: Adventures in Modern Recording -
    - -
  • - Bush, Kate - -
    1977: The Kick Inside -
    1980: Never For Ever -
    1983: The Dreaming -
    1985: Hounds of Love -
    -UBL Card: 1032 -
    See also: actor.cs.vt.edu -
    See also: www.jrc.flinders.edu.au -
    See also: holly.city.unisa.edu.au -
    - -
  • - Buzzcocks - -
    1976-1979: Operators Manual -
    -UBL Card: 1351 -
    - -
  • - Cabaret Voltaire - -
    1974-1976: 1974-1976 (comp) -
    1978-1983: The Golden Moments of CV (comp) -
    1978: Nag Nag Nag (EP) -
    1979: Mix-Up (EP) -
    1980: Red Mecca -
    1981: The Voice of America -
    1981: Johnny Yesno (soundtrack) -
    1982: 2X45 -
    1982: Eight Crepescule Tracks -
    1983: The Crackdown -
    1984: Micro-Phonies -
    1985: I Want You (single) -
    1985: Drinking Gasoline -
    1985: The Arm of the Lord -
    1985: The Convenant, the Sword, and the Arm of the Lord -
    1986: The Drain Train -
    1987: Code -
    1990: Listen Up (double comp) -
    1991: Body and Soul -
    1991: Colors -
    1992: Plasticity -
    1992: Western Reworks -
    -UBL Card: 2307 -
    - -
  • - Cave, Nick - -
    1984: From Her to Eternity -
    1988: Tender Prey -
    -UBL Card: 1273 -
    - -
  • - Chemlab - -
    1993: Burnout at the Hydrogen Bar -
    1994: Magnetic Field Remixes (EP) -
    -UBL Card: 3774 -
    - -
  • - Children on Stun - -
    1994: Tourniquets of Love's Desire -
    - -
  • - Christian Death - -
    1982: Only Theatre of Pain -
    1988: Sex and Drugs and Jesus Christ -
    1989: All the Love All the Hate part Two: All the Hate -
    1994: Sexy Death God -
    -UBL Card: 1218 -
    See also: christian-death.acc.brad.ac.uk -
    - -
  • - Chris and Cosey - -
    1989: Trust -
    - -
  • - Ciccone Youth - -
    1988: The Whitey Album -
    -UBL Card: 1087 -
    - -
  • - ClockDVA - -
    1981: Thirst -
    1988: The Hacker/The Act -
    -UBL Card: 3999 -
    - -
  • - Cocteau Twins - -
    1982: Garlands -
    1983: Head over Heels -
    1984: The Spangle Maker (EP) -
    1984: Treasure -
    1985: Aikea-Guinea (EP) -
    1985: Echoes in a Shallow Bay -
    1985: Tiny Dynamine (EP) -
    1982-1985: The Pink Opaque -
    -UBL Card: 1074 -
    See also: garnet.berkeley.edu -
    See also: isvpc146.isv.uit.no -
    - -
  • - Coil - -
    1986?: The Angelic Conversation (soundtrack) -
    1988: Gold is the Metal -
    1990: The Unreleased Themes for Hellraiser (EP) -
    1990: Panic / Tainted Love (single) -
    1991: Out of Light Cometh Darkness -
    1992: Snow (EP) -
    -UBL Card: 1388 -
    - -
  • - Concrete Blonde - -
    1986: Concrete Blonde -
    1989: Free -
    1990: Bloodletting -
    1993: Walking in London (single) -
    1993: Mexican Moon -
    -UBL Card: 1396 -
    - -
  • - Cop Shoot Cop - -
    1993: Ask Questions Later -
    - -
  • - Course of Empire - -
    1990: Course of Empire -
    1993: Infested! (EP) -
    1994: Initiation -
    -UBL Card: 2889 -
    See also: homepage.seas.upenn.edu -
    - -
  • - Cranes - -
    1990: Inescapable (EP) -
    1991: Wings of Joy -
    1992: Self-Non-Self -
    1993: Forever -
    1993: Jewel (EP) -
    1994: Loved -
    1994: Shining Road (limited edition double EP) -
    -UBL Card: 2400 -
    See also: busop.cit.wayne.edu -
    - -
  • - Crash Worship - -
    1992: ADRV -
    -UBL Card: 1901 -
    See also: www.meer.net -
    See also: www.tyrell.net -
    - -
  • - Creatures, The - -
    1983: Feast -
    1990: Boomerang -
    1990: Fury Eyes (EP) -
    1990: Standing There (single) -
    -UBL Card: 1216 -
    - -
  • - Cure, The - -
    1980: Boys Don't Cry -
    1980: Seventeen Seconds -
    1981: Faith -
    1982: Pornography -
    1982: The Walk -
    1982?: Looking for a Forest (live boot) -
    1983: Japanese Whispers -
    1983: Lovecats (EP) -
    1984: Concert (live) -
    1984: The Top -
    1985: The Head on the Door -
    1987: Staring at the Sea (comp) -
    1988: Kiss Me Kiss Me Kiss Me -
    1989: Disintegration -
    1989: Fascination Street (single) -
    1990: Never Enough (single) -
    1995?: Give Me the Cure: 18 DC Bands (various) -
    -UBL Card: 1159 -
    See also: www.acpub.duke.edu -
    See also: pathfinder.com -
    - -
  • - Current 93 - -
    1986-1991: Island -
    -UBL Card: 3465 -
    - -
  • - Curve - -
    1991: Frozen (EP) -
    1991: Cherry (EP) -
    1992: Doppelganger -
    1993: Cuckoo -
    -UBL Card: 1355 -
    See also: quark.stack.urc.tue.nl -
    See also: blade.stack.urc.tue.nl -
    - -
  • - Cyber-Tec - -
    1995: Cyber-Tec -
    - -
  • - Daisy Chainsaw - -
    1992: Hope All Your Dreams Come True (single) -
    1992: Love Sick Pleasure (EP) -
    1992: Eleventeen -
    1994: For They Know Not What They Do -
    - -
  • - Dance or Die - -
    1993: Psychoburbia -
    - -
  • - Danse Society, The - -
    1984: Heaven is Waiting -
    1986: Looking Through -
    - -
  • - Das Ich - -
    1990: Satanische Verse -
    -UBL Card: 2337 -
    - -
  • - Dax, Danielle - -
    1986-1988: Dark Adapted Eye (comp +5) -
    1988: Whistling for his Love (single) -
    1988: Cat House (single) -
    1990: Blast the Human Flower -
    1992: Pop-Eyes -
    1995: Timber Tongue (EP) -
    -UBL Card: 1746 -
    - -
  • - Death in June - -
    1992: But, What Ends When the Symbols Shatter? -
    - -
  • - Definition FX - -
    1993: Something Inside (single) -
    1993: Light Speed Collision -
    -See also: www.geko.com.au -
    - -
  • - Depeche Mode - -
    1981: Speak & Spell -
    1981: Just Can't Get Enough / Any Second Now (single) -
    1982: A Broken Frame -
    1982: live singles (comp) -
    1983: Construction Time Again -
    1984: People Are People (comp +2) -
    1984: Some Great Reward -
    1985: Catching Up With Depeche Mode (comp +4) -
    1985: It's Called a Heart / Fly on the Windscreen (single) -
    1986: Black Celebration -
    1986: Stripped (single) -
    1986: A Question of Lust (single) -
    1989: 101 (double live) -
    1987: Music for the Masses -
    1987: Never Let Me Down (single) -
    1990: Personal Jesus (single) -
    199?: I Sometimes Wish I Was Famous: A Swedish Tribute (various) -
    -UBL Card: 1041 -
    See also: www.cis.ufl.edu -
    See also: www.coma.sbg.ac.at -
    - -
  • - Dessau - -
    1995: Dessau -
    1995: Details Sketchy -
    - -
  • - Devo - -
    1978: Q: Are We Not Men? A: We Are DEVO! -
    1979: Freedom of Choice -
    1977-1990: Greatest Hits -
    1978-1990: Greatest Misses -
    -UBL Card: 1088 -
    See also: hartke.lib.ohio-state.edu -
    See also: unsane.enc.org -
    See also: rt66.com -
    - -
  • - Die Krupps - -
    1995: Rings of Steel -
    - -
  • - Die Monster Die - -
    1994: Withdrawl Method -
    - -
  • - Die Warzau - -
    1991: Big Electric Metal Bass Face -
    1994: Engine -
    1994: allgoodgirls (EP) -
    - -
  • - Disposable Heroes of Hiphoprisy - -
    1992: Hypocrisy is the Greatest Luxury -
    - -
  • - Dolby, Thomas - -
    1983: The Golden Age of Wireless -
    1983: The Golden Age of Wireless (2nd release: 2 new) -
    1984: The Flat Earth -
    -UBL Card: 1961 -
    See also: kspace.com -
    See also: rt66.com -
    - -
  • - Doubting Thomas - -
    1991: Father Don't Cry (EP) -
    1991: The Infidel -
    -UBL Card: 1166 -
    See also: www.eecs.nwu.edu -
    - -
  • - Duran Duran - -
    1981: Duran Duran -
    1982: Carnival (EP) -
    1982: live (live boot) -
    1982: Rio -
    1983: Union of the Snake / Secret Oktober (single) -
    1983: The Wild Boys / Cracks in the Pavement (single) -
    1983: Seven and the Ragged Tiger -
    1987: Notorious -
    1981-1988: Decade (comp) -
    -UBL Card: 1259 -
    - -
  • - Durutti Column - -
    1988: The Guitar and Other Machines -
    -UBL Card: 4853 -
    - -
  • - Ebn Ozn - -
    1984: Feeling Cavalier -
    - -
  • - Elastica - -
    1995: Elastica -
    - -
  • - Elastic Purejoy, The - -
    1994: The Elastic Purejoy -
    -See also: http2.brunel.ac.uk -
    - -
  • - Electric Hellfire Club, The - -
    1993: Burn, Baby, Burn -
    1995: Kiss the Goat -
    - -
  • - Elfman, Danny - -
    1984: So-Lo -
    -UBL Card: 1089 -
    - -
  • - Emergency Broadcast Network - -
    1995: Telecommunication Breakdown -
    - -
  • - Engorged with Blood - -
    1993: Engorged with Blood (EP) -
    - -
  • - Eno, Brian - -
    1977: Before and After Science -
    -UBL Card: 1064 -
    See also: www.nwu.edu -
    - -
  • - Eon - -
    1991: Fear: the Mindkiller (EP) -
    1992: Basket Case (EP) -
    - -
  • - Erasure - -
    1984-1986: various singles -
    1986: Wonderland -
    -UBL Card: 1029 -
    See also: www.cec.wustl.edu -
    See also: rt66.com -
    - -
  • - Estep, Maggie - -
    1994: No More Mister Nice Girl -
    - -
  • - Ethyl Meatplow - -
    1993: Happy Days Sweetheart -
    1993: Devil's Johnson (single) -
    -UBL Card: 5232 -
    - -
  • - Eurythmics - -
    1981: In the Garden -
    1982: Love is a Stranger (EP) -
    1982: This is the House (live EP) -
    1983: Sweet Dreams -
    1983: Touch -
    1984: 1984 (For the Love of Big Brother) (soundtrack) -
    - -
  • - Executive Slacks - -
    1986: Fire and Ice -
    - -
  • - Faith and the Muse - -
    1994: Elyria -
    - -
  • - Fixx, The - -
    1982: Shuttered Room -
    1983: Reach the Beach -
    1984: Phantoms -
    1986: Walkabout -
    1987: React (live) -
    -UBL Card: 4603 -
    - -
  • - Foetus - -
    19??: Rife -
    1995: Gash -
    -UBL Card: 2750 -
    - -
  • - Fortran 5 - -
    1991: Blues -
    1993: Bad Head Park -
    -UBL Card: 3469 -
    See also: rt66.com -
    - -
  • - 45 Grave - -
    1993: Debasement Tapes -
    - -
  • - Frankie goes to Hollywood - -
    1984: Welcome to the Pleasure Dome -
    -UBL Card: 3222 -
    See also: rt66.com -
    - -
  • - Freur - -
    1983: Doot Doot -
    -See also: rt66.com -
    - -
  • - Front 242 - -
    1979: Masterhit (EP) -
    1983: Geography -
    1987: Official Version -
    1985: No Comment -
    1982: Two In One (EP) -
    1982-1985: Backcatalogue (comp) -
    1989: Headhunter (EP) -
    1989: Front by Front -
    1989: Never Stop (EP) -
    1991: Tyrrany For You -
    1991: Tragedy For You (EP) -
    1991: Rhythm of Time (EP) -
    1993: Religion (EP) -
    1993: Animal (single) -
    1993: 06:21:03:11 Up Evil -
    1993: 05:22:09:12 Off -
    -UBL Card: 1059 -
    See also: www.ifi.uio.no -
    See also: www.eecs.nwu.edu -
    - -
  • - Front Line Assembly - -
    1988: Convergence -
    1989: Digital Tension Dementia (EP) -
    1990: Gashed Senses and Crossfire -
    1991: Caustic Grip -
    1992: Tactical Neural Implant -
    -UBL Card: 1161 -
    - -
  • - Fugazi - -
    1989: 13 Songs -
    -UBL Card: 2053 -
    - -
  • - Fun Boy Three - -
    1982: It Ain't What You Do / Just Do It / Funrama Theme (single) -
    1981-1983: The Best of Fun Boy Three (comp) -
    - -
  • - Fuzzbox - -
    1986: We've got a Fuzzbox and We're Gonna Use It!! -
    1986: Love is the Slug (single) -
    1986: Rules and Regulations (single) -
    -See also: world.std.com -
    - -
  • - Gabriel, Peter - -
    1977: Peter Gabriel I -
    1978: Peter Gabriel II -
    1980: Peter Gabriel III -
    1982: Security -
    1983: Peter Gabriel Plays Live (double live) -
    1985: Birdy (soundtrack) -
    1986: So -
    1986: Live at the Civic Arena (live boot) -
    1989: Passion (soundtrack) -
    -UBL Card: 1016 -
    See also: www.nwu.edu -
    See also: www.cs.clemson.edu -
    - -
  • - Garbage - -
    1995: Garbage -
    -See also: hamp.hampshire.edu -
    - -
  • - Game Theory - -
    1987: Lolita Nation -
    - -
  • - Gang of 4 - -
    1979: Entertainment -
    1979: Peel Sessions (live) -
    1981: Solid Gold -
    1981: Another Day / Another Dollar -
    1982: I Love a Man In a Uniform (single) -
    1982: Songs of the Free -
    1983: Is It Love (single) -
    1983: Hard -
    1983: At the Palace (live) -
    1979-1983: A Brief History of the Twentieth Century (comp) -
    1990: To Hell With Poverty (single) -
    1990: Mall -
    1990: Money Talks (single) -
    1995: Tatoo (single) -
    1995: Shrinkwrapped -
    -See also: http2.brunel.ac.uk -
    - -
  • - Glove, The - -
    1982: Blue Sunshine -
    -UBL Card: 1159 -
    See also: www.dcs.gla.ac.uk -
    - -
  • - God is my Copilot - -
    1993: Speed Yr Trip -
    - -
  • - Gracious Shades - -
    1995: Aberkash -
    - -
  • - Grind - -
    1995: Kittymuzzle -
    - -
  • - Grotus - -
    1993: Slow Motion Apocalypse -
    -UBL Card: 5482 -
    - -
  • - Pizzicato Five - -
    1995: The Sound of Music -
    - -
  • - PJ Harvey - -
    1992: Dry -
    1993: Rid of Me -
    1993: 4-Track Demos -
    1995: Down by the Water (single) -
    1995: To Bring You My Love -
    -UBL Card: 1221 -
    See also: www.louisville.edu -
    - -
  • - Psychick Warriors ov Gaia - -
    1992: Ov Biospheres and Sacred Groves -
    - -
  • - Hagen, Nina - -
    1985: In Ekstasy -
    1978-1982: nunsexmonkrock / Nina Hagen Band -
    - -
  • - Hate Dept. - -
    1994: Meat Your Maker -
    1995: Mainline (EP) -
    -See also: www.iuma.com -
    - -
  • - Haysi Fantayzee - -
    1982: Shiny Shiny remix (single) -
    - -
  • - Heaven 17 - -
    1981: Penthouse and Pavement -
    1982: Heaven 17 -
    1983: The Luxury Gap -
    1984: How Men Are -
    - -
  • - Hope, Peter and Kirk, Richard - -
    1988: Hoodoo Talk -
    -UBL Card: 2307 -
    - -
  • - Kershaw, Nik - -
    1983: Human Racing -
    - -
  • - Kirk, Richard - -
    1993: Virtual State -
    -UBL Card: 2307 -
    - -
  • - Human League - -
    1979: Reproduction -
    1980: Travelogue -
    1981: Dare -
    1983: Fascination -
    1984: Hysteria -
    1995: Octopus -
    -UBL Card: 4631 -
    See also: pathfinder.com -
    - -
  • - Hunters and Collectors - -
    1987: Human Frailty -
    -UBL Card: 4553 -
    - -
  • - Ice T - -
    1991: New Jack Hustler (EP) -
    -UBL Card: 2342 -
    - -
  • - In the Nursery - -
    19??: L'Esprit -
    - -
  • - INXS - -
    1982: Shabooh Shoobah -
    1984: The Swing -
    1985: Listen Like Thieves -
    1988: Kick -
    1990: X -
    -UBL Card: 1284 -
    - -
  • - J., David - -
    1983-1986: On Glass (comp) -
    1985: Crocodile Tears and the Velvet Cosh -
    -UBL Card: 1215 -
    See also: gothic.acs.csulb.edu -
    See also: isvpc146.isv.uit.no -
    - -
  • - Jesus and Mary Chain, The - -
    1992: Reverence (EP) -
    1992: Honey's Dead -
    1995: Hate Rock and Roll (comp) -
    -UBL Card: 1228 -
    See also: american.recordings.com -
    - -
  • - Jones, Grace - -
    1993: Sex Drive (single) -
    - -
  • - Jones, Howard - -
    1983: Humans' Lib -
    1985: Dream Into Action -
    - -
  • - Joy Division - -
    1977-1978: Warsaw (comp) -
    1979: Unknown Pleasures -
    1980: Closer -
    1980: Transmission / Novelty (single) -
    1980: Still -
    1977-1980: Substance (comp) -
    1995: Ceremonial: A Tribute (various) -
    -UBL Card: 1214 -
    See also: www.fys.uio.no -
    See also: csclub.uwaterloo.ca -
    - -
  • - King Crimson - -
    1969: In the Court of the Crimson King -
    1973: Larks' Tongues in Aspic -
    1974: Starless and Bible Black -
    1981: Dicipline -
    1982: Beat -
    1984: Three of a Perfect Pair -
    -UBL Card: 1323 -
    - -
  • - KMFDM - -
    1993: Angst -
    -UBL Card: 1452 -
    - -
  • - Kraftwerk - -
    1977: Trans-Europe Express (EP) -
    -UBL Card: 1027 -
    See also: wwwtdb.cs.umu.se -
    See also: rt66.com -
    - -
  • - L7 - -
    1988: L7 -
    1990: Smell the Magic -
    1992: Bricks are Heavy -
    1994: Hungry for Stink -
    -UBL Card: 1998 -
    - -
  • - Le&ae;ther Strip - -
    1995: Legacy of Hate and Lust -
    - -
  • - Lemon Kittens - -
    1978-1980: We Buy a Hammer for Daddy -
    -UBL Card: 1746 -
    - -
  • - Letters to Cleo - -
    1994: Aurora Gory Alice -
    -UBL Card: 3000 -
    - -
  • - LFO - -
    1991: Frequencies -
    1996: Advance -
    - -
  • - London After Midnight - -
    1989: Selected Scenes from the End of the World -
    - -
  • - Lords of Acid - -
    1991: Rough Sex (single) -
    1993: Voodoo U -
    1994: The Crablouse: Variations on a Species (single) -
    -UBL Card: 2356 -
    - -
  • - Lords of the New Church, The - -
    1983: Is Nothing Sacred? -
    - -
  • - Love and Rockets - -
    1985: Ball of Confusion / Inside the Outside (single) -
    1985: Seventh Dream of Teenage Heaven -
    1986: Express -
    1986: Kundalini Express / Lucifer Sam / Holiday on the Moon (single) -
    1987: Earth, Sun, Moon -
    1989: No Big Deal (single) -
    1989: Motorcycle (single) -
    1989: Love and Rockets -
    1994: This Heaven (EP) -
    1994: Body and Soul (EP) -
    1994: Hot Trip to Heaven -
    1995: The Glittering Darkness (EP) -
    1996: Sweet F. A. -
    -UBL Card: 1215 -
    See also: american.recordings.com -
    See also: gothic.acs.csulb.edu -
    - -
  • - Love is Colder than Death - -
    1993: Oxeia -
    19??: Mental Traveller -
    19??: Teignmouth -
    - -
  • - Low Pop Suicide - -
    1992: Disengagement (EP) -
    1992: On the Cross of Commerce -
    1994: Kiss Your Lips (remixes) -
    1995: The Death of Excellence -
    -UBL Card: 1984 -
    - -
  • - Luscious Jackson - -
    1992: In Search of Manny -
    1994: Natural Ingredients -
    - -
  • - Lush - -
    1990: Gala -
    1992: Spooky -
    1994: Split -
    -UBL Card: 2359 -
    See also: isvpc146.isv.uit.no -
    - -
  • - Lwin, Annabella - -
    1986: War Boys (single) -
    1994: Car Sex (EP) -
    -UBL Card: 2301 -
    - -
  • - Lycea - -
    1993: A Day in the Stark Corner -
    -See also: www.projekt.com -
    - -
  • - M - -
    1979: Pop Musik (7inch) -
    - -
  • - Machines of Loving Grace - -
    1991: Rite of Shiva (single) -
    1991: Machines of Loving Grace -
    1992: Burn Like Brilliant Trash (EP) -
    1993: Concentration -
    1995: Gilt -
    -UBL Card: 1219 -
    See also: www.nando.net -
    - -
  • - M|A|R|R|S - -
    1987: Pump Up the Volume / Anitina (single) -
    - -
  • - Mallinder, Stephen - -
    1982: Pow Wow -
    -UBL Card: 2307 -
    - -
  • - Manufacture - -
    1988: Terrorvision -
    - -
  • - March Violets, The - -
    1984: Natural History -
    1982-1984: The Botanic Verses (comp) -
    1983-1985: Electric Shades (comp) -
    1985: Deep (EP) -
    1986: A Turn to the Sky / Never Look Back / Deep / Rebirth (single) -
    -UBL Card: 1114 -
    See also: www.cm.cf.ac.uk -
    - -
  • - Martha and the Muffins - -
    1980-1984: Far Away in Time (comp) -
    -UBL Card: 2529 -
    - -
  • - Mary's Danish - -
    1991: Circa -
    -UBL Card: 3727 -
    - -
  • - MC 900 Foot Jesus - -
    1989: Hell With the Lid Off -
    1989: UFOs Are Real (EP) -
    1990: Welcome to My Dream -
    1990: Killer Inside Me (EP) -
    -UBL Card: 1229 -
    See also: american.recordings.com -
    - -
  • - McLachlan, Sarah - -
    1992: Into the Fire (single) -
    -UBL Card: 1389 -
    - -
  • - Meat Beat Manifesto - -
    1988: Armed Audio Warfare -
    1990: Dog Star Man (EP) -
    1990: 99% -
    1990: Psyche Out (EP) -
    1990: Now (EP) -
    1992: Satryicon -
    1993: Peel Session (EP) -
    -UBL Card: 3626 -
    - -
  • - Medicine - -
    1993: The Buried Life -
    1994: Shot Forth Self Living -
    -UBL Card: 1432 -
    See also: kspace.com -
    - -
  • - Mephisto Walz - -
    1986-1992: Crocosmia -
    1993: Terra-Regina (comp) -
    1994: The Eternal Deep -
    1995: Thalia -
    - -
  • - Midnight Oil - -
    1979: Head Injuries -
    1981: Place without a Postcard -
    1983: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1... -
    1985: Red Sails in the Sunset -
    -UBL Card: 1102 -
    See also: www.stevens-tech.edu -
    - -
  • - Miller, Roger - -
    1987: Maximum Electric Piano -
    - -
  • - Ministry - -
    1983: With Sympathy -
    1984: Halloween Remix / The Nature of Outtakes (EP) -
    1981-1984: various singles -
    1985: Cold Life -
    1985: Over the Shoulder / Isle of Man (EP) -
    1986: Twitch -
    1988: 12 Inch Singles (comp) -
    1988: The Land of Rape and Honey -
    1988: Stigmata / Tonight we Murder (EP) -
    1989: The Mind is a Terrible Thing to Taste -
    1991: Jesus Built my Hotrod (EP) -
    1992: Psalm 69 -
    -UBL Card: 1100 -
    See also: csclub.uwaterloo.ca -
    - -
  • - Miranda Sex Garden - -
    1991: Gush Forth my Tears -
    1991: Madra -
    1992: Iris -
    1993: Suspiria -
    1994: Fairytales of Slavery -
    -UBL Card: 3007 -
    See also: sksol1.physics.sunysb.edu -
    - -
  • - Missing Persons - -
    1982: Missing Persons (EP) -
    1982: Spring Session M -
    1984: Rhyme & Reason -
    1982-1984: Best of (comp) -
    - -
  • - Mistle Thrush - -
    199?: Silt -
    1994: Agus Amàrach -
    - -
  • - Mission, The - -
    1986: God's Own Medicine -
    1987: the First Chapter -
    -UBL Card: 2045 -
    - -
  • - Mission of Burma - -
    1987: Forget -
    - -
  • - Morissette, Alanis - -
    1995: Jagged Little Pill -
    -UBL Card: 3127 -
    - -
  • - Morrison, Patricia - -
    1994: Reflect on This -
    -UBL Card: 1062 -
    - -
  • - Moyet, Allison - -
    1985: ALF -
    -UBL Card: 3410 -
    See also: rt66.com -
    - -
  • - Murder Inc. - -
    1992: Murder Inc. -
    - -
  • - Mussolini Headkick - -
    1990: Blood on the Flag -
    - -
  • - Murphy, Peter - -
    1986: Should the World Fail to Fall Apart -
    -UBL Card: 1235 -
    See also: gothic.acs.csulb.edu -
    See also: isvpc146.isv.uit.no -
    - -
  • - My Bloody Valentine - -
    1988: Isn't Anything -
    1991: Loveless -
    -UBL Card: 1912 -
    - -
  • - My Life with the Thrill Kill Kult - -
    1988: I See Good Spirits and I See Bad Spirits -
    1989: K00Ler than Jesus -
    1990: Confessions of a Knife... -
    1990: Swine & Roses / Naive (KMFDM) (single) -
    -UBL Card: 3478 -
    - -
  • - Neither/Neither World - -
    1994: Tales of True Crime -
    - -
  • - Neotek - -
    1995: Brain over Muscle -
    - -
  • - New Fast Automatic Daffodils - -
    1991: Pigeonhole -
    1992: Bong -
    - -
  • - New Order - -
    1981: Movement -
    1981: Temptation / Hurt (single) -
    1982: Factus 8 -
    1984: Power, Corruption, and Lies -
    1984: Blue Monday (single) -
    1985: The Perfect Kiss (single) -
    1985: Confusion (single) -
    1985: Low Life -
    1983-5: various singles -
    1986: Brotherhood -
    -UBL Card: 1126 -
    See also: topquark.cecer.army.mil -
    - -
  • - Nine Inch Nails - -
    1989: Pretty Hate Machine -
    1989: Head Like a Hole (remixes) -
    1990: Sin (remixes) -
    1992: Broken (EP) -
    1992: Fixed (remixes) -
    1994: March of the Pigs (EP) -
    1994: The Downward Spiral -
    1994: Closer to God (EP) -
    1994: Closer (Further Away) (EP) -
    1994: Further Down the Spiral (remixes) -
    -UBL Card: 1046 -
    See also: www.scri.fsu.edu -
    See also: metaverse.com -
    - -
  • - Nirvana - -
    1991: Nevermind -
    -UBL Card: 1052 -
    See also: www.ludd.luth.se -
    See also: home.earthlink.net -
    - -
  • - Nitzer Ebb - -
    1987: That Total Age -
    1987: Warsaw Ghetto (EP) -
    1987: So Bright So Strong (remixes) -
    1987: Get Clean (remixes) -
    1988: Control: I'm Here (single) -
    1989: Hearts and Minds (single) -
    1989: Belief -
    1990: Showtime -
    1991: I Give to You (single) -
    1991: As Is (single) -
    1991: Ebbhead -
    1991: Godhead (EP) -
    -UBL Card: 1164 -
    See also: www.eecs.nwu.edu -
    - -
  • - No Doubt - -
    1995: Tragic Kingdom -
    - -
  • - Noise Unit - -
    1989: Grinding Into Emptiness -
    - -
  • - Nosferatu - -
    1993: Rise -
    - -
  • - Numan, Gary - -
    1978: Tubeway Army -
    1978: The Plan -
    1979: Replicas -
    1979: The Pleasure Principle -
    1980: Telekon -
    1981: Warriors -
    1981: Dance -
    1982: I, Assassin -
    1984: White Noise (double live) -
    1987: Ghost (double live) -
    -UBL Card: 1409 -
    - -
  • - Offspring - -
    1994: Smash -
    - -
  • - Oingo Boingo - -
    1980: Forbidden Zone (soundtrack) -
    1981: Only a Lad -
    1983: Good for Your Soul -
    1986: Dead Man's Party -
    1987: Nothing to Fear -
    -UBL Card: 1089 -
    See also: rhino.harvard.edu -
    - -
  • - Orb, The - -
    1991: The Orb's Adventures Beyond the Ultraworld -
    1991: Aubrey Mixes, the Ultraworld Excursions -
    1991: Little Fluffy Clouds (EP) -
    1992: U.F.Orb -
    1993: live 93 (double live) -
    1994: Pomme Fritz -
    -UBL Card: 1121 -
    See also: www.hyperlink.com -
    See also: www.phlab.missouri.edu -
    See also: rt66.com -
    - -
  • - Orbital - -
    1993: Orbital 2 -
    -UBL Card: 2049 -
    See also: rt66.com -
    - -
  • - Orchestral Manoeuvers in the Dark - -
    1980: OMD (US release) -
    1980: OMD (UK release) -
    1981: Bunker Soldiers -
    1981: Architecture & Morality -
    1983: Dazzle Ships -
    1984: Junk Culture -
    1985: Crush -
    -UBL Card: 5370 -
    - -
  • - Oxygiene 23 - -
    1995: Blue -
    - -
  • - 187 Calm - -
    1995: One Eighty Seven Calm (EP) -
    - -
  • - 1000 Homo DJs - -
    1990: Supernaut (EP) -
    - -
  • - Opus III - -
    1991: Mind Fruit -
    1994: Guru Mother -
    - -
  • - Pain Teens - -
    1990: Born in Blood / Case Histories -
    1992: Stimulation Festival -
    1993: Destroy Me, Lover -
    1995: Beast of Dreams -
    - -
  • - Paralysed Age - -
    1994: Nocturne -
    - -
  • - Pigface - -
    1990: Gub -
    -UBL Card: 1165 -
    See also: www.eecs.nwu.edu -
    - -
  • - Pink Floyd - -
    1973: Dark Side of the Moon -
    1975: Wish You were Here -
    1978: The Wall (double soundtrack) -
    1981: A Collection of Great Dance Songs (comp) -
    1995: A Saucerful of Pink: a Tribute (double, various) -
    -UBL Card: 1008 -
    - -
  • - Polygon Window - -
    1993: Surfing on Sine Waves -
    -UBL Card: 5279 -
    - -
  • - Police - -
    1979: Outlandos D'Amour -
    1980: Ghost in the Machine -
    1981: Zenyatta Mondatta -
    1983: Synchronicity -
    -UBL Card: 1172 -
    - -
  • - Poe - -
    1995: Hello -
    - -
  • - Pop, Iggy - -
    1977: Lust for Life -
    -UBL Card: 4345 -
    - -
  • - Powerman 5000 - -
    1995: The Blood Splat Rating System -
    - -
  • - Powerstation, The - -
    1985: The Powerstation -
    -UBL Card: 1259 -
    - -
  • - Pram - -
    199?: Iron Lung (EP) -
    1995: Helium -
    1995: Sargasso Sea -
    - -
  • - Prick - -
    1995: Prick -
    -UBL Card: 3683 -
    - -
  • - Primus - -
    1991: Sailing on the Seas of Cheese -
    -UBL Card: 1055 -
    - -
  • - Project Pitchfork - -
    1991: Dhyani -
    - -
  • - Propaganda - -
    1985: A Secret Wish, US version -
    1985: A Secret Wish, UK version (remixes) -
    1985: p:machinery (polish / passive) / Frozen Faces (single) -
    1985: Duel / Jewel (single) -
    1985: Wishful Thinking (remixes) -
    1990: Heaven Give Me Words (EP) -
    1995: p:machinery t-empo remix (single) -
    -UBL Card: 4636 -
    See also: rt66.com -
    See also: hcl.chass.ncsu.edu -
    - -
  • - Prophetess, The - -
    1993: The Prophetess -
    - -
  • - Public Image Limited - -
    1985: Album -
    - -
  • - Rage Against the Machine - -
    1992: Rage Against the Machine -
    -UBL Card: 1424 -
    - -
  • - Romeo Void - -
    1981: Never Say Never / Present Tense (single) -
    - -
  • - Blaine Reininger - -
    1989: Expatriate Journals -
    - -
  • - Red Aunts - -
    1993: Drag -
    1994: Bad Motherfucker 400-Z -
    1995: #1 Chicken -
    -UBL Card: 4619 -
    - -
  • - Re-Flex - -
    1983: The Politics of Dancing / Re-Flex It (single) -
    - -
  • - Revolting Cocks - -
    1986: Big Sexy Land -
    1988: You Goddamned Son of a Bitch (double live) -
    1989: Stainless Steel Providers (EP) -
    1990: Beers, Steers, and Queers -
    1993: Linger Ficken' Good -
    -UBL Card: 1100 -
    - -
  • - Ridgway, Stan - -
    1986: The Big Heat -
    -UBL Card: 2904 -
    - -
  • - Rosemarys, The - -
    1993: Providence -
    - -
  • - Rosetta Stone - -
    1993: Adrenaline -
    1995: The Tyrrany of Inaction -
    - -
  • - Ruby - -
    1995: Salt Peter -
    - -
  • - Rump - -
    1994: Hating Brenda -
    - -
  • - Rush - -
    1984: Grace Under Pressure -
    -UBL Card: 1039 -
    - -
  • - Sandoz - -
    1993: Digital Lifeforms -
    - -
  • - Scatterbrain - -
    1990: Here Comes Trouble -
    - -
  • - Scar Tissue - -
    1995: Scar Tissue -
    - -
  • - Scritti Politti - -
    1985: Cupid & Psyche -
    - -
  • - Severed Heads - -
    1983: Since the Accident -
    1986: Come Visit the Big Bigot -
    1987: Bad Mood Guy -
    -UBL Card: 1480 -
    - -
  • - Sex Gang, Andi - -
    1994: Arco Valley -
    - -
  • - Sex Gang Children - -
    1992: Blind -
    1993: Dieche -
    1993: Medea -
    - -
  • - Shadow Project - -
    1991: Shadow Project -
    - -
  • - Sharkbait - -
    1991: Blowtorch Facelift -
    1993: Crushits -
    - -
  • - Sheep on Drugs - -
    1993: Greatest Hits (comp) -
    1995: Suck (EP) -
    - -
  • - Shriekback - -
    1982: Tench -
    1983: Care -
    1983: Care (Y version) -
    1983: Lined Up / Hapax Legomena (single) -
    1983: Lined Up / My Spine / Accretions /Into Method (single) -
    1983: My Spine / Accretions / Clear Trails (single) -
    1983: Sexthinkone / Here Comes My Hand (single) -
    1984: Jamscience (UK release) -
    1984: Jamscience (Holland release) -
    1984: Knowledge, Power, Truth, and Sex -
    1984: Mercy Dash (picture disc, single) -
    1984: Hand on my Heart (picture disc, single) -
    1985: The Infinite (comp) -
    1985: Oil and Gold -
    1985: Fish Below the Ice (EP) -
    1983-1985: Priests and Kannibals (comp) -
    1986: Big Night Music -
    1986: Islam Grotto (live boot) -
    1988: Evolution (comp) -
    1990: The Dancing Years (remixes) -
    1993: Sacred City -
    -UBL Card: 1248 -
    See also: http2.brunel.ac.uk -
    - -
  • - Siglo XX - -
    1983-1986: Antler Tracks I (comp) -
    1986: Fear and Desire -
    - -
  • - Single Gun Theory - -
    1989?: Exorcise this Wasteland -
    1991: Like Stars in my Hands -
    1993: Burning Bright (but Unseen) (EP) -
    1994: Flow, River of my Soul -
    -UBL Card: 1404 -
    See also: www.magna.com.au -
    - -
  • - Siouxsie and the Banshees - -
    1977: Peel Sessions (live EP) -
    1978: Peel Sessions 2 (live EP) -
    1978: The Scream -
    1979: Join Hands -
    1980: Kaleidoscope -
    1981: juju -
    1981: Once Upon a Time (comp) -
    1981: Spellbound / Follow the Sun / Slap Dash Snap (single) -
    1982: Slowdive / Obsession II / Cannibal Roses (single) -
    1982: A Kiss in the Dream House -
    1983: Nocturne (double live) -
    1984: Hyaena -
    1985: Tinderbox -
    1986: Through the Looking Glass -
    1987: Song from the Edge of the World (single) -
    1988: Peekaboo / False Face / Catwalk (single) -
    1988: Peepshow -
    1991: Superstition -
    1991: Kiss Them for Me (EP) -
    1995: The Rapture -
    -UBL Card: 1216 -
    - -
  • - Sister Machine Gun - -
    1992: Sins of the Flesh -
    1994: The Torture Technique -
    1994: Nothing (single) -
    1994: Wired / Lung (single) -
    1995: Burn -
    -UBL Card: 3612 -
    - -
  • - Sisterhood, The - -
    1986: Gift -
    -UBL Card: 1115 -
    See also: www.cm.cf.ac.uk -
    - -
  • - Sisters of Mercy - -
    1985: First and Last and Always -
    1988: Floodland -
    1988: More / You Could be the One (single) -
    1990: Vision Thing -
    1992: Some Girls Wander by Mistake (comp) -
    1992: Temple of Love 1992 (single) -
    1993: First and Last and Forever: A Tribute (various) -
    1993: Under the Gun / Alice 1993 (single) -
    -UBL Card: 1062 -
    See also: www.cm.cf.ac.uk -
    - -
  • - Skeletal Family - -
    1984-1985: Burning Oil / Futile Combat -
    - -
  • - Skinny Puppy - -
    1983: Back and Forth, Series Two -
    1984: Bites -
    1984: Remission -
    1984: Bites and Remission -
    1986: Mind: the Perpetual Intercourse -
    1986: Dig It (EP) -
    1987: Cleanse, Fold, and Manipulate -
    1988: Vivisect VI -
    1989: Rabies -
    1990: Too Dark Park -
    1990: Censor (EP) -
    1992: 12 Inch Anthology (comp) -
    1992: Last Rights -
    -UBL Card: 1166 -
    See also: www.eecs.nwu.edu -
    - -
  • - Sky Cries Mary - -
    1993: A Return to the Inner Experience -
    1994: This Timeless Turning -
    1994: Every Iceberg is Afire / Deep Sunless Sea / Cornerman (single) -
    -UBL Card: 1437 -
    See also: www.starwave.com -
    - -
  • - Snog - -
    1995: Dear Valued Customer -
    - -
  • - Soh Daiko - -
    1990: Taiko Drum Ensemble -
    - -
  • - Some, Belouis - -
    1984: Some People (single) -
    - -
  • - Southern Death Cult - -
    1982-1983: Southern Death Cult (comp) -
    - -
  • - Spahn Ranch - -
    1995: The Coiled One -
    - -
  • - SSQ - -
    1984: Playback -
    1986: Insecurity (single) -
    - -
  • - Stabbing Westward - -
    1993: Violent Mood Swings (EP) -
    1994: Ungod -
    1995: What Do I Have to Do / Falls Apart (single) -
    1995: Wither Blister Burn and Peel -
    -UBL Card: 2415 -
    - -
  • - Strange Boutique - -
    199?: Charm -
    199?: The Kindest Words -
    199?: The Loved One -
    -See also: www.iuma.com -
    - -
  • - Steroid Maximus - -
    1991: Quilombo -
    1992: Gondwanaland -
    -UBL Card: 2750 -
    - -
  • - Sugarcubes, The - -
    1988: Life's Too Good -
    -UBL Card: 3419 -
    See also: math-www.uio.no -
    - -
  • - Sunscreem - -
    1992: O3 -
    - -
  • - Switchblade Symphony - -
    1992: Fable (tape/EP) -
    1993: Elegy (tape/EP) -
    1995: Serpentine Gallery -
    - -
  • - Talking Heads - -
    1977: Talking Heads '77 -
    1978: More Songs About Buildings and Food -
    1979: The Name of This Band is Talking Heads (double live) -
    1981: Fear of Music -
    1983: Sp eak in gI n To ngu es -
    1985: Stop Making Sense (live soundtrack) -
    1985: Little Creatures -
    -UBL Card: 1012 -
    - -
  • - Tears For Fears - -
    1983: The Hurting -
    1985: Songs From the Big Chair -
    -UBL Card: 2763 -
    - -
  • - Tel Basta - -
    1996: Lickerish -
    - -
  • - Thanatos - -
    1995: An Embassy in Gaius -
    - -
  • - Therapy? - -
    1992: Caucasian Psychosis -
    1992: Nurse -
    -UBL Card: 2044 -
    - -
  • - 13 Mg. - -
    1995: Trust and Obey -
    - -
  • - This Ascension - -
    1991: Light and Shade -
    1994: Walk Softly, a Dream Lies Here -
    - -
  • - Throwing Muses - -
    1986: Throwing Muses -
    -UBL Card: 1357 -
    - -
  • - Tinfed - -
    1993: Synaptic Hardware -
    - -
  • - Tin Machine - -
    1989: Tin Machine -
    -UBL Card: 1098 -
    - -
  • - Tit Wrench United - -
    1993: Full Employment -
    - -
  • - Tom Tom Club - -
    1981: Tom Tom Club -
    1983: Close to the Bone -
    -UBL Card: 1012 -
    - -
  • - Tones on Tail - -
    1982: Tones on Tail -
    1984: Pop -
    1984: Performance / Shakes (single) -
    1982-1984: Night Music (comp) -
    -UBL Card: 1235 -
    See also: gothic.acs.csulb.edu -
    See also: isvpc146.isv.uit.no -
    - -
  • - Trance Mission - -
    1993: Trance Mission -
    - -
  • - Trance to the Sun - -
    1994: Ghost Forest -
    1995: Bloom, Flowers, Bloom! -
    1995: Venomous Eve -
    - -
  • - Transvision Vamp - -
    1991: Little Magnets versus the Bubble of Babble -
    -UBL Card: 5305 -
    - -
  • - Trio - -
    1983: Trio and Error -
    - -
  • - Tubes, The - -
    1981: Tubes Rarities And Smash Hits [T.R.A.S.H] -
    - -
  • - Tuxedomoon - -
    1980: Half-Mute -
    1983: A Thousand Lives by Picture -
    1985: Holy Wars -
    - -
  • - Underflowers - -
    1995: Underflowers -
    - -
  • - Urban Dance Squad - -
    1991: Life'n Perspectives of a Genuine Crossover -
    -UBL Card: 4626 -
    - -
  • - Usherhouse - -
    1993: Molting -
    1994: Flux -
    - -
  • - Ultravox - -
    1978: Systems of Romance -
    - -
  • - Van Acker, Luc - -
    1980: Taking Snapshots, Volume 1 -
    -UBL Card: 1100 -
    - -
  • - Vangelis - -
    1994: Blade Runner (soundtrack) -
    -UBL Card: 1023 -
    See also: rt66.com -
    - -
  • - various - -
    1980: URGH! A Music War (live comp) -
    1981-1994: Wax Trax Black Box (comp) -
    1982-198?: In Goth Daze (Anagram version) (comp) -
    1982-1994: In Goth Daze (Cleopatra version) (comp) -
    1982-1993: The Whip (Cleopatra) (comp) -
    1984-1985: IQ6: Zang Tumb Tuum Sampled (comp) -
    1984-1995: DEC ADE NCE (Nettwerk) (comp) -
    1988: This is Electronic Body Music (comp) -
    1990: From Across This Gray Land #2 (Projekt) (comp) -
    1990: Doctor Death IV: The Marvels of Insect Life (double comp) -
    1990: Red Hot + Blue (comp) -
    1991: Bouquet of Dreams (comp) -
    1980-1992: Gothic Rock (comp) -
    1992: Mindfield (Third Mind) (comp) -
    1992: From Across This Gray Land #3 (Projekt) (comp) -
    1992: The Cyberflesh Conspiracy (comp) -
    1992: Gárgula Mecânica: World Electrostatic Assembly (comp) -
    1992: CCCC: California Cyber Crash Compilation (Cop) (comp) -
    1993: Shut Up Kitty (comp) -
    1988-1993: Can You See It Yet? (Invisible) (comp) -
    1994: Mysterious Encounters (Cleopatra) (comp) -
    1994: The Crow (comp) -
    1994: Totentanz: The Best of Zoth Ommog (double comp) -
    1992: Hy! (Hyperium Compilation volume 1) (comp) -
    1993: World Domination Sampler (comp) -
    1993: Rivet Head Culture (comp) -
    1993: Artificial Intelligence (Warp) (comp) -
    1994: Artificial Intelligence II (Warp) (comp) -
    1994: Big Hard Disk #2 (Smash) (comp) -
    1994: Kindred Spirits (Bedazzled) (comp) -
    1994: Plug In + Turn On (Instinct) (comp) -
    1994: The Disease of Lady Madeline (Anubis) (comp) -
    1994: Natural Born Killers (soundtrack comp) -
    1994: Afterburn (Wax Trax) (comp) -
    1994: Chaos Compilation (Cop) (comp) -
    1994: Electrocity Vol. 5 (comp) -
    1995: Gothik (Cleopatra) (double comp) -
    1995: Godfathers of German Gothic (comp) -
    1995: Heavenly Voices III (Hyperium) (comp) -
    1995: Mortal Kombat (soundtrack comp) -
    1995: The Tyranny Off the Beat (Off Beat/Cleopatra) (comp) -
    1995: Forced Cranial Removal (Fifth Colvmn) (comp) -
    1995: Dreams in the Witch House (Grave News) (comp) -
    - -
  • - Vega, Suzanne - -
    1992: 99.9F -
    -UBL Card: 2088 -
    - -
  • - Vinyl Devotion - -
    1994: If They Know You're Trying -
    - -
  • - Volume Magazine - -
    1991: Volume: 1 (comp) -
    1991: Volume: 2 (comp) -
    1992: Volume: 3 (comp) -
    1992: Volume: 4 (comp) -
    1995: Wasted: The Best of Volume (double comp) -
    - -
  • - Waitresses, The - -
    1981: Wasn't Tomorrow Wonderful? -
    1982: Bruiseology -
    1978-1981: Best Of (comp) -
    - -
  • - Wake, The - -
    1993: Masked -
    - -
  • - Wall of Voodoo - -
    1980: fpfpfpfpfpfp -
    1981: Dark Continent -
    1982: Call of the West -
    1986: Seven Days in Sammystown -
    1987: Happy Planet -
    - -
  • - Wang Chung - -
    1983: Points On the Curve -
    1985: To Live and Die in L.A. (soundtrack) -
    -UBL Card: 2245 -
    - -
  • - Westworld - -
    1987: Rockulator -
    1991: Movers and Shakers -
    1991: Do No Wrong (single) -
    - -
  • - Whale - -
    1994: Hobo Humpin Slobo Babe / Eye 842 (single) -
    1994: Hobo Humpin Slobo Babe / Lips / Eye 842 (single) -
    1994: Pay for Me (EP) -
    1995: We Care -
    1995: I'll Do Ya (EP) -
    1995: Hobo Humpin Slobo Babe (3 mixes) (single) -
    1995: Hobo Humpin Slobo Babe / You and Your Sister / Singer Star (single) -
    -UBL Card: 3790 -
    See also: www.vmg.co.uk -
    - -
  • - White Zombie - -
    1992: Nightcrawlers: the KMFDM Remixes (EP) -
    - -
  • - Wilde, Kim - -
    1981: Kim Wilde -
    1984: Teases & Dares -
    1981-1993: The Singles Collection (comp) -
    - -
  • - X - -
    1988: Live at the Whiskey-a-Go-Go (double live) -
    - -
  • - X Marks the Pedwalk - -
    1994: The Killing Had Begun -
    - -
  • - Xorcist - -
    1991: Damned Souls -
    1993: Bitches (EP) -
    - -
  • - XTC - -
    1982: Waxworks -
    1983: Mummer -
    1984: The Big Express -
    1985: 25 O'Clock -
    -UBL Card: 1044 -
    - -
  • - Xymox - -
    1985: Clan of Xymox -
    -UBL Card: 1295 -
    See also: isvpc146.isv.uit.no -
    - -
  • - Yamashirogumi, Geinoh - -
    1990: Akira (soundtrack) -
    - -
  • - Yazoo - -
    1982: Upstairs at Eric's -
    1982: The Other Side of Love (single) -
    1983: You and Me Both -
    1983: Nobody's Diary / State Farm (single) -
    1983: Situation (EP) -
    -UBL Card: 4309 -
    See also: rt66.com -
    - -
  • - Yello - -
    1980: Solid Pleasure -
    1981: Stella -
    1983: You Gotta Say Yes to Another Excess -
    1987: One Second -
    1988: Flag -
    -UBL Card: 1506 -
    See also: newton.space.net -
    See also: rt66.com -
    - -
  • - Yes - -
    1972: Fragile -
    1975: Classic Yes -
    1980: Drama -
    1983: 90125 -
    -UBL Card: 1038 -
    -
- ---------------167E2781446B -Content-Type: application/postscript; name="album-list.ps" -Content-Transfer-Encoding: 7bit -Content-Disposition: inline; filename="album-list.ps" - -%!PS-Adobe-3.0 -%%BoundingBox: 54 72 558 720 -%%Creator: Mozilla (NetScape) HTML->PS -%%DocumentData: Clean7Bit -%%Orientation: Portrait -%%Pages: 31 -%%PageOrder: Ascend -%%Title: jwz's tunes -%%EndComments -%%BeginProlog -[ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright - /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one - /two /three /four /five /six /seven /eight /nine /colon /semicolon - /less /equal /greater /question /at /A /B /C /D /E - /F /G /H /I /J /K /L /M /N /O - /P /Q /R /S /T /U /V /W /X /Y - /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c - /d /e /f /g /h /i /j /k /l /m - /n /o /p /q /r /s /t /u /v /w - /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef - /space /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright - /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior - /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf - /threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla - /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde - /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex - /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring - /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis - /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave - /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] /isolatin1encoding exch def -/c { matrix currentmatrix currentpoint translate - 3 1 roll scale newpath 0 0 1 0 360 arc setmatrix } bind def -/F0 - /Times-Roman findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f0 { /F0 findfont exch scalefont setfont } bind def -/F1 - /Times-Bold findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f1 { /F1 findfont exch scalefont setfont } bind def -/F2 - /Times-Italic findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f2 { /F2 findfont exch scalefont setfont } bind def -/F3 - /Times-BoldItalic findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f3 { /F3 findfont exch scalefont setfont } bind def -/F4 - /Courier findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f4 { /F4 findfont exch scalefont setfont } bind def -/F5 - /Courier-Bold findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f5 { /F5 findfont exch scalefont setfont } bind def -/F6 - /Courier-Oblique findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f6 { /F6 findfont exch scalefont setfont } bind def -/F7 - /Courier-BoldOblique findfont - dup length dict begin - {1 index /FID ne {def} {pop pop} ifelse} forall - /Encoding isolatin1encoding def - currentdict end -definefont pop -/f7 { /F7 findfont exch scalefont setfont } bind def -/rhc { - { - currentfile read { - dup 97 ge - { 87 sub true exit } - { dup 48 ge { 48 sub true exit } { pop } ifelse } - ifelse - } { - false - exit - } ifelse - } loop -} bind def - -/cvgray { % xtra_char npix cvgray - (string npix long) - dup string - 0 - { - rhc { cvr 4.784 mul } { exit } ifelse - rhc { cvr 9.392 mul } { exit } ifelse - rhc { cvr 1.824 mul } { exit } ifelse - add add cvi 3 copy put pop - 1 add - dup 3 index ge { exit } if - } loop - pop - 3 -1 roll 0 ne { rhc { pop } if } if - exch pop -} bind def - -/smartimage12rgb { % w h b [matrix] smartimage12rgb - - /colorimage where { - pop - { currentfile rowdata readhexstring pop } - false 3 - colorimage - } { - exch pop 8 exch - 3 index 12 mul 8 mod 0 ne { 1 } { 0 } ifelse - 4 index - 6 2 roll - { 2 copy cvgray } - image - pop pop - } ifelse -} def -/cshow { dup stringwidth pop 2 div neg 0 rmoveto show } bind def -/rshow { dup stringwidth pop neg 0 rmoveto show } bind def -%%EndProlog -%%Page: 1 1 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -219.1 706.9 moveto -14 f1 -(jwz's tunes) show -174 690.9 moveto -14 f1 -(Last modified: 06-Apr-96.) show -0 663.9 moveto -12 f0 -(This is a list of all of the music I have on CD, tape, and vinyl \(including all of the old, embarrasing) show -0 650.6 moveto -12 f0 -(stuff...\) This page may look a little funny if you aren't using a browser that supports HTML tables, like) show -0 637.3 moveto -12 f0 -(Mozilla) show -37.3 637.3 moveto -12 f0 -(.) show -28 610.7 moveto -12 f0 -(``) show -35.9 610.7 moveto -12 f2 -(Publishing CD lists and tape collections evokes images of lonely, pathetic men who talk) show -28 597.4 moveto -12 f2 -(about their cats incessantly.) show -162.6 597.4 moveto -12 f0 -('' -- Paul Phillips ) show -0 570.8 moveto -12 f0 -(I used to have this set up so that clicking on any name would take you to the appropriate entry of the All) show -0 557.5 moveto -12 f0 -(Music Guide at ) show -76.9 557.5 moveto -10 f4 -(gopher://allmusic.ferris.edu) show -244.9 557.5 moveto -12 f0 -(; but they have since moved their database from there) show -0 544.2 moveto -12 f0 -(to ) show -12.3 544.2 moveto -10 f4 -(cdnow.com) show -66.3 544.2 moveto -12 f0 -(, and in the process, have obfuscated access to the database to such an extent that this is no) show -0 530.9 moveto -12 f0 -(longer possible. In order to get at the discographies, you need to weed your way through dozens of) show -0 517.6 moveto -12 f0 -(pages, and there seems to be no even semi-reliable way to pre-compute the URL that they will use.) show -0 504.3 moveto -12 f0 -(Arrgh!) show -0 477.7 moveto -12 f0 -(The Internet Movie Database) show -140.2 477.7 moveto -12 f0 -( has an excellent interface for this sort of thing; I really wish more people) show -0 464.4 moveto -12 f0 -(would emulate that system.) show -0 437.8 moveto -12 f0 -(In this list, I've included links to various related web pages that I've come across; one very cool and) show -0 424.5 moveto -12 f0 -(well-organized database to which many of these links point is ) show -299.2 424.5 moveto -12 f0 -(The Ultimate Band List) show -412.8 424.5 moveto -12 f0 -(; check it out!) show -157.2 397.9 moveto -12 f0 -(Jamie Zawinski) show -232.8 397.9 moveto -12 f0 -( ) show -235.8 397.9 moveto -10 f4 -() show -343.8 397.9 moveto -12 f0 -( ) show -0 375.6 moveto -504 0 rlineto 0 -2.8 rlineto -504 0 rlineto closepath fill -18.1 348.8 moveto -3.3 3.3 c fill -31.5 340.7 moveto -12 f1 -(Act) show -49.4 340.7 moveto -12 f0 -( ) show -31.5 327.4 moveto -12 f2 -(1988:) show -59.4 327.4 moveto -12 f0 -( Laughter, Tears, and Rage ) show -298.1 341.2 moveto -12 f2 -(UBL Card: ) show -355.4 341.2 moveto -12 f0 -(4637) show -379.4 341.2 moveto -12 f0 -( ) show -298.1 327.9 moveto -12 f2 -(See also: ) show -344.7 327.9 moveto -12 f0 -(rt66.com) show -387.6 327.9 moveto -12 f0 -( ) show -298.1 314.6 moveto -12 f2 -(See also: ) show -344.7 314.6 moveto -12 f0 -(hcl.chass.ncsu.edu) show -433.6 314.6 moveto -12 f0 -( ) show -18.1 301.9 moveto -3.3 3.3 c fill -31.5 293.8 moveto -12 f1 -(Age of Chance) show -106.1 293.8 moveto -12 f0 -( ) show -31.5 280.5 moveto -12 f2 -(1987:) show -59.4 280.5 moveto -12 f0 -( Kiss ) show -86.7 280.5 moveto -12 f2 -(\(single\)) show -123.3 280.5 moveto -12 f0 -( ) show -31.5 267.2 moveto -12 f2 -(1987:) show -59.4 267.2 moveto -12 f0 -( Don't Get Mad, Get Even ) show -189.7 267.2 moveto -12 f2 -(\(single\)) show -226.3 267.2 moveto -12 f0 -( ) show -18.1 254.5 moveto -3.3 3.3 c fill -31.5 246.4 moveto -12 f1 -(Alien Sex Fiend) show -112.1 246.4 moveto -12 f0 -( ) show -31.5 233.1 moveto -12 f2 -(1983-1992:) show -87.4 233.1 moveto -12 f0 -( Drive My Rocket ) show -177.3 233.1 moveto -12 f2 -(\(comp\)) show -211.2 233.1 moveto -12 f0 -( ) show -31.5 219.8 moveto -12 f2 -(1989:) show -59.4 219.8 moveto -12 f0 -( Too Much Acid? ) show -147.3 219.8 moveto -12 f2 -(\(live\)) show -172.6 219.8 moveto -12 f0 -( ) show -31.5 206.5 moveto -12 f2 -(1990:) show -59.4 206.5 moveto -12 f0 -( Curse ) show -31.5 193.2 moveto -12 f2 -(1992:) show -59.4 193.2 moveto -12 f0 -( Open Head Surgery ) show -31.5 179.9 moveto -12 f2 -(1993:) show -59.4 179.9 moveto -12 f0 -( Altered States of America ) show -190.3 179.9 moveto -12 f2 -(\(live\)) show -215.6 179.9 moveto -12 f0 -( ) show -31.5 164 moveto -12 f2 -(1995:) show -59.4 164 moveto -12 f0 -( Inferno: The Odyssey Continues) show -218.7 168.4 moveto -10 f0 -(tm) show -229.2 164 moveto -12 f0 -( ) show -232.2 164 moveto -12 f2 -(\(soundtrack\)) show -298.1 246.9 moveto -12 f2 -(UBL Card: ) show -355.4 246.9 moveto -12 f0 -(5291) show -379.4 246.9 moveto -12 f0 -( ) show -298.1 233.6 moveto -12 f2 -(See also: ) show -344.7 233.6 moveto -12 f0 -(cent1.lancs.ac.uk) show -427 233.6 moveto -12 f0 -( ) show -18.1 151.3 moveto -3.3 3.3 c fill -31.5 143.2 moveto -12 f1 -(Alio Die) show -73.1 143.2 moveto -12 f0 -( ) show -31.5 129.9 moveto -12 f2 -(1993:) show -59.4 129.9 moveto -12 f0 -( Under a Holy Ritual ) show -298.1 143.7 moveto -12 f2 -(UBL Card: ) show -355.4 143.7 moveto -12 f0 -(1266) show -379.4 143.7 moveto -12 f0 -( ) show -298.1 130.4 moveto -12 f2 -(See also: ) show -344.7 130.4 moveto -12 f0 -(www.projekt.com) show -431.3 130.4 moveto -12 f0 -( ) show -18.1 117.2 moveto -3.3 3.3 c fill -31.5 109.1 moveto -12 f1 -(Alphaville) show -84.1 109.1 moveto -12 f0 -( ) show -31.5 95.8 moveto -12 f2 -(1984:) show -59.4 95.8 moveto -12 f0 -( Forever Young ) show -298.1 109.6 moveto -12 f2 -(UBL Card: ) show -355.4 109.6 moveto -12 f0 -(3056) show -379.4 109.6 moveto -12 f0 -( ) show -298.1 96.3 moveto -12 f2 -(See also: ) show -344.7 96.3 moveto -12 f0 -(www.escape.com) show -429.3 96.3 moveto -12 f0 -( ) show -18.1 83.1 moveto -3.3 3.3 c fill -31.5 75 moveto -12 f1 -(Altered Images) show -109.8 75 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 2 2 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1981:) show -59.4 709.2 moveto -12 f0 -( Happy Birthday ) show -31.5 695.9 moveto -12 f2 -(1983:) show -59.4 695.9 moveto -12 f0 -( Bite ) show -31.5 682.6 moveto -12 f2 -(1984:) show -59.4 682.6 moveto -12 f0 -( Collected Images ) show -149 682.6 moveto -12 f2 -(\(comp\)) show -182.9 682.6 moveto -12 f0 -( ) show -18.1 669.9 moveto -3.3 3.3 c fill -31.5 661.8 moveto -12 f1 -(An April March) show -114.8 661.8 moveto -12 f0 -( ) show -31.5 648.5 moveto -12 f2 -(1995:) show -59.4 648.5 moveto -12 f0 -( Lessons in Vengance ) show -31.5 635.2 moveto -12 f2 -(1995:) show -59.4 635.2 moveto -12 f0 -( Instruments of Lust and Fury ) show -18.1 622.5 moveto -3.3 3.3 c fill -31.5 614.4 moveto -12 f1 -(And Also the Trees) show -129.8 614.4 moveto -12 f0 -( ) show -31.5 601.1 moveto -12 f2 -(1983-1992:) show -87.4 601.1 moveto -12 f0 -( From Horizon to Horizon ) show -216.3 601.1 moveto -12 f2 -(\(comp\)) show -250.2 601.1 moveto -12 f0 -( ) show -298.1 614.9 moveto -12 f2 -(UBL Card: ) show -355.4 614.9 moveto -12 f0 -(1867) show -379.4 614.9 moveto -12 f0 -( ) show -298.1 601.6 moveto -12 f2 -(See also: ) show -344.7 601.6 moveto -12 f0 -(www.ugcs.caltech.edu) show -453 601.6 moveto -12 f0 -( ) show -298.1 588.3 moveto -12 f2 -(See also: ) show -344.7 588.3 moveto -12 f0 -(onyx.dartmouth.edu) show -441.3 588.3 moveto -12 f0 -( ) show -18.1 575.6 moveto -3.3 3.3 c fill -31.5 567.5 moveto -12 f1 -(Anderson, Laurie) show -122.1 567.5 moveto -12 f0 -( ) show -31.5 554.2 moveto -12 f2 -(1982:) show -59.4 554.2 moveto -12 f0 -( Big Science ) show -31.5 540.9 moveto -12 f2 -(1983:) show -59.4 540.9 moveto -12 f0 -( United States Live, parts 1-4 ) show -203 540.9 moveto -12 f2 -(\(5 albums\)) show -254.6 540.9 moveto -12 f0 -( ) show -31.5 527.6 moveto -12 f2 -(1984:) show -59.4 527.6 moveto -12 f0 -( Mister Heartbreak ) show -31.5 514.3 moveto -12 f2 -(1986:) show -59.4 514.3 moveto -12 f0 -( Home of the Brave ) show -157 514.3 moveto -12 f2 -(\(live soundtrack\)) show -238.6 514.3 moveto -12 f0 -( ) show -31.5 501 moveto -12 f2 -(1995:) show -59.4 501 moveto -12 f0 -( Bright Red ) show -298.1 568 moveto -12 f2 -(UBL Card: ) show -355.4 568 moveto -12 f0 -(1494) show -379.4 568 moveto -12 f0 -( ) show -298.1 554.7 moveto -12 f2 -(See also: ) show -344.7 554.7 moveto -12 f0 -(www.voyagerco.com) show -447.3 554.7 moveto -12 f0 -( ) show -298.1 541.4 moveto -12 f2 -(See also: ) show -344.7 541.4 moveto -12 f0 -(www.netpart.com) show -430.6 541.4 moveto -12 f0 -( ) show -298.1 528.1 moveto -12 f2 -(See also: ) show -344.7 528.1 moveto -12 f0 -(www.c3.lanl.gov) show -427 528.1 moveto -12 f0 -( ) show -18.1 488.3 moveto -3.3 3.3 c fill -31.5 480.2 moveto -12 f1 -(Ant, Adam) show -88.1 480.2 moveto -12 f0 -( ) show -31.5 466.9 moveto -12 f2 -(1980:) show -59.4 466.9 moveto -12 f0 -( Kings of the Wild Frontier ) show -31.5 453.6 moveto -12 f2 -(1981:) show -59.4 453.6 moveto -12 f0 -( Prince Charming ) show -31.5 440.3 moveto -12 f2 -(1982:) show -59.4 440.3 moveto -12 f0 -( Friend or Foe ) show -31.5 427 moveto -12 f2 -(1983:) show -59.4 427 moveto -12 f0 -( Dirk Wears White Sox ) show -31.5 413.7 moveto -12 f2 -(1985:) show -59.4 413.7 moveto -12 f0 -( Viva Le Rock ) show -31.5 400.4 moveto -12 f2 -(1979-1986:) show -87.4 400.4 moveto -12 f0 -( Antics in the Forbidden Zone ) show -234.7 400.4 moveto -12 f2 -(\(comp\)) show -268.6 400.4 moveto -12 f0 -( ) show -298.1 480.7 moveto -12 f2 -(UBL Card: ) show -355.4 480.7 moveto -12 f0 -(1205) show -379.4 480.7 moveto -12 f0 -( ) show -298.1 467.4 moveto -12 f2 -(See also: ) show -344.7 467.4 moveto -12 f0 -(www.uhs.uga.edu) show -431 467.4 moveto -12 f0 -( ) show -298.1 454.1 moveto -12 f2 -(See also: ) show -344.7 454.1 moveto -12 f0 -(caprec.com) show -399.6 454.1 moveto -12 f0 -( ) show -18.1 387.7 moveto -3.3 3.3 c fill -31.5 379.6 moveto -12 f1 -(Anthrax) show -74.8 379.6 moveto -12 f0 -( ) show -31.5 366.3 moveto -12 f2 -(1991:) show -59.4 366.3 moveto -12 f0 -( Attack of the Killer B's ) show -178.7 366.3 moveto -12 f2 -(\(comp\)) show -212.6 366.3 moveto -12 f0 -( ) show -298.1 380.1 moveto -12 f2 -(UBL Card: ) show -355.4 380.1 moveto -12 f0 -(2710) show -379.4 380.1 moveto -12 f0 -( ) show -18.1 353.6 moveto -3.3 3.3 c fill -31.5 345.5 moveto -12 f1 -(Aphex Twin) show -94.5 345.5 moveto -12 f0 -( ) show -31.5 332.2 moveto -12 f2 -(1993:) show -59.4 332.2 moveto -12 f0 -( On ) show -80 332.2 moveto -12 f2 -(\(EP\)) show -102.6 332.2 moveto -12 f0 -( ) show -31.5 318.9 moveto -12 f2 -(1994:) show -59.4 318.9 moveto -12 f0 -( Analogue Bubblebath ) show -170.3 318.9 moveto -12 f2 -(\(EP\)) show -192.9 318.9 moveto -12 f0 -( ) show -31.5 305.6 moveto -12 f2 -(1995:) show -59.4 305.6 moveto -12 f0 -( Ventolin ) show -107.4 305.6 moveto -12 f2 -(\(EP\)) show -130 305.6 moveto -12 f0 -( ) show -298.1 346 moveto -12 f2 -(UBL Card: ) show -355.4 346 moveto -12 f0 -(5279) show -379.4 346 moveto -12 f0 -( ) show -298.1 332.7 moveto -12 f2 -(See also: ) show -344.7 332.7 moveto -12 f0 -(hyperreal.com) show -413.6 332.7 moveto -12 f0 -( ) show -298.1 319.4 moveto -12 f2 -(See also: ) show -344.7 319.4 moveto -12 f0 -(pathfinder.com) show -417.6 319.4 moveto -12 f0 -( ) show -18.1 292.9 moveto -3.3 3.3 c fill -31.5 284.8 moveto -12 f1 -(Arcadia) show -72.8 284.8 moveto -12 f0 -( ) show -31.5 271.5 moveto -12 f2 -(1985:) show -59.4 271.5 moveto -12 f0 -( So Red the Rose ) show -298.1 285.3 moveto -12 f2 -(UBL Card: ) show -355.4 285.3 moveto -12 f0 -(1259) show -379.4 285.3 moveto -12 f0 -( ) show -18.1 258.8 moveto -3.3 3.3 c fill -31.5 250.7 moveto -12 f1 -(Armageddon Dildos) show -134.5 250.7 moveto -12 f0 -( ) show -31.5 237.4 moveto -12 f2 -(1995:) show -59.4 237.4 moveto -12 f0 -( Lost ) show -305.3 251.2 moveto -12 f2 -(UBL Card: ) show -362.6 251.2 moveto -12 f0 -(2538) show -386.6 251.2 moveto -12 f0 -( ) show -18.1 224.7 moveto -3.3 3.3 c fill -31.5 216.6 moveto -12 f1 -(Ash, Daniel) show -90.8 216.6 moveto -12 f0 -( ) show -31.5 203.3 moveto -12 f2 -(1991:) show -59.4 203.3 moveto -12 f0 -( Coming Down ) show -31.5 190 moveto -12 f2 -(1992:) show -59.4 190 moveto -12 f0 -( Foolish Thing Desire ) show -298.1 217.1 moveto -12 f2 -(See also: ) show -344.7 217.1 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 217.1 moveto -12 f0 -( ) show -18.1 177.3 moveto -3.3 3.3 c fill -31.5 169.2 moveto -12 f1 -(Archangel, Nathalie) show -134.1 169.2 moveto -12 f0 -( ) show -31.5 155.9 moveto -12 f2 -(1992:) show -59.4 155.9 moveto -12 f0 -( Owl ) show -18.1 143.2 moveto -3.3 3.3 c fill -31.5 135.1 moveto -12 f1 -(Art of Noise) show -93.4 135.1 moveto -12 f0 -( ) show -31.5 121.8 moveto -12 f2 -(1983:) show -59.4 121.8 moveto -12 f0 -( Who's Afraid of the Art of Noise? ) show -31.5 108.5 moveto -12 f2 -(1983:) show -59.4 108.5 moveto -12 f0 -( The Art of Noise Have Closed Up ) show -31.5 95.2 moveto -12 f2 -(1983:) show -59.4 95.2 moveto -12 f0 -( Beatbox ) show -31.5 81.9 moveto -12 f2 -(1983:) show -59.4 81.9 moveto -12 f0 -( Daft ) show -298.1 135.6 moveto -12 f2 -(UBL Card: ) show -355.4 135.6 moveto -12 f0 -(1918) show -379.4 135.6 moveto -12 f0 -( ) show -298.1 122.3 moveto -12 f2 -(See also: ) show -344.7 122.3 moveto -12 f0 -(rt66.com) show -387.6 122.3 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 3 3 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1984:) show -59.4 709.2 moveto -12 f0 -( Edited ) show -96.7 709.2 moveto -12 f2 -(\(picture disc\)) show -161 709.2 moveto -12 f0 -( ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Attrition) show -76.8 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1985:) show -59.4 675.1 moveto -12 f0 -( Smiling, at the Hypogonder Club ) show -225 675.1 moveto -12 f2 -(\(comp\)) show -258.9 675.1 moveto -12 f0 -( ) show -298.1 688.9 moveto -12 f2 -(UBL Card: ) show -355.4 688.9 moveto -12 f0 -(4232) show -379.4 688.9 moveto -12 f0 -( ) show -298.1 675.6 moveto -12 f2 -(See also: ) show -344.7 675.6 moveto -12 f0 -(www.projekt.com) show -431.3 675.6 moveto -12 f0 -( ) show -18.1 662.4 moveto -3.3 3.3 c fill -31.5 654.3 moveto -12 f1 -(AUTECHRe) show -96.8 654.3 moveto -12 f0 -( ) show -31.5 641 moveto -12 f2 -(1994:) show -59.4 641 moveto -12 f0 -( INCUNABULA ) show -31.5 627.7 moveto -12 f2 -(1994:) show -59.4 627.7 moveto -12 f0 -( BASSCAD,EP ) show -137.7 627.7 moveto -12 f2 -(\(EP\)) show -160.3 627.7 moveto -12 f0 -( ) show -31.5 614.4 moveto -12 f2 -(1994:) show -59.4 614.4 moveto -12 f0 -( Amber ) show -31.5 601.1 moveto -12 f2 -(1995:) show -59.4 601.1 moveto -12 f0 -( Garbage ) show -18.1 588.4 moveto -3.3 3.3 c fill -31.5 580.3 moveto -12 f1 -(B52's) show -60.1 580.3 moveto -12 f0 -( ) show -31.5 567 moveto -12 f2 -(1979:) show -59.4 567 moveto -12 f0 -( B52's ) show -31.5 553.7 moveto -12 f2 -(1980:) show -59.4 553.7 moveto -12 f0 -( Wild Planet ) show -31.5 540.4 moveto -12 f2 -(1982:) show -59.4 540.4 moveto -12 f0 -( Mesopotamia ) show -31.5 527.1 moveto -12 f2 -(1983:) show -59.4 527.1 moveto -12 f0 -( Whammy! ) show -31.5 513.8 moveto -12 f2 -(1981:) show -59.4 513.8 moveto -12 f0 -( Party Mix ) show -305.7 580.8 moveto -12 f2 -(UBL Card: ) show -363 580.8 moveto -12 f0 -(2268) show -387 580.8 moveto -12 f0 -( ) show -18.1 501.1 moveto -3.3 3.3 c fill -31.5 493 moveto -12 f1 -(Babes in Toyland) show -120.8 493 moveto -12 f0 -( ) show -31.5 479.7 moveto -12 f2 -(1989:) show -59.4 479.7 moveto -12 f0 -( Spanking Machine ) show -31.5 466.4 moveto -12 f2 -(1991:) show -59.4 466.4 moveto -12 f0 -( To Mother ) show -31.5 453.1 moveto -12 f2 -(1992:) show -59.4 453.1 moveto -12 f0 -( Fontanelle ) show -31.5 439.8 moveto -12 f2 -(1993:) show -59.4 439.8 moveto -12 f0 -( Pain Killers ) show -31.5 426.5 moveto -12 f2 -(1995:) show -59.4 426.5 moveto -12 f0 -( Nemesisters ) show -302.9 493.5 moveto -12 f2 -(UBL Card: ) show -360.2 493.5 moveto -12 f0 -(3190) show -384.2 493.5 moveto -12 f0 -( ) show -18.1 413.8 moveto -3.3 3.3 c fill -31.5 405.7 moveto -12 f1 -(Battery) show -70.1 405.7 moveto -12 f0 -( ) show -31.5 392.4 moveto -12 f2 -(1992:) show -59.4 392.4 moveto -12 f0 -( Meat Market ) show -127.7 392.4 moveto -12 f2 -(\(EP\)) show -150.3 392.4 moveto -12 f0 -( ) show -31.5 379.1 moveto -12 f2 -(1993:) show -59.4 379.1 moveto -12 f0 -( Mutate ) show -31.5 365.8 moveto -12 f2 -(1994:) show -59.4 365.8 moveto -12 f0 -( Lillith 3.2 ) show -113.4 365.8 moveto -12 f2 -(\(EP\)) show -136 365.8 moveto -12 f0 -( ) show -31.5 352.5 moveto -12 f2 -(1995:) show -59.4 352.5 moveto -12 f0 -( nv ) show -18.1 339.8 moveto -3.3 3.3 c fill -31.5 331.7 moveto -12 f1 -(Bauhaus) show -76.1 331.7 moveto -12 f0 -( ) show -31.5 318.4 moveto -12 f2 -(1979:) show -59.4 318.4 moveto -12 f0 -( Bela Lugosi's Dead ) show -160.7 318.4 moveto -12 f2 -(\(EP\)) show -183.3 318.4 moveto -12 f0 -( ) show -31.5 305.1 moveto -12 f2 -(1981:) show -59.4 305.1 moveto -12 f0 -( In the Flat Field ) show -31.5 291.8 moveto -12 f2 -(1981:) show -59.4 291.8 moveto -12 f0 -( Mask ) show -31.5 278.5 moveto -12 f2 -(1981:) show -59.4 278.5 moveto -12 f0 -( Press the Eject and Give Me the Tape ) show -246.3 278.5 moveto -12 f2 -(\(live\)) show -271.6 278.5 moveto -12 f0 -( ) show -31.5 265.2 moveto -12 f2 -(1983:) show -59.4 265.2 moveto -12 f0 -( Burning from the Inside ) show -31.5 251.9 moveto -12 f2 -(1979-1984:) show -87.4 251.9 moveto -12 f0 -( 1979-1984 ) show -145.3 251.9 moveto -12 f2 -(\(comp\)) show -179.2 251.9 moveto -12 f0 -( ) show -31.5 238.6 moveto -12 f2 -(1985:) show -59.4 238.6 moveto -12 f0 -( The Sky's Gone Out ) show -31.5 225.3 moveto -12 f2 -(1984:) show -59.4 225.3 moveto -12 f0 -( The Last Temptation ) show -166 225.3 moveto -12 f2 -(\(live boot\)) show -215.6 225.3 moveto -12 f0 -( ) show -31.5 212 moveto -12 f2 -(1984:) show -59.4 212 moveto -12 f0 -( Rest In Peace: The Final Concert ) show -224.3 212 moveto -12 f2 -(\(double live\)) show -285.2 212 moveto -12 f0 -( ) show -31.5 198.7 moveto -12 f2 -(1996:) show -59.4 198.7 moveto -12 f0 -( The Passion of Covers: A Tribute ) show -227 198.7 moveto -12 f2 -(\(various\)) show -270.9 198.7 moveto -12 f0 -( ) show -298.1 332.2 moveto -12 f2 -(UBL Card: ) show -355.4 332.2 moveto -12 f0 -(1235) show -379.4 332.2 moveto -12 f0 -( ) show -298.1 318.9 moveto -12 f2 -(See also: ) show -344.7 318.9 moveto -12 f0 -(gothic.acs.csulb.edu) show -441.6 318.9 moveto -12 f0 -( ) show -298.1 305.6 moveto -12 f2 -(See also: ) show -344.7 305.6 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 305.6 moveto -12 f0 -( ) show -18.1 186 moveto -3.3 3.3 c fill -31.5 177.9 moveto -12 f1 -(Belly) show -57.5 177.9 moveto -12 f0 -( ) show -31.5 164.6 moveto -12 f2 -(1993:) show -59.4 164.6 moveto -12 f0 -( Star ) show -31.5 151.3 moveto -12 f2 -(1993:) show -59.4 151.3 moveto -12 f0 -( Moon ) show -94 151.3 moveto -12 f2 -(\(EP\)) show -116.6 151.3 moveto -12 f0 -( ) show -31.5 138 moveto -12 f2 -(1995:) show -59.4 138 moveto -12 f0 -( Baby Silvertooth ) show -147 138 moveto -12 f2 -(\(EP\)) show -169.6 138 moveto -12 f0 -( ) show -31.5 124.7 moveto -12 f2 -(1995:) show -59.4 124.7 moveto -12 f0 -( King ) show -298.1 178.4 moveto -12 f2 -(UBL Card: ) show -355.4 178.4 moveto -12 f0 -(1360) show -379.4 178.4 moveto -12 f0 -( ) show -298.1 165.1 moveto -12 f2 -(See also: ) show -344.7 165.1 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 165.1 moveto -12 f0 -( ) show -18.1 112 moveto -3.3 3.3 c fill -31.5 103.9 moveto -12 f1 -(Berlin) show -63.5 103.9 moveto -12 f0 -( ) show -31.5 90.6 moveto -12 f2 -(1981:) show -59.4 90.6 moveto -12 f0 -( Love Life ) show -31.5 77.3 moveto -12 f2 -(1981:) show -59.4 77.3 moveto -12 f0 -( Dancing in Berlin / Lost in the Crowd ) show -247.7 77.3 moveto -12 f2 -(\(single\)) show -284.3 77.3 moveto -12 f0 -( ) show -298.1 104.4 moveto -12 f2 -(UBL Card: ) show -355.4 104.4 moveto -12 f0 -(4156) show -379.4 104.4 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 4 4 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1982:) show -59.4 709.2 moveto -12 f0 -( Pleasure Victim ) show -31.5 695.9 moveto -12 f2 -(1986:) show -59.4 695.9 moveto -12 f0 -( Count 3 and Pray ) show -18.1 683.2 moveto -3.3 3.3 c fill -31.5 675.1 moveto -12 f1 -(Big Black) show -81.1 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1983:) show -59.4 661.8 moveto -12 f0 -( The Hammer Party ) show -31.5 648.5 moveto -12 f2 -(1987:) show -59.4 648.5 moveto -12 f0 -( Songs About Fucking ) show -31.5 635.2 moveto -12 f2 -(1992:) show -59.4 635.2 moveto -12 f0 -( The Rich Man's Eight-Track Tape ) show -231.3 635.2 moveto -12 f2 -(\(comp\)) show -265.2 635.2 moveto -12 f0 -( ) show -302.7 675.6 moveto -12 f2 -(UBL Card: ) show -360 675.6 moveto -12 f0 -(2410) show -384 675.6 moveto -12 f0 -( ) show -18.1 622.5 moveto -3.3 3.3 c fill -31.5 614.4 moveto -12 f1 -(Big Hat) show -71.1 614.4 moveto -12 f0 -( ) show -31.5 601.1 moveto -12 f2 -(1993:) show -59.4 601.1 moveto -12 f0 -( Selena at my Window ) show -298.1 614.9 moveto -12 f2 -(UBL Card: ) show -355.4 614.9 moveto -12 f0 -(1217) show -379.4 614.9 moveto -12 f0 -( ) show -298.1 601.6 moveto -12 f2 -(See also: ) show -344.7 601.6 moveto -12 f0 -(www.cec.wustl.edu) show -439 601.6 moveto -12 f0 -( ) show -18.1 588.4 moveto -3.3 3.3 c fill -31.5 580.3 moveto -12 f1 -(Bigod 20) show -76.5 580.3 moveto -12 f0 -( ) show -31.5 567 moveto -12 f2 -(1990:) show -59.4 567 moveto -12 f0 -( The Bog ) show -107 567 moveto -12 f2 -(\(EP\)) show -129.6 567 moveto -12 f0 -( ) show -31.5 553.7 moveto -12 f2 -(1991:) show -59.4 553.7 moveto -12 f0 -( Carpe Diem ) show -123.7 553.7 moveto -12 f2 -(\(EP\)) show -146.3 553.7 moveto -12 f0 -( ) show -18.1 541 moveto -3.3 3.3 c fill -31.5 532.9 moveto -12 f1 -(Bikini Kill) show -85.2 532.9 moveto -12 f0 -( ) show -31.5 519.6 moveto -12 f2 -(1991-1992:) show -87.4 519.6 moveto -12 f0 -( The C.D. Version of the First Two) show -31.5 506.3 moveto -12 f0 -(Records ) show -298.1 533.4 moveto -12 f2 -(UBL Card: ) show -355.4 533.4 moveto -12 f0 -(4444) show -379.4 533.4 moveto -12 f0 -( ) show -298.1 520.1 moveto -12 f2 -(See also: ) show -344.7 520.1 moveto -12 f0 -(www.columbia.edu) show -438.6 520.1 moveto -12 f0 -( ) show -18.1 493.6 moveto -3.3 3.3 c fill -31.5 485.5 moveto -12 f1 -(Billy Nayer Show, The) show -146.8 485.5 moveto -12 f0 -( ) show -31.5 472.2 moveto -12 f2 -(1994:) show -59.4 472.2 moveto -12 f0 -( The Ketchup and Mustard Man ) show -18.1 459.5 moveto -3.3 3.3 c fill -31.5 451.4 moveto -12 f1 -(Billy and the Boingers) show -145.1 451.4 moveto -12 f0 -( ) show -31.5 438.1 moveto -12 f2 -(1987:) show -59.4 438.1 moveto -12 f0 -( U Stink but I Love You ) show -179 438.1 moveto -12 f2 -(\(flexydisk\)) show -228.9 438.1 moveto -12 f0 -( ) show -18.1 425.4 moveto -3.3 3.3 c fill -31.5 417.3 moveto -12 f1 -(Birdsongs of the Messozoic) show -169.8 417.3 moveto -12 f0 -( ) show -31.5 404 moveto -12 f2 -(1980-1987:) show -87.4 404 moveto -12 f0 -( The Fossil Record ) show -31.5 390.7 moveto -12 f2 -(1983:) show -59.4 390.7 moveto -12 f0 -( Sonic Geology ) show -18.1 378 moveto -3.3 3.3 c fill -31.5 369.9 moveto -12 f1 -(Birmingham 6) show -105.8 369.9 moveto -12 f0 -( ) show -31.5 356.6 moveto -12 f2 -(1995:) show -59.4 356.6 moveto -12 f0 -( Police State ) show -304.5 370.4 moveto -12 f2 -(UBL Card: ) show -361.8 370.4 moveto -12 f0 -(4348) show -385.8 370.4 moveto -12 f0 -( ) show -18.1 343.9 moveto -3.3 3.3 c fill -31.5 335.8 moveto -12 f1 -(Black Tape for a Blue Girl) show -167.8 335.8 moveto -12 f0 -( ) show -31.5 322.5 moveto -12 f2 -(1986:) show -59.4 322.5 moveto -12 f0 -( The Rope ) show -31.5 309.2 moveto -12 f2 -(1987:) show -59.4 309.2 moveto -12 f0 -( Mesmerized by the Sirens ) show -31.5 295.9 moveto -12 f2 -(1989:) show -59.4 295.9 moveto -12 f0 -( Ashes in the Brittle Air ) show -31.5 282.6 moveto -12 f2 -(1993:) show -59.4 282.6 moveto -12 f0 -( This Lush Garden Within ) show -298.1 336.3 moveto -12 f2 -(UBL Card: ) show -355.4 336.3 moveto -12 f0 -(1202) show -379.4 336.3 moveto -12 f0 -( ) show -298.1 323 moveto -12 f2 -(See also: ) show -344.7 323 moveto -12 f0 -(www.projekt.com) show -431.3 323 moveto -12 f0 -( ) show -18.1 269.9 moveto -3.3 3.3 c fill -31.5 261.8 moveto -12 f1 -(Bleeding Stone, The) show -133.8 261.8 moveto -12 f0 -( ) show -31.5 248.5 moveto -12 f2 -(1994:) show -59.4 248.5 moveto -12 f0 -( Silent Insanity ) show -135 248.5 moveto -12 f2 -(\(EP\)) show -157.6 248.5 moveto -12 f0 -( ) show -18.1 235.8 moveto -3.3 3.3 c fill -31.5 227.7 moveto -12 f1 -(Blondie) show -70.8 227.7 moveto -12 f0 -( ) show -31.5 214.4 moveto -12 f2 -(1980:) show -59.4 214.4 moveto -12 f0 -( Autoamerican ) show -31.5 201.1 moveto -12 f2 -(1983:) show -59.4 201.1 moveto -12 f0 -( Best of Blondie ) show -306.4 228.2 moveto -12 f2 -(UBL Card: ) show -363.7 228.2 moveto -12 f0 -(2070) show -387.7 228.2 moveto -12 f0 -( ) show -18.1 188.4 moveto -3.3 3.3 c fill -31.5 180.3 moveto -12 f1 -(Blotto) show -62.8 180.3 moveto -12 f0 -( ) show -31.5 167 moveto -12 f2 -(1994:) show -59.4 167 moveto -12 f0 -( Collected Works ) show -18.1 154.3 moveto -3.3 3.3 c fill -31.5 146.2 moveto -12 f1 -(Body Count) show -93.1 146.2 moveto -12 f0 -( ) show -31.5 132.9 moveto -12 f2 -(1992:) show -59.4 132.9 moveto -12 f0 -( Body Count ) show -298.1 146.7 moveto -12 f2 -(UBL Card: ) show -355.4 146.7 moveto -12 f0 -(1277) show -379.4 146.7 moveto -12 f0 -( ) show -18.1 120.2 moveto -3.3 3.3 c fill -31.5 112.1 moveto -12 f1 -(Bowie, David) show -99.5 112.1 moveto -12 f0 -( ) show -31.5 98.8 moveto -12 f2 -(1995:) show -59.4 98.8 moveto -12 f0 -( Outside ) show -298.1 112.6 moveto -12 f2 -(UBL Card: ) show -355.4 112.6 moveto -12 f0 -(1098) show -379.4 112.6 moveto -12 f0 -( ) show -18.1 86.1 moveto -3.3 3.3 c fill -31.5 78 moveto -12 f1 -(Bow Wow Wow) show -113.4 78 moveto -12 f0 -( ) show -300.6 78.5 moveto -12 f2 -(UBL Card: ) show -357.9 78.5 moveto -12 f0 -(2301) show -381.9 78.5 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 5 5 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1982:) show -59.4 709.2 moveto -12 f0 -( See Jungle ) show -31.5 695.9 moveto -12 f2 -(1981-1982:) show -87.4 695.9 moveto -12 f0 -( I Want Candy ) show -160.7 695.9 moveto -12 f2 -(\(comp\)) show -194.6 695.9 moveto -12 f0 -( ) show -31.5 682.6 moveto -12 f2 -(1983:) show -59.4 682.6 moveto -12 f0 -( When the Going Gets Tough ) show -31.5 669.3 moveto -12 f2 -(1981-1983:) show -87.4 669.3 moveto -12 f0 -( Girl Bites Dog ) show -164 669.3 moveto -12 f2 -(\(comp\)) show -197.9 669.3 moveto -12 f0 -( ) show -18.1 656.6 moveto -3.3 3.3 c fill -31.5 648.5 moveto -12 f1 -(Breeders, The) show -103.4 648.5 moveto -12 f0 -( ) show -31.5 635.2 moveto -12 f2 -(1993:) show -59.4 635.2 moveto -12 f0 -( Last Splash ) show -298.1 649 moveto -12 f2 -(UBL Card: ) show -355.4 649 moveto -12 f0 -(1242) show -379.4 649 moveto -12 f0 -( ) show -298.1 635.7 moveto -12 f2 -(See also: ) show -344.7 635.7 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 635.7 moveto -12 f0 -( ) show -18.1 622.5 moveto -3.3 3.3 c fill -31.5 614.4 moveto -12 f1 -(Br\374cken, Claudia) show -122.1 614.4 moveto -12 f0 -( ) show -31.5 601.1 moveto -12 f2 -(1991:) show -59.4 601.1 moveto -12 f0 -( Love and a Million Other Things ) show -298.1 614.9 moveto -12 f2 -(UBL Card: ) show -355.4 614.9 moveto -12 f0 -(4636) show -379.4 614.9 moveto -12 f0 -( ) show -298.1 601.6 moveto -12 f2 -(See also: ) show -344.7 601.6 moveto -12 f0 -(rt66.com) show -387.6 601.6 moveto -12 f0 -( ) show -298.1 588.3 moveto -12 f2 -(See also: ) show -344.7 588.3 moveto -12 f0 -(hcl.chass.ncsu.edu) show -433.6 588.3 moveto -12 f0 -( ) show -18.1 575.6 moveto -3.3 3.3 c fill -31.5 567.5 moveto -12 f1 -(Buggles, The) show -97.5 567.5 moveto -12 f0 -( ) show -31.5 554.2 moveto -12 f2 -(1979:) show -59.4 554.2 moveto -12 f0 -( The Age of Plastic ) show -31.5 540.9 moveto -12 f2 -(1981:) show -59.4 540.9 moveto -12 f0 -( Adventures in Modern Recording ) show -18.1 528.2 moveto -3.3 3.3 c fill -31.5 520.1 moveto -12 f1 -(Bush, Kate) show -88.1 520.1 moveto -12 f0 -( ) show -31.5 506.8 moveto -12 f2 -(1977:) show -59.4 506.8 moveto -12 f0 -( The Kick Inside ) show -31.5 493.5 moveto -12 f2 -(1980:) show -59.4 493.5 moveto -12 f0 -( Never For Ever ) show -31.5 480.2 moveto -12 f2 -(1983:) show -59.4 480.2 moveto -12 f0 -( The Dreaming ) show -31.5 466.9 moveto -12 f2 -(1985:) show -59.4 466.9 moveto -12 f0 -( Hounds of Love ) show -298.1 520.6 moveto -12 f2 -(UBL Card: ) show -355.4 520.6 moveto -12 f0 -(1032) show -379.4 520.6 moveto -12 f0 -( ) show -298.1 507.3 moveto -12 f2 -(See also: ) show -344.7 507.3 moveto -12 f0 -(actor.cs.vt.edu) show -414.3 507.3 moveto -12 f0 -( ) show -298.1 494 moveto -12 f2 -(See also: ) show -344.7 494 moveto -12 f0 -(www.jrc.flinders.edu.au) show -460.6 494 moveto -12 f0 -( ) show -298.1 480.7 moveto -12 f2 -(See also: ) show -344.7 480.7 moveto -12 f0 -(holly.city.unisa.edu.au) show -453.3 480.7 moveto -12 f0 -( ) show -18.1 454.2 moveto -3.3 3.3 c fill -31.5 446.1 moveto -12 f1 -(Buzzcocks) show -84.8 446.1 moveto -12 f0 -( ) show -31.5 432.8 moveto -12 f2 -(1976-1979:) show -87.4 432.8 moveto -12 f0 -( Operators Manual ) show -300.6 446.6 moveto -12 f2 -(UBL Card: ) show -357.9 446.6 moveto -12 f0 -(1351) show -381.9 446.6 moveto -12 f0 -( ) show -18.1 420.1 moveto -3.3 3.3 c fill -31.5 412 moveto -12 f1 -(Cabaret Voltaire) show -118.4 412 moveto -12 f0 -( ) show -31.5 398.7 moveto -12 f2 -(1974-1976:) show -87.4 398.7 moveto -12 f0 -( 1974-1976 ) show -145.3 398.7 moveto -12 f2 -(\(comp\)) show -179.2 398.7 moveto -12 f0 -( ) show -31.5 385.4 moveto -12 f2 -(1978-1983:) show -87.4 385.4 moveto -12 f0 -( The Golden Moments of CV ) show -231.3 385.4 moveto -12 f2 -(\(comp\)) show -265.2 385.4 moveto -12 f0 -( ) show -31.5 372.1 moveto -12 f2 -(1978:) show -59.4 372.1 moveto -12 f0 -( Nag Nag Nag ) show -131.3 372.1 moveto -12 f2 -(\(EP\)) show -153.9 372.1 moveto -12 f0 -( ) show -31.5 358.8 moveto -12 f2 -(1979:) show -59.4 358.8 moveto -12 f0 -( Mix-Up ) show -104 358.8 moveto -12 f2 -(\(EP\)) show -126.6 358.8 moveto -12 f0 -( ) show -31.5 345.5 moveto -12 f2 -(1980:) show -59.4 345.5 moveto -12 f0 -( Red Mecca ) show -31.5 332.2 moveto -12 f2 -(1981:) show -59.4 332.2 moveto -12 f0 -( The Voice of America ) show -31.5 318.9 moveto -12 f2 -(1981:) show -59.4 318.9 moveto -12 f0 -( Johnny Yesno ) show -133.7 318.9 moveto -12 f2 -(\(soundtrack\)) show -195 318.9 moveto -12 f0 -( ) show -31.5 305.6 moveto -12 f2 -(1982:) show -59.4 305.6 moveto -12 f0 -( 2X45 ) show -31.5 292.3 moveto -12 f2 -(1982:) show -59.4 292.3 moveto -12 f0 -( Eight Crepescule Tracks ) show -31.5 279 moveto -12 f2 -(1983:) show -59.4 279 moveto -12 f0 -( The Crackdown ) show -31.5 265.7 moveto -12 f2 -(1984:) show -59.4 265.7 moveto -12 f0 -( Micro-Phonies ) show -31.5 252.4 moveto -12 f2 -(1985:) show -59.4 252.4 moveto -12 f0 -( I Want You ) show -122 252.4 moveto -12 f2 -(\(single\)) show -158.6 252.4 moveto -12 f0 -( ) show -31.5 239.1 moveto -12 f2 -(1985:) show -59.4 239.1 moveto -12 f0 -( Drinking Gasoline ) show -31.5 225.8 moveto -12 f2 -(1985:) show -59.4 225.8 moveto -12 f0 -( The Arm of the Lord ) show -31.5 212.5 moveto -12 f2 -(1985:) show -59.4 212.5 moveto -12 f0 -( The Convenant, the Sword, and the Arm of the) show -31.5 199.2 moveto -12 f0 -(Lord ) show -31.5 185.9 moveto -12 f2 -(1986:) show -59.4 185.9 moveto -12 f0 -( The Drain Train ) show -31.5 172.6 moveto -12 f2 -(1987:) show -59.4 172.6 moveto -12 f0 -( Code ) show -31.5 159.3 moveto -12 f2 -(1990:) show -59.4 159.3 moveto -12 f0 -( Listen Up ) show -113 159.3 moveto -12 f2 -(\(double comp\)) show -182.6 159.3 moveto -12 f0 -( ) show -31.5 146 moveto -12 f2 -(1991:) show -59.4 146 moveto -12 f0 -( Body and Soul ) show -31.5 132.7 moveto -12 f2 -(1991:) show -59.4 132.7 moveto -12 f0 -( Colors ) show -31.5 119.4 moveto -12 f2 -(1992:) show -59.4 119.4 moveto -12 f0 -( Plasticity ) show -31.5 106.1 moveto -12 f2 -(1992:) show -59.4 106.1 moveto -12 f0 -( Western Reworks ) show -306.4 412.5 moveto -12 f2 -(UBL Card: ) show -363.7 412.5 moveto -12 f0 -(2307) show -387.7 412.5 moveto -12 f0 -( ) show -18.1 93.4 moveto -3.3 3.3 c fill -31.5 85.3 moveto -12 f1 -(Cave, Nick) show -87.4 85.3 moveto -12 f0 -( ) show -298.1 85.8 moveto -12 f2 -(UBL Card: ) show -355.4 85.8 moveto -12 f0 -(1273) show -379.4 85.8 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 6 6 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1984:) show -59.4 709.2 moveto -12 f0 -( From Her to Eternity ) show -31.5 695.9 moveto -12 f2 -(1988:) show -59.4 695.9 moveto -12 f0 -( Tender Prey ) show -18.1 683.2 moveto -3.3 3.3 c fill -31.5 675.1 moveto -12 f1 -(Chemlab) show -78.1 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1993:) show -59.4 661.8 moveto -12 f0 -( Burnout at the Hydrogen Bar ) show -31.5 648.5 moveto -12 f2 -(1994:) show -59.4 648.5 moveto -12 f0 -( Magnetic Field Remixes ) show -183.3 648.5 moveto -12 f2 -(\(EP\)) show -205.9 648.5 moveto -12 f0 -( ) show -298.6 675.6 moveto -12 f2 -(UBL Card: ) show -355.9 675.6 moveto -12 f0 -(3774) show -379.9 675.6 moveto -12 f0 -( ) show -18.1 635.8 moveto -3.3 3.3 c fill -31.5 627.7 moveto -12 f1 -(Children on Stun) show -120.1 627.7 moveto -12 f0 -( ) show -31.5 614.4 moveto -12 f2 -(1994:) show -59.4 614.4 moveto -12 f0 -( Tourniquets of Love's Desire ) show -18.1 601.7 moveto -3.3 3.3 c fill -31.5 593.6 moveto -12 f1 -(Christian Death) show -113.8 593.6 moveto -12 f0 -( ) show -31.5 580.3 moveto -12 f2 -(1982:) show -59.4 580.3 moveto -12 f0 -( Only Theatre of Pain ) show -31.5 567 moveto -12 f2 -(1988:) show -59.4 567 moveto -12 f0 -( Sex and Drugs and Jesus Christ ) show -31.5 553.7 moveto -12 f2 -(1989:) show -59.4 553.7 moveto -12 f0 -( All the Love All the Hate part Two: All the) show -31.5 540.4 moveto -12 f0 -(Hate ) show -31.5 527.1 moveto -12 f2 -(1994:) show -59.4 527.1 moveto -12 f0 -( Sexy Death God ) show -298.1 594.1 moveto -12 f2 -(UBL Card: ) show -355.4 594.1 moveto -12 f0 -(1218) show -379.4 594.1 moveto -12 f0 -( ) show -298.1 581 moveto -12 f2 -(See also:) show -298.1 567.7 moveto -12 f0 -(christian-death.acc.brad.ac.uk) show -441.4 567.7 moveto -12 f0 -( ) show -18.1 514.4 moveto -3.3 3.3 c fill -31.5 506.3 moveto -12 f1 -(Chris and Cosey) show -116.1 506.3 moveto -12 f0 -( ) show -31.5 493 moveto -12 f2 -(1989:) show -59.4 493 moveto -12 f0 -( Trust ) show -18.1 480.3 moveto -3.3 3.3 c fill -31.5 472.2 moveto -12 f1 -(Ciccone Youth) show -107.1 472.2 moveto -12 f0 -( ) show -31.5 458.9 moveto -12 f2 -(1988:) show -59.4 458.9 moveto -12 f0 -( The Whitey Album ) show -298.1 472.7 moveto -12 f2 -(UBL Card: ) show -355.4 472.7 moveto -12 f0 -(1087) show -379.4 472.7 moveto -12 f0 -( ) show -18.1 446.2 moveto -3.3 3.3 c fill -31.5 438.1 moveto -12 f1 -(ClockDVA) show -87.4 438.1 moveto -12 f0 -( ) show -31.5 424.8 moveto -12 f2 -(1981:) show -59.4 424.8 moveto -12 f0 -( Thirst ) show -31.5 411.5 moveto -12 f2 -(1988:) show -59.4 411.5 moveto -12 f0 -( The Hacker/The Act ) show -302.2 438.6 moveto -12 f2 -(UBL Card: ) show -359.5 438.6 moveto -12 f0 -(3999) show -383.5 438.6 moveto -12 f0 -( ) show -18.1 398.8 moveto -3.3 3.3 c fill -31.5 390.7 moveto -12 f1 -(Cocteau Twins) show -107.8 390.7 moveto -12 f0 -( ) show -31.5 377.4 moveto -12 f2 -(1982:) show -59.4 377.4 moveto -12 f0 -( Garlands ) show -31.5 364.1 moveto -12 f2 -(1983:) show -59.4 364.1 moveto -12 f0 -( Head over Heels ) show -31.5 350.8 moveto -12 f2 -(1984:) show -59.4 350.8 moveto -12 f0 -( The Spangle Maker ) show -160 350.8 moveto -12 f2 -(\(EP\)) show -182.6 350.8 moveto -12 f0 -( ) show -31.5 337.5 moveto -12 f2 -(1984:) show -59.4 337.5 moveto -12 f0 -( Treasure ) show -31.5 324.2 moveto -12 f2 -(1985:) show -59.4 324.2 moveto -12 f0 -( Aikea-Guinea ) show -132.7 324.2 moveto -12 f2 -(\(EP\)) show -155.3 324.2 moveto -12 f0 -( ) show -31.5 310.9 moveto -12 f2 -(1985:) show -59.4 310.9 moveto -12 f0 -( Echoes in a Shallow Bay ) show -31.5 297.6 moveto -12 f2 -(1985:) show -59.4 297.6 moveto -12 f0 -( Tiny Dynamine ) show -141 297.6 moveto -12 f2 -(\(EP\)) show -163.6 297.6 moveto -12 f0 -( ) show -31.5 284.3 moveto -12 f2 -(1982-1985:) show -87.4 284.3 moveto -12 f0 -( The Pink Opaque ) show -298.1 391.2 moveto -12 f2 -(UBL Card: ) show -355.4 391.2 moveto -12 f0 -(1074) show -379.4 391.2 moveto -12 f0 -( ) show -298.1 377.9 moveto -12 f2 -(See also: ) show -344.7 377.9 moveto -12 f0 -(garnet.berkeley.edu) show -439.3 377.9 moveto -12 f0 -( ) show -298.1 364.6 moveto -12 f2 -(See also: ) show -344.7 364.6 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 364.6 moveto -12 f0 -( ) show -18.1 271.6 moveto -3.3 3.3 c fill -31.5 263.5 moveto -12 f1 -(Coil) show -52.8 263.5 moveto -12 f0 -( ) show -31.5 250.2 moveto -12 f2 -(1986?:) show -65.4 250.2 moveto -12 f0 -( The Angelic Conversation ) show -198 250.2 moveto -12 f2 -(\(soundtrack\)) show -259.3 250.2 moveto -12 f0 -( ) show -31.5 236.9 moveto -12 f2 -(1988:) show -59.4 236.9 moveto -12 f0 -( Gold is the Metal ) show -31.5 223.6 moveto -12 f2 -(1990:) show -59.4 223.6 moveto -12 f0 -( The Unreleased Themes for Hellraiser ) show -249.3 223.6 moveto -12 f2 -(\(EP\)) show -271.9 223.6 moveto -12 f0 -( ) show -31.5 210.3 moveto -12 f2 -(1990:) show -59.4 210.3 moveto -12 f0 -( Panic / Tainted Love ) show -165.7 210.3 moveto -12 f2 -(\(single\)) show -202.3 210.3 moveto -12 f0 -( ) show -31.5 197 moveto -12 f2 -(1991:) show -59.4 197 moveto -12 f0 -( Out of Light Cometh Darkness ) show -31.5 183.7 moveto -12 f2 -(1992:) show -59.4 183.7 moveto -12 f0 -( Snow ) show -92.7 183.7 moveto -12 f2 -(\(EP\)) show -115.3 183.7 moveto -12 f0 -( ) show -305.2 264 moveto -12 f2 -(UBL Card: ) show -362.5 264 moveto -12 f0 -(1388) show -386.5 264 moveto -12 f0 -( ) show -18.1 171 moveto -3.3 3.3 c fill -31.5 162.9 moveto -12 f1 -(Concrete Blonde) show -117.1 162.9 moveto -12 f0 -( ) show -31.5 149.6 moveto -12 f2 -(1986:) show -59.4 149.6 moveto -12 f0 -( Concrete Blonde ) show -31.5 136.3 moveto -12 f2 -(1989:) show -59.4 136.3 moveto -12 f0 -( Free ) show -31.5 123 moveto -12 f2 -(1990:) show -59.4 123 moveto -12 f0 -( Bloodletting ) show -31.5 109.7 moveto -12 f2 -(1993:) show -59.4 109.7 moveto -12 f0 -( Walking in London ) show -159.3 109.7 moveto -12 f2 -(\(single\)) show -195.9 109.7 moveto -12 f0 -( ) show -31.5 96.4 moveto -12 f2 -(1993:) show -59.4 96.4 moveto -12 f0 -( Mexican Moon ) show -303.5 163.4 moveto -12 f2 -(UBL Card: ) show -360.8 163.4 moveto -12 f0 -(1396) show -384.8 163.4 moveto -12 f0 -( ) show -18.1 83.7 moveto -3.3 3.3 c fill -31.5 75.6 moveto -12 f1 -(Cop Shoot Cop) show -109.5 75.6 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 7 7 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1993:) show -59.4 709.2 moveto -12 f0 -( Ask Questions Later ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Course of Empire) show -122.8 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1990:) show -59.4 675.1 moveto -12 f0 -( Course of Empire ) show -31.5 661.8 moveto -12 f2 -(1993:) show -59.4 661.8 moveto -12 f0 -( Infested! ) show -108 661.8 moveto -12 f2 -(\(EP\)) show -130.6 661.8 moveto -12 f0 -( ) show -31.5 648.5 moveto -12 f2 -(1994:) show -59.4 648.5 moveto -12 f0 -( Initiation ) show -298.1 688.9 moveto -12 f2 -(UBL Card: ) show -355.4 688.9 moveto -12 f0 -(2889) show -379.4 688.9 moveto -12 f0 -( ) show -298.1 675.6 moveto -12 f2 -(See also: ) show -344.7 675.6 moveto -12 f0 -(homepage.seas.upenn.edu) show -469.6 675.6 moveto -12 f0 -( ) show -18.1 635.8 moveto -3.3 3.3 c fill -31.5 627.7 moveto -12 f1 -(Cranes) show -68.1 627.7 moveto -12 f0 -( ) show -31.5 614.4 moveto -12 f2 -(1990:) show -59.4 614.4 moveto -12 f0 -( Inescapable ) show -122 614.4 moveto -12 f2 -(\(EP\)) show -144.6 614.4 moveto -12 f0 -( ) show -31.5 601.1 moveto -12 f2 -(1991:) show -59.4 601.1 moveto -12 f0 -( Wings of Joy ) show -31.5 587.8 moveto -12 f2 -(1992:) show -59.4 587.8 moveto -12 f0 -( Self-Non-Self ) show -31.5 574.5 moveto -12 f2 -(1993:) show -59.4 574.5 moveto -12 f0 -( Forever ) show -31.5 561.2 moveto -12 f2 -(1993:) show -59.4 561.2 moveto -12 f0 -( Jewel ) show -92.7 561.2 moveto -12 f2 -(\(EP\)) show -115.3 561.2 moveto -12 f0 -( ) show -31.5 547.9 moveto -12 f2 -(1994:) show -59.4 547.9 moveto -12 f0 -( Loved ) show -31.5 534.6 moveto -12 f2 -(1994:) show -59.4 534.6 moveto -12 f0 -( Shining Road ) show -131 534.6 moveto -12 f2 -(\(limited edition double EP\)) show -261.9 534.6 moveto -12 f0 -( ) show -298.1 628.2 moveto -12 f2 -(UBL Card: ) show -355.4 628.2 moveto -12 f0 -(2400) show -379.4 628.2 moveto -12 f0 -( ) show -298.1 614.9 moveto -12 f2 -(See also: ) show -344.7 614.9 moveto -12 f0 -(busop.cit.wayne.edu) show -443 614.9 moveto -12 f0 -( ) show -18.1 521.9 moveto -3.3 3.3 c fill -31.5 513.8 moveto -12 f1 -(Crash Worship) show -110.5 513.8 moveto -12 f0 -( ) show -31.5 500.5 moveto -12 f2 -(1992:) show -59.4 500.5 moveto -12 f0 -( ADRV ) show -298.1 514.3 moveto -12 f2 -(UBL Card: ) show -355.4 514.3 moveto -12 f0 -(1901) show -379.4 514.3 moveto -12 f0 -( ) show -298.1 501 moveto -12 f2 -(See also: ) show -344.7 501 moveto -12 f0 -(www.meer.net) show -415.3 501 moveto -12 f0 -( ) show -298.1 487.7 moveto -12 f2 -(See also: ) show -344.7 487.7 moveto -12 f0 -(www.tyrell.net) show -416.7 487.7 moveto -12 f0 -( ) show -18.1 475 moveto -3.3 3.3 c fill -31.5 466.9 moveto -12 f1 -(Creatures, The) show -108.8 466.9 moveto -12 f0 -( ) show -31.5 453.6 moveto -12 f2 -(1983:) show -59.4 453.6 moveto -12 f0 -( Feast ) show -31.5 440.3 moveto -12 f2 -(1990:) show -59.4 440.3 moveto -12 f0 -( Boomerang ) show -31.5 427 moveto -12 f2 -(1990:) show -59.4 427 moveto -12 f0 -( Fury Eyes ) show -114.3 427 moveto -12 f2 -(\(EP\)) show -136.9 427 moveto -12 f0 -( ) show -31.5 413.7 moveto -12 f2 -(1990:) show -59.4 413.7 moveto -12 f0 -( Standing There ) show -139 413.7 moveto -12 f2 -(\(single\)) show -175.6 413.7 moveto -12 f0 -( ) show -301.8 467.4 moveto -12 f2 -(UBL Card: ) show -359.1 467.4 moveto -12 f0 -(1216) show -383.1 467.4 moveto -12 f0 -( ) show -18.1 401 moveto -3.3 3.3 c fill -31.5 392.9 moveto -12 f1 -(Cure, The) show -83.4 392.9 moveto -12 f0 -( ) show -31.5 379.6 moveto -12 f2 -(1980:) show -59.4 379.6 moveto -12 f0 -( Boys Don't Cry ) show -31.5 366.3 moveto -12 f2 -(1980:) show -59.4 366.3 moveto -12 f0 -( Seventeen Seconds ) show -31.5 353 moveto -12 f2 -(1981:) show -59.4 353 moveto -12 f0 -( Faith ) show -31.5 339.7 moveto -12 f2 -(1982:) show -59.4 339.7 moveto -12 f0 -( Pornography ) show -31.5 326.4 moveto -12 f2 -(1982:) show -59.4 326.4 moveto -12 f0 -( The Walk ) show -31.5 313.1 moveto -12 f2 -(1982?:) show -65.4 313.1 moveto -12 f0 -( Looking for a Forest ) show -170.3 313.1 moveto -12 f2 -(\(live boot\)) show -219.9 313.1 moveto -12 f0 -( ) show -31.5 299.8 moveto -12 f2 -(1983:) show -59.4 299.8 moveto -12 f0 -( Japanese Whispers ) show -31.5 286.5 moveto -12 f2 -(1983:) show -59.4 286.5 moveto -12 f0 -( Lovecats ) show -108.7 286.5 moveto -12 f2 -(\(EP\)) show -131.3 286.5 moveto -12 f0 -( ) show -31.5 273.2 moveto -12 f2 -(1984:) show -59.4 273.2 moveto -12 f0 -( Concert ) show -103.3 273.2 moveto -12 f2 -(\(live\)) show -128.6 273.2 moveto -12 f0 -( ) show -31.5 259.9 moveto -12 f2 -(1984:) show -59.4 259.9 moveto -12 f0 -( The Top ) show -31.5 246.6 moveto -12 f2 -(1985:) show -59.4 246.6 moveto -12 f0 -( The Head on the Door ) show -31.5 233.3 moveto -12 f2 -(1987:) show -59.4 233.3 moveto -12 f0 -( Staring at the Sea ) show -149.7 233.3 moveto -12 f2 -(\(comp\)) show -183.6 233.3 moveto -12 f0 -( ) show -31.5 220 moveto -12 f2 -(1988:) show -59.4 220 moveto -12 f0 -( Kiss Me Kiss Me Kiss Me ) show -31.5 206.7 moveto -12 f2 -(1989:) show -59.4 206.7 moveto -12 f0 -( Disintegration ) show -31.5 193.4 moveto -12 f2 -(1989:) show -59.4 193.4 moveto -12 f0 -( Fascination Street ) show -151.7 193.4 moveto -12 f2 -(\(single\)) show -188.3 193.4 moveto -12 f0 -( ) show -31.5 180.1 moveto -12 f2 -(1990:) show -59.4 180.1 moveto -12 f0 -( Never Enough ) show -135 180.1 moveto -12 f2 -(\(single\)) show -171.6 180.1 moveto -12 f0 -( ) show -31.5 166.8 moveto -12 f2 -(1995?:) show -65.4 166.8 moveto -12 f0 -( Give Me the Cure: 18 DC Bands ) show -228.7 166.8 moveto -12 f2 -(\(various\)) show -272.6 166.8 moveto -12 f0 -( ) show -298.1 393.4 moveto -12 f2 -(UBL Card: ) show -355.4 393.4 moveto -12 f0 -(1159) show -379.4 393.4 moveto -12 f0 -( ) show -298.1 380.1 moveto -12 f2 -(See also: ) show -344.7 380.1 moveto -12 f0 -(www.acpub.duke.edu) show -449 380.1 moveto -12 f0 -( ) show -298.1 366.8 moveto -12 f2 -(See also: ) show -344.7 366.8 moveto -12 f0 -(pathfinder.com) show -417.6 366.8 moveto -12 f0 -( ) show -18.1 154.1 moveto -3.3 3.3 c fill -31.5 146 moveto -12 f1 -(Current 93) show -88.4 146 moveto -12 f0 -( ) show -31.5 132.7 moveto -12 f2 -(1986-1991:) show -87.4 132.7 moveto -12 f0 -( Island ) show -300.6 146.5 moveto -12 f2 -(UBL Card: ) show -357.9 146.5 moveto -12 f0 -(3465) show -381.9 146.5 moveto -12 f0 -( ) show -18.1 120 moveto -3.3 3.3 c fill -31.5 111.9 moveto -12 f1 -(Curve) show -63.4 111.9 moveto -12 f0 -( ) show -31.5 98.6 moveto -12 f2 -(1991:) show -59.4 98.6 moveto -12 f0 -( Frozen ) show -98.7 98.6 moveto -12 f2 -(\(EP\)) show -121.3 98.6 moveto -12 f0 -( ) show -31.5 85.3 moveto -12 f2 -(1991:) show -59.4 85.3 moveto -12 f0 -( Cherry ) show -98.7 85.3 moveto -12 f2 -(\(EP\)) show -121.3 85.3 moveto -12 f0 -( ) show -298.1 112.4 moveto -12 f2 -(UBL Card: ) show -355.4 112.4 moveto -12 f0 -(1355) show -379.4 112.4 moveto -12 f0 -( ) show -298.1 99.1 moveto -12 f2 -(See also: ) show -344.7 99.1 moveto -12 f0 -(quark.stack.urc.tue.nl) show -448 99.1 moveto -12 f0 -( ) show -298.1 85.8 moveto -12 f2 -(See also: ) show -344.7 85.8 moveto -12 f0 -(blade.stack.urc.tue.nl) show -446.6 85.8 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 8 8 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1992:) show -59.4 709.2 moveto -12 f0 -( Doppelganger ) show -31.5 695.9 moveto -12 f2 -(1993:) show -59.4 695.9 moveto -12 f0 -( Cuckoo ) show -18.1 683.2 moveto -3.3 3.3 c fill -31.5 675.1 moveto -12 f1 -(Cyber-Tec) show -86.1 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1995:) show -59.4 661.8 moveto -12 f0 -( Cyber-Tec ) show -18.1 649.1 moveto -3.3 3.3 c fill -31.5 641 moveto -12 f1 -(Daisy Chainsaw) show -113.8 641 moveto -12 f0 -( ) show -31.5 627.7 moveto -12 f2 -(1992:) show -59.4 627.7 moveto -12 f0 -( Hope All Your Dreams Come True ) show -235 627.7 moveto -12 f2 -(\(single\)) show -271.6 627.7 moveto -12 f0 -( ) show -31.5 614.4 moveto -12 f2 -(1992:) show -59.4 614.4 moveto -12 f0 -( Love Sick Pleasure ) show -158 614.4 moveto -12 f2 -(\(EP\)) show -180.6 614.4 moveto -12 f0 -( ) show -31.5 601.1 moveto -12 f2 -(1992:) show -59.4 601.1 moveto -12 f0 -( Eleventeen ) show -31.5 587.8 moveto -12 f2 -(1994:) show -59.4 587.8 moveto -12 f0 -( For They Know Not What They Do ) show -18.1 575.1 moveto -3.3 3.3 c fill -31.5 567 moveto -12 f1 -(Dance or Die) show -98.1 567 moveto -12 f0 -( ) show -31.5 553.7 moveto -12 f2 -(1993:) show -59.4 553.7 moveto -12 f0 -( Psychoburbia ) show -18.1 541 moveto -3.3 3.3 c fill -31.5 532.9 moveto -12 f1 -(Danse Society, The) show -128.4 532.9 moveto -12 f0 -( ) show -31.5 519.6 moveto -12 f2 -(1984:) show -59.4 519.6 moveto -12 f0 -( Heaven is Waiting ) show -31.5 506.3 moveto -12 f2 -(1986:) show -59.4 506.3 moveto -12 f0 -( Looking Through ) show -18.1 493.6 moveto -3.3 3.3 c fill -31.5 485.5 moveto -12 f1 -(Das Ich) show -70.5 485.5 moveto -12 f0 -( ) show -31.5 472.2 moveto -12 f2 -(1990:) show -59.4 472.2 moveto -12 f0 -( Satanische Verse ) show -299.9 486 moveto -12 f2 -(UBL Card: ) show -357.2 486 moveto -12 f0 -(2337) show -381.2 486 moveto -12 f0 -( ) show -18.1 459.5 moveto -3.3 3.3 c fill -31.5 451.4 moveto -12 f1 -(Dax, Danielle) show -100.1 451.4 moveto -12 f0 -( ) show -31.5 438.1 moveto -12 f2 -(1986-1988:) show -87.4 438.1 moveto -12 f0 -( Dark Adapted Eye ) show -182.7 438.1 moveto -12 f2 -(\(comp +5\)) show -233.7 438.1 moveto -12 f0 -( ) show -31.5 424.8 moveto -12 f2 -(1988:) show -59.4 424.8 moveto -12 f0 -( Whistling for his Love ) show -174.3 424.8 moveto -12 f2 -(\(single\)) show -210.9 424.8 moveto -12 f0 -( ) show -31.5 411.5 moveto -12 f2 -(1988:) show -59.4 411.5 moveto -12 f0 -( Cat House ) show -115.7 411.5 moveto -12 f2 -(\(single\)) show -152.3 411.5 moveto -12 f0 -( ) show -31.5 398.2 moveto -12 f2 -(1990:) show -59.4 398.2 moveto -12 f0 -( Blast the Human Flower ) show -31.5 384.9 moveto -12 f2 -(1992:) show -59.4 384.9 moveto -12 f0 -( Pop-Eyes ) show -31.5 371.6 moveto -12 f2 -(1995:) show -59.4 371.6 moveto -12 f0 -( Timber Tongue ) show -140.3 371.6 moveto -12 f2 -(\(EP\)) show -162.9 371.6 moveto -12 f0 -( ) show -300.6 451.9 moveto -12 f2 -(UBL Card: ) show -357.9 451.9 moveto -12 f0 -(1746) show -381.9 451.9 moveto -12 f0 -( ) show -18.1 358.9 moveto -3.3 3.3 c fill -31.5 350.8 moveto -12 f1 -(Death in June) show -102.8 350.8 moveto -12 f0 -( ) show -31.5 337.5 moveto -12 f2 -(1992:) show -59.4 337.5 moveto -12 f0 -( But, What Ends When the Symbols Shatter? ) show -18.1 324.8 moveto -3.3 3.3 c fill -31.5 316.7 moveto -12 f1 -(Definition FX) show -101.8 316.7 moveto -12 f0 -( ) show -31.5 303.4 moveto -12 f2 -(1993:) show -59.4 303.4 moveto -12 f0 -( Something Inside ) show -149.7 303.4 moveto -12 f2 -(\(single\)) show -186.3 303.4 moveto -12 f0 -( ) show -31.5 290.1 moveto -12 f2 -(1993:) show -59.4 290.1 moveto -12 f0 -( Light Speed Collision ) show -298.1 317.2 moveto -12 f2 -(See also: ) show -344.7 317.2 moveto -12 f0 -(www.geko.com.au) show -435 317.2 moveto -12 f0 -( ) show -18.1 277.4 moveto -3.3 3.3 c fill -31.5 269.3 moveto -12 f1 -(Depeche Mode) show -107.1 269.3 moveto -12 f0 -( ) show -31.5 256 moveto -12 f2 -(1981:) show -59.4 256 moveto -12 f0 -( Speak & Spell ) show -31.5 242.7 moveto -12 f2 -(1981:) show -59.4 242.7 moveto -12 f0 -( Just Can't Get Enough / Any Second Now) show -31.5 229.4 moveto -12 f2 -(\(single\)) show -68.1 229.4 moveto -12 f0 -( ) show -31.5 216.1 moveto -12 f2 -(1982:) show -59.4 216.1 moveto -12 f0 -( A Broken Frame ) show -31.5 202.8 moveto -12 f2 -(1982:) show -59.4 202.8 moveto -12 f0 -( live singles ) show -119.7 202.8 moveto -12 f2 -(\(comp\)) show -153.6 202.8 moveto -12 f0 -( ) show -31.5 189.5 moveto -12 f2 -(1983:) show -59.4 189.5 moveto -12 f0 -( Construction Time Again ) show -31.5 176.2 moveto -12 f2 -(1984:) show -59.4 176.2 moveto -12 f0 -( People Are People ) show -154.7 176.2 moveto -12 f2 -(\(comp +2\)) show -205.7 176.2 moveto -12 f0 -( ) show -31.5 162.9 moveto -12 f2 -(1984:) show -59.4 162.9 moveto -12 f0 -( Some Great Reward ) show -31.5 149.6 moveto -12 f2 -(1985:) show -59.4 149.6 moveto -12 f0 -( Catching Up With Depeche Mode ) show -229.3 149.6 moveto -12 f2 -(\(comp +4\)) show -280.3 149.6 moveto -12 f0 -( ) show -31.5 136.3 moveto -12 f2 -(1985:) show -59.4 136.3 moveto -12 f0 -( It's Called a Heart / Fly on the Windscreen) show -31.5 123 moveto -12 f2 -(\(single\)) show -68.1 123 moveto -12 f0 -( ) show -31.5 109.7 moveto -12 f2 -(1986:) show -59.4 109.7 moveto -12 f0 -( Black Celebration ) show -31.5 96.4 moveto -12 f2 -(1986:) show -59.4 96.4 moveto -12 f0 -( Stripped ) show -106 96.4 moveto -12 f2 -(\(single\)) show -142.6 96.4 moveto -12 f0 -( ) show -31.5 83.1 moveto -12 f2 -(1986:) show -59.4 83.1 moveto -12 f0 -( A Question of Lust ) show -157.7 83.1 moveto -12 f2 -(\(single\)) show -194.3 83.1 moveto -12 f0 -( ) show -298.1 269.8 moveto -12 f2 -(UBL Card: ) show -355.4 269.8 moveto -12 f0 -(1041) show -379.4 269.8 moveto -12 f0 -( ) show -298.1 256.5 moveto -12 f2 -(See also: ) show -344.7 256.5 moveto -12 f0 -(www.cis.ufl.edu) show -423.6 256.5 moveto -12 f0 -( ) show -298.1 243.2 moveto -12 f2 -(See also: ) show -344.7 243.2 moveto -12 f0 -(www.coma.sbg.ac.at) show -444.6 243.2 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 9 9 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1989:) show -59.4 709.2 moveto -12 f0 -( 101 ) show -83.4 709.2 moveto -12 f2 -(\(double live\)) show -144.3 709.2 moveto -12 f0 -( ) show -31.5 695.9 moveto -12 f2 -(1987:) show -59.4 695.9 moveto -12 f0 -( Music for the Masses ) show -31.5 682.6 moveto -12 f2 -(1987:) show -59.4 682.6 moveto -12 f0 -( Never Let Me Down ) show -165 682.6 moveto -12 f2 -(\(single\)) show -201.6 682.6 moveto -12 f0 -( ) show -31.5 669.3 moveto -12 f2 -(1990:) show -59.4 669.3 moveto -12 f0 -( Personal Jesus ) show -135 669.3 moveto -12 f2 -(\(single\)) show -171.6 669.3 moveto -12 f0 -( ) show -31.5 656 moveto -12 f2 -(199?:) show -59.4 656 moveto -12 f0 -( I Sometimes Wish I Was Famous: A Swedish) show -31.5 642.7 moveto -12 f0 -(Tribute ) show -69.8 642.7 moveto -12 f2 -(\(various\)) show -113.7 642.7 moveto -12 f0 -( ) show -18.1 630 moveto -3.3 3.3 c fill -31.5 621.9 moveto -12 f1 -(Dessau) show -67.5 621.9 moveto -12 f0 -( ) show -31.5 608.6 moveto -12 f2 -(1995:) show -59.4 608.6 moveto -12 f0 -( Dessau ) show -31.5 595.3 moveto -12 f2 -(1995:) show -59.4 595.3 moveto -12 f0 -( Details Sketchy ) show -18.1 582.6 moveto -3.3 3.3 c fill -31.5 574.5 moveto -12 f1 -(Devo) show -57.4 574.5 moveto -12 f0 -( ) show -31.5 561.2 moveto -12 f2 -(1978:) show -59.4 561.2 moveto -12 f0 -( Q: Are We Not Men? A: We Are DEVO! ) show -31.5 547.9 moveto -12 f2 -(1979:) show -59.4 547.9 moveto -12 f0 -( Freedom of Choice ) show -31.5 534.6 moveto -12 f2 -(1977-1990:) show -87.4 534.6 moveto -12 f0 -( Greatest Hits ) show -31.5 521.3 moveto -12 f2 -(1978-1990:) show -87.4 521.3 moveto -12 f0 -( Greatest Misses ) show -298.1 575 moveto -12 f2 -(UBL Card: ) show -355.4 575 moveto -12 f0 -(1088) show -379.4 575 moveto -12 f0 -( ) show -298.1 561.7 moveto -12 f2 -(See also: ) show -344.7 561.7 moveto -12 f0 -(hartke.lib.ohio-state.edu) show -461 561.7 moveto -12 f0 -( ) show -298.1 548.4 moveto -12 f2 -(See also: ) show -344.7 548.4 moveto -12 f0 -(unsane.enc.org) show -416.6 548.4 moveto -12 f0 -( ) show -298.1 535.1 moveto -12 f2 -(See also: ) show -344.7 535.1 moveto -12 f0 -(rt66.com) show -387.6 535.1 moveto -12 f0 -( ) show -18.1 508.6 moveto -3.3 3.3 c fill -31.5 500.5 moveto -12 f1 -(Die Krupps) show -91.1 500.5 moveto -12 f0 -( ) show -31.5 487.2 moveto -12 f2 -(1995:) show -59.4 487.2 moveto -12 f0 -( Rings of Steel ) show -18.1 474.5 moveto -3.3 3.3 c fill -31.5 466.4 moveto -12 f1 -(Die Monster Die) show -115.4 466.4 moveto -12 f0 -( ) show -31.5 453.1 moveto -12 f2 -(1994:) show -59.4 453.1 moveto -12 f0 -( Withdrawl Method ) show -18.1 440.4 moveto -3.3 3.3 c fill -31.5 432.3 moveto -12 f1 -(Die Warzau) show -93.1 432.3 moveto -12 f0 -( ) show -31.5 419 moveto -12 f2 -(1991:) show -59.4 419 moveto -12 f0 -( Big Electric Metal Bass Face ) show -31.5 405.7 moveto -12 f2 -(1994:) show -59.4 405.7 moveto -12 f0 -( Engine ) show -31.5 392.4 moveto -12 f2 -(1994:) show -59.4 392.4 moveto -12 f0 -( allgoodgirls ) show -122.7 392.4 moveto -12 f2 -(\(EP\)) show -145.3 392.4 moveto -12 f0 -( ) show -18.1 379.7 moveto -3.3 3.3 c fill -31.5 371.6 moveto -12 f1 -(Disposable Heroes of Hiphoprisy) show -199.8 371.6 moveto -12 f0 -( ) show -31.5 358.3 moveto -12 f2 -(1992:) show -59.4 358.3 moveto -12 f0 -( Hypocrisy is the Greatest Luxury ) show -18.1 345.6 moveto -3.3 3.3 c fill -31.5 337.5 moveto -12 f1 -(Dolby, Thomas) show -109.5 337.5 moveto -12 f0 -( ) show -31.5 324.2 moveto -12 f2 -(1983:) show -59.4 324.2 moveto -12 f0 -( The Golden Age of Wireless ) show -31.5 310.9 moveto -12 f2 -(1983:) show -59.4 310.9 moveto -12 f0 -( The Golden Age of Wireless ) show -203.3 310.9 moveto -12 f2 -(\(2nd release: 2) show -31.5 297.6 moveto -12 f2 -(new\)) show -54.8 297.6 moveto -12 f0 -( ) show -31.5 284.3 moveto -12 f2 -(1984:) show -59.4 284.3 moveto -12 f0 -( The Flat Earth ) show -298.1 338 moveto -12 f2 -(UBL Card: ) show -355.4 338 moveto -12 f0 -(1961) show -379.4 338 moveto -12 f0 -( ) show -298.1 324.7 moveto -12 f2 -(See also: ) show -344.7 324.7 moveto -12 f0 -(kspace.com) show -401 324.7 moveto -12 f0 -( ) show -298.1 311.4 moveto -12 f2 -(See also: ) show -344.7 311.4 moveto -12 f0 -(rt66.com) show -387.6 311.4 moveto -12 f0 -( ) show -18.1 271.6 moveto -3.3 3.3 c fill -31.5 263.5 moveto -12 f1 -(Doubting Thomas) show -123.8 263.5 moveto -12 f0 -( ) show -31.5 250.2 moveto -12 f2 -(1991:) show -59.4 250.2 moveto -12 f0 -( Father Don't Cry ) show -148 250.2 moveto -12 f2 -(\(EP\)) show -170.6 250.2 moveto -12 f0 -( ) show -31.5 236.9 moveto -12 f2 -(1991:) show -59.4 236.9 moveto -12 f0 -( The Infidel ) show -298.1 264 moveto -12 f2 -(UBL Card: ) show -355.4 264 moveto -12 f0 -(1166) show -379.4 264 moveto -12 f0 -( ) show -298.1 250.7 moveto -12 f2 -(See also: ) show -344.7 250.7 moveto -12 f0 -(www.eecs.nwu.edu) show -438.3 250.7 moveto -12 f0 -( ) show -18.1 224.2 moveto -3.3 3.3 c fill -31.5 216.1 moveto -12 f1 -(Duran Duran) show -101.1 216.1 moveto -12 f0 -( ) show -31.5 202.8 moveto -12 f2 -(1981:) show -59.4 202.8 moveto -12 f0 -( Duran Duran ) show -31.5 189.5 moveto -12 f2 -(1982:) show -59.4 189.5 moveto -12 f0 -( Carnival ) show -106.7 189.5 moveto -12 f2 -(\(EP\)) show -129.3 189.5 moveto -12 f0 -( ) show -31.5 176.2 moveto -12 f2 -(1982:) show -59.4 176.2 moveto -12 f0 -( live ) show -83.4 176.2 moveto -12 f2 -(\(live boot\)) show -133 176.2 moveto -12 f0 -( ) show -31.5 162.9 moveto -12 f2 -(1982:) show -59.4 162.9 moveto -12 f0 -( Rio ) show -31.5 149.6 moveto -12 f2 -(1983:) show -59.4 149.6 moveto -12 f0 -( Union of the Snake / Secret Oktober ) show -240 149.6 moveto -12 f2 -(\(single\)) show -276.6 149.6 moveto -12 f0 -( ) show -31.5 136.3 moveto -12 f2 -(1983:) show -59.4 136.3 moveto -12 f0 -( The Wild Boys / Cracks in the Pavement) show -31.5 123 moveto -12 f2 -(\(single\)) show -68.1 123 moveto -12 f0 -( ) show -31.5 109.7 moveto -12 f2 -(1983:) show -59.4 109.7 moveto -12 f0 -( Seven and the Ragged Tiger ) show -31.5 96.4 moveto -12 f2 -(1987:) show -59.4 96.4 moveto -12 f0 -( Notorious ) show -31.5 83.1 moveto -12 f2 -(1981-1988:) show -87.4 83.1 moveto -12 f0 -( Decade ) show -129.3 83.1 moveto -12 f2 -(\(comp\)) show -163.2 83.1 moveto -12 f0 -( ) show -300.6 216.6 moveto -12 f2 -(UBL Card: ) show -357.9 216.6 moveto -12 f0 -(1259) show -381.9 216.6 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 10 10 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 716.6 moveto -3.3 3.3 c fill -31.5 708.5 moveto -12 f1 -(Durutti Column) show -114.5 708.5 moveto -12 f0 -( ) show -31.5 695.2 moveto -12 f2 -(1988:) show -59.4 695.2 moveto -12 f0 -( The Guitar and Other Machines ) show -298.1 709 moveto -12 f2 -(UBL Card: ) show -355.4 709 moveto -12 f0 -(4853) show -379.4 709 moveto -12 f0 -( ) show -18.1 682.5 moveto -3.3 3.3 c fill -31.5 674.4 moveto -12 f1 -(Ebn Ozn) show -77.1 674.4 moveto -12 f0 -( ) show -31.5 661.1 moveto -12 f2 -(1984:) show -59.4 661.1 moveto -12 f0 -( Feeling Cavalier ) show -18.1 648.4 moveto -3.3 3.3 c fill -31.5 640.3 moveto -12 f1 -(Elastica) show -72.1 640.3 moveto -12 f0 -( ) show -31.5 627 moveto -12 f2 -(1995:) show -59.4 627 moveto -12 f0 -( Elastica ) show -18.1 614.3 moveto -3.3 3.3 c fill -31.5 606.2 moveto -12 f1 -(Elastic Purejoy, The) show -135.8 606.2 moveto -12 f0 -( ) show -31.5 592.9 moveto -12 f2 -(1994:) show -59.4 592.9 moveto -12 f0 -( The Elastic Purejoy ) show -298.1 606.7 moveto -12 f2 -(See also: ) show -344.7 606.7 moveto -12 f0 -(http2.brunel.ac.uk) show -431.7 606.7 moveto -12 f0 -( ) show -18.1 580.2 moveto -3.3 3.3 c fill -31.5 572.1 moveto -12 f1 -(Electric Hellfire Club, The) show -168.1 572.1 moveto -12 f0 -( ) show -31.5 558.8 moveto -12 f2 -(1993:) show -59.4 558.8 moveto -12 f0 -( Burn, Baby, Burn ) show -31.5 545.5 moveto -12 f2 -(1995:) show -59.4 545.5 moveto -12 f0 -( Kiss the Goat ) show -18.1 532.8 moveto -3.3 3.3 c fill -31.5 524.7 moveto -12 f1 -(Elfman, Danny) show -109.5 524.7 moveto -12 f0 -( ) show -31.5 511.4 moveto -12 f2 -(1984:) show -59.4 511.4 moveto -12 f0 -( So-Lo ) show -298.1 525.2 moveto -12 f2 -(UBL Card: ) show -355.4 525.2 moveto -12 f0 -(1089) show -379.4 525.2 moveto -12 f0 -( ) show -18.1 498.7 moveto -3.3 3.3 c fill -31.5 490.6 moveto -12 f1 -(Emergency Broadcast Network) show -192.1 490.6 moveto -12 f0 -( ) show -31.5 477.3 moveto -12 f2 -(1995:) show -59.4 477.3 moveto -12 f0 -( Telecommunication Breakdown ) show -18.1 464.6 moveto -3.3 3.3 c fill -31.5 456.5 moveto -12 f1 -(Engorged with Blood) show -140.1 456.5 moveto -12 f0 -( ) show -31.5 443.2 moveto -12 f2 -(1993:) show -59.4 443.2 moveto -12 f0 -( Engorged with Blood ) show -168.7 443.2 moveto -12 f2 -(\(EP\)) show -191.3 443.2 moveto -12 f0 -( ) show -18.1 430.5 moveto -3.3 3.3 c fill -31.5 422.4 moveto -12 f1 -(Eno, Brian) show -87.5 422.4 moveto -12 f0 -( ) show -31.5 409.1 moveto -12 f2 -(1977:) show -59.4 409.1 moveto -12 f0 -( Before and After Science ) show -298.1 422.9 moveto -12 f2 -(UBL Card: ) show -355.4 422.9 moveto -12 f0 -(1064) show -379.4 422.9 moveto -12 f0 -( ) show -298.1 409.6 moveto -12 f2 -(See also: ) show -344.7 409.6 moveto -12 f0 -(www.nwu.edu) show -414.6 409.6 moveto -12 f0 -( ) show -18.1 396.4 moveto -3.3 3.3 c fill -31.5 388.3 moveto -12 f1 -(Eon) show -52.1 388.3 moveto -12 f0 -( ) show -31.5 375 moveto -12 f2 -(1991:) show -59.4 375 moveto -12 f0 -( Fear: the Mindkiller ) show -162 375 moveto -12 f2 -(\(EP\)) show -184.6 375 moveto -12 f0 -( ) show -31.5 361.7 moveto -12 f2 -(1992:) show -59.4 361.7 moveto -12 f0 -( Basket Case ) show -124.3 361.7 moveto -12 f2 -(\(EP\)) show -146.9 361.7 moveto -12 f0 -( ) show -18.1 349 moveto -3.3 3.3 c fill -31.5 340.9 moveto -12 f1 -(Erasure) show -72.8 340.9 moveto -12 f0 -( ) show -31.5 327.6 moveto -12 f2 -(1984-1986:) show -87.4 327.6 moveto -12 f0 -( various singles ) show -31.5 314.3 moveto -12 f2 -(1986:) show -59.4 314.3 moveto -12 f0 -( Wonderland ) show -298.1 341.4 moveto -12 f2 -(UBL Card: ) show -355.4 341.4 moveto -12 f0 -(1029) show -379.4 341.4 moveto -12 f0 -( ) show -298.1 328.1 moveto -12 f2 -(See also: ) show -344.7 328.1 moveto -12 f0 -(www.cec.wustl.edu) show -439 328.1 moveto -12 f0 -( ) show -298.1 314.8 moveto -12 f2 -(See also: ) show -344.7 314.8 moveto -12 f0 -(rt66.com) show -387.6 314.8 moveto -12 f0 -( ) show -18.1 301.6 moveto -3.3 3.3 c fill -31.5 293.5 moveto -12 f1 -(Estep, Maggie) show -104.1 293.5 moveto -12 f0 -( ) show -31.5 280.2 moveto -12 f2 -(1994:) show -59.4 280.2 moveto -12 f0 -( No More Mister Nice Girl ) show -18.1 267.5 moveto -3.3 3.3 c fill -31.5 259.4 moveto -12 f1 -(Ethyl Meatplow) show -113.8 259.4 moveto -12 f0 -( ) show -31.5 246.1 moveto -12 f2 -(1993:) show -59.4 246.1 moveto -12 f0 -( Happy Days Sweetheart ) show -31.5 232.8 moveto -12 f2 -(1993:) show -59.4 232.8 moveto -12 f0 -( Devil's Johnson ) show -143 232.8 moveto -12 f2 -(\(single\)) show -179.6 232.8 moveto -12 f0 -( ) show -300.8 259.9 moveto -12 f2 -(UBL Card: ) show -358.1 259.9 moveto -12 f0 -(5232) show -382.1 259.9 moveto -12 f0 -( ) show -18.1 220.1 moveto -3.3 3.3 c fill -31.5 212 moveto -12 f1 -(Eurythmics) show -91.5 212 moveto -12 f0 -( ) show -31.5 198.7 moveto -12 f2 -(1981:) show -59.4 198.7 moveto -12 f0 -( In the Garden ) show -31.5 185.4 moveto -12 f2 -(1982:) show -59.4 185.4 moveto -12 f0 -( Love is a Stranger ) show -153 185.4 moveto -12 f2 -(\(EP\)) show -175.6 185.4 moveto -12 f0 -( ) show -31.5 172.1 moveto -12 f2 -(1982:) show -59.4 172.1 moveto -12 f0 -( This is the House ) show -149 172.1 moveto -12 f2 -(\(live EP\)) show -191.9 172.1 moveto -12 f0 -( ) show -31.5 158.8 moveto -12 f2 -(1983:) show -59.4 158.8 moveto -12 f0 -( Sweet Dreams ) show -31.5 145.5 moveto -12 f2 -(1983:) show -59.4 145.5 moveto -12 f0 -( Touch ) show -31.5 132.2 moveto -12 f2 -(1984:) show -59.4 132.2 moveto -12 f0 -( 1984 \(For the Love of Big Brother\) ) show -235.3 132.2 moveto -12 f2 -(\(soundtrack\)) show -296.6 132.2 moveto -12 f0 -( ) show -18.1 119.5 moveto -3.3 3.3 c fill -31.5 111.4 moveto -12 f1 -(Executive Slacks) show -117.1 111.4 moveto -12 f0 -( ) show -31.5 98.1 moveto -12 f2 -(1986:) show -59.4 98.1 moveto -12 f0 -( Fire and Ice ) show -18.1 85.4 moveto -3.3 3.3 c fill -31.5 77.3 moveto -12 f1 -(Faith and the Muse) show -131.1 77.3 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 11 11 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1994:) show -59.4 709.2 moveto -12 f0 -( Elyria ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Fixx, The) show -80.1 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1982:) show -59.4 675.1 moveto -12 f0 -( Shuttered Room ) show -31.5 661.8 moveto -12 f2 -(1983:) show -59.4 661.8 moveto -12 f0 -( Reach the Beach ) show -31.5 648.5 moveto -12 f2 -(1984:) show -59.4 648.5 moveto -12 f0 -( Phantoms ) show -31.5 635.2 moveto -12 f2 -(1986:) show -59.4 635.2 moveto -12 f0 -( Walkabout ) show -31.5 621.9 moveto -12 f2 -(1987:) show -59.4 621.9 moveto -12 f0 -( React ) show -92.7 621.9 moveto -12 f2 -(\(live\)) show -118 621.9 moveto -12 f0 -( ) show -300.5 688.9 moveto -12 f2 -(UBL Card: ) show -357.8 688.9 moveto -12 f0 -(4603) show -381.8 688.9 moveto -12 f0 -( ) show -18.1 609.2 moveto -3.3 3.3 c fill -31.5 601.1 moveto -12 f1 -(Foetus) show -65.4 601.1 moveto -12 f0 -( ) show -31.5 587.8 moveto -12 f2 -(19??:) show -59.4 587.8 moveto -12 f0 -( Rife ) show -31.5 574.5 moveto -12 f2 -(1995:) show -59.4 574.5 moveto -12 f0 -( Gash ) show -298.1 601.6 moveto -12 f2 -(UBL Card: ) show -355.4 601.6 moveto -12 f0 -(2750) show -379.4 601.6 moveto -12 f0 -( ) show -18.1 561.8 moveto -3.3 3.3 c fill -31.5 553.7 moveto -12 f1 -(Fortran 5) show -81.1 553.7 moveto -12 f0 -( ) show -31.5 540.4 moveto -12 f2 -(1991:) show -59.4 540.4 moveto -12 f0 -( Blues ) show -31.5 527.1 moveto -12 f2 -(1993:) show -59.4 527.1 moveto -12 f0 -( Bad Head Park ) show -298.1 554.2 moveto -12 f2 -(UBL Card: ) show -355.4 554.2 moveto -12 f0 -(3469) show -379.4 554.2 moveto -12 f0 -( ) show -298.1 540.9 moveto -12 f2 -(See also: ) show -344.7 540.9 moveto -12 f0 -(rt66.com) show -387.6 540.9 moveto -12 f0 -( ) show -18.1 514.4 moveto -3.3 3.3 c fill -31.5 506.3 moveto -12 f1 -(45 Grave) show -78.4 506.3 moveto -12 f0 -( ) show -31.5 493 moveto -12 f2 -(1993:) show -59.4 493 moveto -12 f0 -( Debasement Tapes ) show -18.1 480.3 moveto -3.3 3.3 c fill -31.5 472.2 moveto -12 f1 -(Frankie goes to Hollywood) show -168.5 472.2 moveto -12 f0 -( ) show -31.5 458.9 moveto -12 f2 -(1984:) show -59.4 458.9 moveto -12 f0 -( Welcome to the Pleasure Dome ) show -298.1 472.7 moveto -12 f2 -(UBL Card: ) show -355.4 472.7 moveto -12 f0 -(3222) show -379.4 472.7 moveto -12 f0 -( ) show -298.1 459.4 moveto -12 f2 -(See also: ) show -344.7 459.4 moveto -12 f0 -(rt66.com) show -387.6 459.4 moveto -12 f0 -( ) show -18.1 446.2 moveto -3.3 3.3 c fill -31.5 438.1 moveto -12 f1 -(Freur) show -61.4 438.1 moveto -12 f0 -( ) show -31.5 424.8 moveto -12 f2 -(1983:) show -59.4 424.8 moveto -12 f0 -( Doot Doot ) show -298.1 438.6 moveto -12 f2 -(See also: ) show -344.7 438.6 moveto -12 f0 -(rt66.com) show -387.6 438.6 moveto -12 f0 -( ) show -18.1 412.1 moveto -3.3 3.3 c fill -31.5 404 moveto -12 f1 -(Front 242) show -81.8 404 moveto -12 f0 -( ) show -31.5 390.7 moveto -12 f2 -(1979:) show -59.4 390.7 moveto -12 f0 -( Masterhit ) show -111.3 390.7 moveto -12 f2 -(\(EP\)) show -133.9 390.7 moveto -12 f0 -( ) show -31.5 377.4 moveto -12 f2 -(1983:) show -59.4 377.4 moveto -12 f0 -( Geography ) show -31.5 364.1 moveto -12 f2 -(1987:) show -59.4 364.1 moveto -12 f0 -( Official Version ) show -31.5 350.8 moveto -12 f2 -(1985:) show -59.4 350.8 moveto -12 f0 -( No Comment ) show -31.5 337.5 moveto -12 f2 -(1982:) show -59.4 337.5 moveto -12 f0 -( Two In One ) show -123.3 337.5 moveto -12 f2 -(\(EP\)) show -145.9 337.5 moveto -12 f0 -( ) show -31.5 324.2 moveto -12 f2 -(1982-1985:) show -87.4 324.2 moveto -12 f0 -( Backcatalogue ) show -164 324.2 moveto -12 f2 -(\(comp\)) show -197.9 324.2 moveto -12 f0 -( ) show -31.5 310.9 moveto -12 f2 -(1989:) show -59.4 310.9 moveto -12 f0 -( Headhunter ) show -121.3 310.9 moveto -12 f2 -(\(EP\)) show -143.9 310.9 moveto -12 f0 -( ) show -31.5 297.6 moveto -12 f2 -(1989:) show -59.4 297.6 moveto -12 f0 -( Front by Front ) show -31.5 284.3 moveto -12 f2 -(1989:) show -59.4 284.3 moveto -12 f0 -( Never Stop ) show -119.7 284.3 moveto -12 f2 -(\(EP\)) show -142.3 284.3 moveto -12 f0 -( ) show -31.5 271 moveto -12 f2 -(1991:) show -59.4 271 moveto -12 f0 -( Tyrrany For You ) show -31.5 257.7 moveto -12 f2 -(1991:) show -59.4 257.7 moveto -12 f0 -( Tragedy For You ) show -148.7 257.7 moveto -12 f2 -(\(EP\)) show -171.3 257.7 moveto -12 f0 -( ) show -31.5 244.4 moveto -12 f2 -(1991:) show -59.4 244.4 moveto -12 f0 -( Rhythm of Time ) show -145.4 244.4 moveto -12 f2 -(\(EP\)) show -168 244.4 moveto -12 f0 -( ) show -31.5 231.1 moveto -12 f2 -(1993:) show -59.4 231.1 moveto -12 f0 -( Religion ) show -106.7 231.1 moveto -12 f2 -(\(EP\)) show -129.3 231.1 moveto -12 f0 -( ) show -31.5 217.8 moveto -12 f2 -(1993:) show -59.4 217.8 moveto -12 f0 -( Animal ) show -101.4 217.8 moveto -12 f2 -(\(single\)) show -138 217.8 moveto -12 f0 -( ) show -31.5 204.5 moveto -12 f2 -(1993:) show -59.4 204.5 moveto -12 f0 -( 06:21:03:11 Up Evil ) show -31.5 191.2 moveto -12 f2 -(1993:) show -59.4 191.2 moveto -12 f0 -( 05:22:09:12 Off ) show -298.1 404.5 moveto -12 f2 -(UBL Card: ) show -355.4 404.5 moveto -12 f0 -(1059) show -379.4 404.5 moveto -12 f0 -( ) show -298.1 391.2 moveto -12 f2 -(See also: ) show -344.7 391.2 moveto -12 f0 -(www.ifi.uio.no) show -417.6 391.2 moveto -12 f0 -( ) show -298.1 377.9 moveto -12 f2 -(See also: ) show -344.7 377.9 moveto -12 f0 -(www.eecs.nwu.edu) show -438.3 377.9 moveto -12 f0 -( ) show -18.1 178.5 moveto -3.3 3.3 c fill -31.5 170.4 moveto -12 f1 -(Front Line Assembly) show -139.5 170.4 moveto -12 f0 -( ) show -31.5 157.1 moveto -12 f2 -(1988:) show -59.4 157.1 moveto -12 f0 -( Convergence ) show -31.5 143.8 moveto -12 f2 -(1989:) show -59.4 143.8 moveto -12 f0 -( Digital Tension Dementia ) show -190 143.8 moveto -12 f2 -(\(EP\)) show -212.6 143.8 moveto -12 f0 -( ) show -31.5 130.5 moveto -12 f2 -(1990:) show -59.4 130.5 moveto -12 f0 -( Gashed Senses and Crossfire ) show -31.5 117.2 moveto -12 f2 -(1991:) show -59.4 117.2 moveto -12 f0 -( Caustic Grip ) show -31.5 103.9 moveto -12 f2 -(1992:) show -59.4 103.9 moveto -12 f0 -( Tactical Neural Implant ) show -304.9 170.9 moveto -12 f2 -(UBL Card: ) show -362.2 170.9 moveto -12 f0 -(1161) show -386.2 170.9 moveto -12 f0 -( ) show -18.1 91.2 moveto -3.3 3.3 c fill -31.5 83.1 moveto -12 f1 -(Fugazi) show -66.1 83.1 moveto -12 f0 -( ) show -298.1 83.6 moveto -12 f2 -(UBL Card: ) show -355.4 83.6 moveto -12 f0 -(2053) show -379.4 83.6 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 12 12 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1989:) show -59.4 709.2 moveto -12 f0 -( 13 Songs ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Fun Boy Three) show -108.8 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1982:) show -59.4 675.1 moveto -12 f0 -( It Ain't What You Do / Just Do It / Funrama Theme ) show -315.7 675.1 moveto -12 f2 -(\(single\)) show -352.3 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1981-1983:) show -87.4 661.8 moveto -12 f0 -( The Best of Fun Boy Three ) show -225 661.8 moveto -12 f2 -(\(comp\)) show -258.9 661.8 moveto -12 f0 -( ) show -18.1 649.1 moveto -3.3 3.3 c fill -31.5 641 moveto -12 f1 -(Fuzzbox) show -74.8 641 moveto -12 f0 -( ) show -31.5 627.7 moveto -12 f2 -(1986:) show -59.4 627.7 moveto -12 f0 -( We've got a Fuzzbox and We're Gonna Use It!!) show -31.5 601.1 moveto -12 f2 -(1986:) show -59.4 601.1 moveto -12 f0 -( Love is the Slug ) show -143.7 601.1 moveto -12 f2 -(\(single\)) show -180.3 601.1 moveto -12 f0 -( ) show -31.5 587.8 moveto -12 f2 -(1986:) show -59.4 587.8 moveto -12 f0 -( Rules and Regulations ) show -173.4 587.8 moveto -12 f2 -(\(single\)) show -210 587.8 moveto -12 f0 -( ) show -298.1 641.5 moveto -12 f2 -(See also: ) show -344.7 641.5 moveto -12 f0 -(world.std.com) show -413.3 641.5 moveto -12 f0 -( ) show -18.1 575.1 moveto -3.3 3.3 c fill -31.5 567 moveto -12 f1 -(Gabriel, Peter) show -104.1 567 moveto -12 f0 -( ) show -31.5 553.7 moveto -12 f2 -(1977:) show -59.4 553.7 moveto -12 f0 -( Peter Gabriel I ) show -31.5 540.4 moveto -12 f2 -(1978:) show -59.4 540.4 moveto -12 f0 -( Peter Gabriel II ) show -31.5 527.1 moveto -12 f2 -(1980:) show -59.4 527.1 moveto -12 f0 -( Peter Gabriel III ) show -31.5 513.8 moveto -12 f2 -(1982:) show -59.4 513.8 moveto -12 f0 -( Security ) show -31.5 500.5 moveto -12 f2 -(1983:) show -59.4 500.5 moveto -12 f0 -( Peter Gabriel Plays Live ) show -183 500.5 moveto -12 f2 -(\(double live\)) show -243.9 500.5 moveto -12 f0 -( ) show -31.5 487.2 moveto -12 f2 -(1985:) show -59.4 487.2 moveto -12 f0 -( Birdy ) show -92.7 487.2 moveto -12 f2 -(\(soundtrack\)) show -154 487.2 moveto -12 f0 -( ) show -31.5 473.9 moveto -12 f2 -(1986:) show -59.4 473.9 moveto -12 f0 -( So ) show -31.5 460.6 moveto -12 f2 -(1986:) show -59.4 460.6 moveto -12 f0 -( Live at the Civic Arena ) show -178 460.6 moveto -12 f2 -(\(live boot\)) show -227.6 460.6 moveto -12 f0 -( ) show -31.5 447.3 moveto -12 f2 -(1989:) show -59.4 447.3 moveto -12 f0 -( Passion ) show -102 447.3 moveto -12 f2 -(\(soundtrack\)) show -163.3 447.3 moveto -12 f0 -( ) show -298.1 567.5 moveto -12 f2 -(UBL Card: ) show -355.4 567.5 moveto -12 f0 -(1016) show -379.4 567.5 moveto -12 f0 -( ) show -298.1 554.2 moveto -12 f2 -(See also: ) show -344.7 554.2 moveto -12 f0 -(www.nwu.edu) show -414.6 554.2 moveto -12 f0 -( ) show -298.1 540.9 moveto -12 f2 -(See also: ) show -344.7 540.9 moveto -12 f0 -(www.cs.clemson.edu) show -447 540.9 moveto -12 f0 -( ) show -18.1 434.6 moveto -3.3 3.3 c fill -31.5 426.5 moveto -12 f1 -(Garbage) show -76.1 426.5 moveto -12 f0 -( ) show -31.5 413.2 moveto -12 f2 -(1995:) show -59.4 413.2 moveto -12 f0 -( Garbage ) show -298.1 427 moveto -12 f2 -(See also: ) show -344.7 427 moveto -12 f0 -(hamp.hampshire.edu) show -444.6 427 moveto -12 f0 -( ) show -18.1 400.5 moveto -3.3 3.3 c fill -31.5 392.4 moveto -12 f1 -(Game Theory) show -102.4 392.4 moveto -12 f0 -( ) show -31.5 379.1 moveto -12 f2 -(1987:) show -59.4 379.1 moveto -12 f0 -( Lolita Nation ) show -18.1 366.4 moveto -3.3 3.3 c fill -31.5 358.3 moveto -12 f1 -(Gang of 4) show -81.5 358.3 moveto -12 f0 -( ) show -31.5 345 moveto -12 f2 -(1979:) show -59.4 345 moveto -12 f0 -( Entertainment ) show -31.5 331.7 moveto -12 f2 -(1979:) show -59.4 331.7 moveto -12 f0 -( Peel Sessions ) show -130.4 331.7 moveto -12 f2 -(\(live\)) show -155.7 331.7 moveto -12 f0 -( ) show -31.5 318.4 moveto -12 f2 -(1981:) show -59.4 318.4 moveto -12 f0 -( Solid Gold ) show -31.5 305.1 moveto -12 f2 -(1981:) show -59.4 305.1 moveto -12 f0 -( Another Day / Another Dollar ) show -31.5 291.8 moveto -12 f2 -(1982:) show -59.4 291.8 moveto -12 f0 -( I Love a Man In a Uniform ) show -196 291.8 moveto -12 f2 -(\(single\)) show -232.6 291.8 moveto -12 f0 -( ) show -31.5 278.5 moveto -12 f2 -(1982:) show -59.4 278.5 moveto -12 f0 -( Songs of the Free ) show -31.5 265.2 moveto -12 f2 -(1983:) show -59.4 265.2 moveto -12 f0 -( Is It Love ) show -112 265.2 moveto -12 f2 -(\(single\)) show -148.6 265.2 moveto -12 f0 -( ) show -31.5 251.9 moveto -12 f2 -(1983:) show -59.4 251.9 moveto -12 f0 -( Hard ) show -31.5 238.6 moveto -12 f2 -(1983:) show -59.4 238.6 moveto -12 f0 -( At the Palace ) show -129.3 238.6 moveto -12 f2 -(\(live\)) show -154.6 238.6 moveto -12 f0 -( ) show -31.5 225.3 moveto -12 f2 -(1979-1983:) show -87.4 225.3 moveto -12 f0 -( A Brief History of the Twentieth Century) show -31.5 212 moveto -12 f2 -(\(comp\)) show -65.4 212 moveto -12 f0 -( ) show -31.5 198.7 moveto -12 f2 -(1990:) show -59.4 198.7 moveto -12 f0 -( To Hell With Poverty ) show -169.7 198.7 moveto -12 f2 -(\(single\)) show -206.3 198.7 moveto -12 f0 -( ) show -31.5 185.4 moveto -12 f2 -(1990:) show -59.4 185.4 moveto -12 f0 -( Mall ) show -31.5 172.1 moveto -12 f2 -(1990:) show -59.4 172.1 moveto -12 f0 -( Money Talks ) show -129 172.1 moveto -12 f2 -(\(single\)) show -165.6 172.1 moveto -12 f0 -( ) show -31.5 158.8 moveto -12 f2 -(1995:) show -59.4 158.8 moveto -12 f0 -( Tatoo ) show -93.3 158.8 moveto -12 f2 -(\(single\)) show -129.9 158.8 moveto -12 f0 -( ) show -31.5 145.5 moveto -12 f2 -(1995:) show -59.4 145.5 moveto -12 f0 -( Shrinkwrapped ) show -298.1 358.8 moveto -12 f2 -(See also: ) show -344.7 358.8 moveto -12 f0 -(http2.brunel.ac.uk) show -431.7 358.8 moveto -12 f0 -( ) show -18.1 132.8 moveto -3.3 3.3 c fill -31.5 124.7 moveto -12 f1 -(Glove, The) show -87.5 124.7 moveto -12 f0 -( ) show -31.5 111.4 moveto -12 f2 -(1982:) show -59.4 111.4 moveto -12 f0 -( Blue Sunshine ) show -298.1 125.2 moveto -12 f2 -(UBL Card: ) show -355.4 125.2 moveto -12 f0 -(1159) show -379.4 125.2 moveto -12 f0 -( ) show -298.1 111.9 moveto -12 f2 -(See also: ) show -344.7 111.9 moveto -12 f0 -(www.dcs.gla.ac.uk) show -436 111.9 moveto -12 f0 -( ) show -18.1 98.7 moveto -3.3 3.3 c fill -31.5 90.6 moveto -12 f1 -(God is my Copilot) show -124.5 90.6 moveto -12 f0 -( ) show -31.5 77.3 moveto -12 f2 -(1993:) show -59.4 77.3 moveto -12 f0 -( Speed Yr Trip ) show -pagelevel restore -showpage -%%Page: 13 13 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 712.6 moveto -3.3 3.3 c fill -31.5 704.5 moveto -12 f1 -(Gracious Shades) show -117.1 704.5 moveto -12 f0 -( ) show -31.5 691.2 moveto -12 f2 -(1995:) show -59.4 691.2 moveto -12 f0 -( Aberkash ) show -18.1 678.5 moveto -3.3 3.3 c fill -31.5 670.4 moveto -12 f1 -(Grind) show -62.8 670.4 moveto -12 f0 -( ) show -31.5 657.1 moveto -12 f2 -(1995:) show -59.4 657.1 moveto -12 f0 -( Kittymuzzle ) show -18.1 644.4 moveto -3.3 3.3 c fill -31.5 636.3 moveto -12 f1 -(Grotus) show -67.5 636.3 moveto -12 f0 -( ) show -31.5 623 moveto -12 f2 -(1993:) show -59.4 623 moveto -12 f0 -( Slow Motion Apocalypse ) show -302.1 636.8 moveto -12 f2 -(UBL Card: ) show -359.4 636.8 moveto -12 f0 -(5482) show -383.4 636.8 moveto -12 f0 -( ) show -18.1 610.3 moveto -3.3 3.3 c fill -31.5 602.2 moveto -12 f1 -(Pizzicato Five) show -102.4 602.2 moveto -12 f0 -( ) show -31.5 588.9 moveto -12 f2 -(1995:) show -59.4 588.9 moveto -12 f0 -( The Sound of Music ) show -18.1 576.2 moveto -3.3 3.3 c fill -31.5 568.1 moveto -12 f1 -(PJ Harvey) show -85.8 568.1 moveto -12 f0 -( ) show -31.5 554.8 moveto -12 f2 -(1992:) show -59.4 554.8 moveto -12 f0 -( Dry ) show -31.5 541.5 moveto -12 f2 -(1993:) show -59.4 541.5 moveto -12 f0 -( Rid of Me ) show -31.5 528.2 moveto -12 f2 -(1993:) show -59.4 528.2 moveto -12 f0 -( 4-Track Demos ) show -31.5 514.9 moveto -12 f2 -(1995:) show -59.4 514.9 moveto -12 f0 -( Down by the Water ) show -159.7 514.9 moveto -12 f2 -(\(single\)) show -196.3 514.9 moveto -12 f0 -( ) show -31.5 501.6 moveto -12 f2 -(1995:) show -59.4 501.6 moveto -12 f0 -( To Bring You My Love ) show -298.1 568.6 moveto -12 f2 -(UBL Card: ) show -355.4 568.6 moveto -12 f0 -(1221) show -379.4 568.6 moveto -12 f0 -( ) show -298.1 555.3 moveto -12 f2 -(See also: ) show -344.7 555.3 moveto -12 f0 -(www.louisville.edu) show -438.6 555.3 moveto -12 f0 -( ) show -18.1 488.9 moveto -3.3 3.3 c fill -31.5 480.8 moveto -12 f1 -(Psychick Warriors ov Gaia) show -170.4 480.8 moveto -12 f0 -( ) show -31.5 467.5 moveto -12 f2 -(1992:) show -59.4 467.5 moveto -12 f0 -( Ov Biospheres and Sacred Groves ) show -18.1 454.8 moveto -3.3 3.3 c fill -31.5 446.7 moveto -12 f1 -(Hagen, Nina) show -95.5 446.7 moveto -12 f0 -( ) show -31.5 433.4 moveto -12 f2 -(1985:) show -59.4 433.4 moveto -12 f0 -( In Ekstasy ) show -31.5 420.1 moveto -12 f2 -(1978-1982:) show -87.4 420.1 moveto -12 f0 -( nunsexmonkrock / Nina Hagen Band ) show -18.1 407.4 moveto -3.3 3.3 c fill -31.5 399.3 moveto -12 f1 -(Hate Dept.) show -86.8 399.3 moveto -12 f0 -( ) show -31.5 386 moveto -12 f2 -(1994:) show -59.4 386 moveto -12 f0 -( Meat Your Maker ) show -31.5 372.7 moveto -12 f2 -(1995:) show -59.4 372.7 moveto -12 f0 -( Mainline ) show -108.7 372.7 moveto -12 f2 -(\(EP\)) show -131.3 372.7 moveto -12 f0 -( ) show -298.1 399.8 moveto -12 f2 -(See also: ) show -344.7 399.8 moveto -12 f0 -(www.iuma.com) show -421.3 399.8 moveto -12 f0 -( ) show -18.1 360 moveto -3.3 3.3 c fill -31.5 351.9 moveto -12 f1 -(Haysi Fantayzee) show -115.8 351.9 moveto -12 f0 -( ) show -31.5 338.6 moveto -12 f2 -(1982:) show -59.4 338.6 moveto -12 f0 -( Shiny Shiny remix ) show -155.4 338.6 moveto -12 f2 -(\(single\)) show -192 338.6 moveto -12 f0 -( ) show -18.1 325.9 moveto -3.3 3.3 c fill -31.5 317.8 moveto -12 f1 -(Heaven 17) show -85.1 317.8 moveto -12 f0 -( ) show -31.5 304.5 moveto -12 f2 -(1981:) show -59.4 304.5 moveto -12 f0 -( Penthouse and Pavement ) show -31.5 291.2 moveto -12 f2 -(1982:) show -59.4 291.2 moveto -12 f0 -( Heaven 17 ) show -31.5 277.9 moveto -12 f2 -(1983:) show -59.4 277.9 moveto -12 f0 -( The Luxury Gap ) show -31.5 264.6 moveto -12 f2 -(1984:) show -59.4 264.6 moveto -12 f0 -( How Men Are ) show -18.1 251.9 moveto -3.3 3.3 c fill -31.5 243.8 moveto -12 f1 -(Hope, Peter and Kirk, Richard) show -190.1 243.8 moveto -12 f0 -( ) show -31.5 230.5 moveto -12 f2 -(1988:) show -59.4 230.5 moveto -12 f0 -( Hoodoo Talk ) show -298.1 244.3 moveto -12 f2 -(UBL Card: ) show -355.4 244.3 moveto -12 f0 -(2307) show -379.4 244.3 moveto -12 f0 -( ) show -18.1 217.8 moveto -3.3 3.3 c fill -31.5 209.7 moveto -12 f1 -(Kershaw, Nik) show -102.1 209.7 moveto -12 f0 -( ) show -31.5 196.4 moveto -12 f2 -(1983:) show -59.4 196.4 moveto -12 f0 -( Human Racing ) show -18.1 183.7 moveto -3.3 3.3 c fill -31.5 175.6 moveto -12 f1 -(Kirk, Richard) show -104.1 175.6 moveto -12 f0 -( ) show -31.5 162.3 moveto -12 f2 -(1993:) show -59.4 162.3 moveto -12 f0 -( Virtual State ) show -298.1 176.1 moveto -12 f2 -(UBL Card: ) show -355.4 176.1 moveto -12 f0 -(2307) show -379.4 176.1 moveto -12 f0 -( ) show -18.1 149.6 moveto -3.3 3.3 c fill -31.5 141.5 moveto -12 f1 -(Human League) show -110.5 141.5 moveto -12 f0 -( ) show -31.5 128.2 moveto -12 f2 -(1979:) show -59.4 128.2 moveto -12 f0 -( Reproduction ) show -31.5 114.9 moveto -12 f2 -(1980:) show -59.4 114.9 moveto -12 f0 -( Travelogue ) show -31.5 101.6 moveto -12 f2 -(1981:) show -59.4 101.6 moveto -12 f0 -( Dare ) show -31.5 88.3 moveto -12 f2 -(1983:) show -59.4 88.3 moveto -12 f0 -( Fascination ) show -31.5 75 moveto -12 f2 -(1984:) show -59.4 75 moveto -12 f0 -( Hysteria ) show -298.1 142 moveto -12 f2 -(UBL Card: ) show -355.4 142 moveto -12 f0 -(4631) show -379.4 142 moveto -12 f0 -( ) show -298.1 128.7 moveto -12 f2 -(See also: ) show -344.7 128.7 moveto -12 f0 -(pathfinder.com) show -417.6 128.7 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 14 14 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1995:) show -59.4 709.2 moveto -12 f0 -( Octopus ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Hunters and Collectors) show -150.8 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1987:) show -59.4 675.1 moveto -12 f0 -( Human Frailty ) show -300.2 688.9 moveto -12 f2 -(UBL Card: ) show -357.5 688.9 moveto -12 f0 -(4553) show -381.5 688.9 moveto -12 f0 -( ) show -18.1 662.4 moveto -3.3 3.3 c fill -31.5 654.3 moveto -12 f1 -(Ice T) show -57.8 654.3 moveto -12 f0 -( ) show -31.5 641 moveto -12 f2 -(1991:) show -59.4 641 moveto -12 f0 -( New Jack Hustler ) show -150.7 641 moveto -12 f2 -(\(EP\)) show -173.3 641 moveto -12 f0 -( ) show -298.1 654.8 moveto -12 f2 -(UBL Card: ) show -355.4 654.8 moveto -12 f0 -(2342) show -379.4 654.8 moveto -12 f0 -( ) show -18.1 628.3 moveto -3.3 3.3 c fill -31.5 620.2 moveto -12 f1 -(In the Nursery) show -106.8 620.2 moveto -12 f0 -( ) show -31.5 606.9 moveto -12 f2 -(19??:) show -59.4 606.9 moveto -12 f0 -( L'Esprit ) show -18.1 594.2 moveto -3.3 3.3 c fill -31.5 586.1 moveto -12 f1 -(INXS) show -60.1 586.1 moveto -12 f0 -( ) show -31.5 572.8 moveto -12 f2 -(1982:) show -59.4 572.8 moveto -12 f0 -( Shabooh Shoobah ) show -31.5 559.5 moveto -12 f2 -(1984:) show -59.4 559.5 moveto -12 f0 -( The Swing ) show -31.5 546.2 moveto -12 f2 -(1985:) show -59.4 546.2 moveto -12 f0 -( Listen Like Thieves ) show -31.5 532.9 moveto -12 f2 -(1988:) show -59.4 532.9 moveto -12 f0 -( Kick ) show -31.5 519.6 moveto -12 f2 -(1990:) show -59.4 519.6 moveto -12 f0 -( X ) show -298.1 586.6 moveto -12 f2 -(UBL Card: ) show -355.4 586.6 moveto -12 f0 -(1284) show -379.4 586.6 moveto -12 f0 -( ) show -18.1 506.9 moveto -3.3 3.3 c fill -31.5 498.8 moveto -12 f1 -(J., David) show -77.1 498.8 moveto -12 f0 -( ) show -31.5 485.5 moveto -12 f2 -(1983-1986:) show -87.4 485.5 moveto -12 f0 -( On Glass ) show -137.7 485.5 moveto -12 f2 -(\(comp\)) show -171.6 485.5 moveto -12 f0 -( ) show -31.5 472.2 moveto -12 f2 -(1985:) show -59.4 472.2 moveto -12 f0 -( Crocodile Tears and the Velvet Cosh ) show -298.1 499.3 moveto -12 f2 -(UBL Card: ) show -355.4 499.3 moveto -12 f0 -(1215) show -379.4 499.3 moveto -12 f0 -( ) show -298.1 486 moveto -12 f2 -(See also: ) show -344.7 486 moveto -12 f0 -(gothic.acs.csulb.edu) show -441.6 486 moveto -12 f0 -( ) show -298.1 472.7 moveto -12 f2 -(See also: ) show -344.7 472.7 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 472.7 moveto -12 f0 -( ) show -18.1 459.5 moveto -3.3 3.3 c fill -31.5 451.4 moveto -12 f1 -(Jesus and Mary Chain, The) show -173.1 451.4 moveto -12 f0 -( ) show -31.5 438.1 moveto -12 f2 -(1992:) show -59.4 438.1 moveto -12 f0 -( Reverence ) show -116 438.1 moveto -12 f2 -(\(EP\)) show -138.6 438.1 moveto -12 f0 -( ) show -31.5 424.8 moveto -12 f2 -(1992:) show -59.4 424.8 moveto -12 f0 -( Honey's Dead ) show -31.5 411.5 moveto -12 f2 -(1995:) show -59.4 411.5 moveto -12 f0 -( Hate Rock and Roll ) show -160.3 411.5 moveto -12 f2 -(\(comp\)) show -194.2 411.5 moveto -12 f0 -( ) show -298.1 451.9 moveto -12 f2 -(UBL Card: ) show -355.4 451.9 moveto -12 f0 -(1228) show -379.4 451.9 moveto -12 f0 -( ) show -298.1 438.6 moveto -12 f2 -(See also: ) show -344.7 438.6 moveto -12 f0 -(american.recordings.com) show -465.9 438.6 moveto -12 f0 -( ) show -18.1 398.8 moveto -3.3 3.3 c fill -31.5 390.7 moveto -12 f1 -(Jones, Grace) show -97.4 390.7 moveto -12 f0 -( ) show -31.5 377.4 moveto -12 f2 -(1993:) show -59.4 377.4 moveto -12 f0 -( Sex Drive ) show -113.7 377.4 moveto -12 f2 -(\(single\)) show -150.3 377.4 moveto -12 f0 -( ) show -18.1 364.7 moveto -3.3 3.3 c fill -31.5 356.6 moveto -12 f1 -(Jones, Howard) show -108.1 356.6 moveto -12 f0 -( ) show -31.5 343.3 moveto -12 f2 -(1983:) show -59.4 343.3 moveto -12 f0 -( Humans' Lib ) show -31.5 330 moveto -12 f2 -(1985:) show -59.4 330 moveto -12 f0 -( Dream Into Action ) show -18.1 317.3 moveto -3.3 3.3 c fill -31.5 309.2 moveto -12 f1 -(Joy Division) show -94.5 309.2 moveto -12 f0 -( ) show -31.5 295.9 moveto -12 f2 -(1977-1978:) show -87.4 295.9 moveto -12 f0 -( Warsaw ) show -132.7 295.9 moveto -12 f2 -(\(comp\)) show -166.6 295.9 moveto -12 f0 -( ) show -31.5 282.6 moveto -12 f2 -(1979:) show -59.4 282.6 moveto -12 f0 -( Unknown Pleasures ) show -31.5 269.3 moveto -12 f2 -(1980:) show -59.4 269.3 moveto -12 f0 -( Closer ) show -31.5 256 moveto -12 f2 -(1980:) show -59.4 256 moveto -12 f0 -( Transmission / Novelty ) show -178 256 moveto -12 f2 -(\(single\)) show -214.6 256 moveto -12 f0 -( ) show -31.5 242.7 moveto -12 f2 -(1980:) show -59.4 242.7 moveto -12 f0 -( Still ) show -31.5 229.4 moveto -12 f2 -(1977-1980:) show -87.4 229.4 moveto -12 f0 -( Substance ) show -142 229.4 moveto -12 f2 -(\(comp\)) show -175.9 229.4 moveto -12 f0 -( ) show -31.5 216.1 moveto -12 f2 -(1995:) show -59.4 216.1 moveto -12 f0 -( Ceremonial: A Tribute ) show -174.7 216.1 moveto -12 f2 -(\(various\)) show -218.6 216.1 moveto -12 f0 -( ) show -298.1 309.7 moveto -12 f2 -(UBL Card: ) show -355.4 309.7 moveto -12 f0 -(1214) show -379.4 309.7 moveto -12 f0 -( ) show -298.1 296.4 moveto -12 f2 -(See also: ) show -344.7 296.4 moveto -12 f0 -(www.fys.uio.no) show -421.6 296.4 moveto -12 f0 -( ) show -298.1 283.1 moveto -12 f2 -(See also: ) show -344.7 283.1 moveto -12 f0 -(csclub.uwaterloo.ca) show -440 283.1 moveto -12 f0 -( ) show -18.1 203.4 moveto -3.3 3.3 c fill -31.5 195.3 moveto -12 f1 -(King Crimson) show -104.5 195.3 moveto -12 f0 -( ) show -31.5 182 moveto -12 f2 -(1969:) show -59.4 182 moveto -12 f0 -( In the Court of the Crimson King ) show -31.5 168.7 moveto -12 f2 -(1973:) show -59.4 168.7 moveto -12 f0 -( Larks' Tongues in Aspic ) show -31.5 155.4 moveto -12 f2 -(1974:) show -59.4 155.4 moveto -12 f0 -( Starless and Bible Black ) show -31.5 142.1 moveto -12 f2 -(1981:) show -59.4 142.1 moveto -12 f0 -( Dicipline ) show -31.5 128.8 moveto -12 f2 -(1982:) show -59.4 128.8 moveto -12 f0 -( Beat ) show -31.5 115.5 moveto -12 f2 -(1984:) show -59.4 115.5 moveto -12 f0 -( Three of a Perfect Pair ) show -298.1 195.8 moveto -12 f2 -(UBL Card: ) show -355.4 195.8 moveto -12 f0 -(1323) show -379.4 195.8 moveto -12 f0 -( ) show -18.1 102.8 moveto -3.3 3.3 c fill -31.5 94.7 moveto -12 f1 -(KMFDM) show -79.4 94.7 moveto -12 f0 -( ) show -31.5 81.4 moveto -12 f2 -(1993:) show -59.4 81.4 moveto -12 f0 -( Angst ) show -298.1 95.2 moveto -12 f2 -(UBL Card: ) show -355.4 95.2 moveto -12 f0 -(1452) show -379.4 95.2 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 15 15 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 716.6 moveto -3.3 3.3 c fill -31.5 708.5 moveto -12 f1 -(Kraftwerk) show -86.1 708.5 moveto -12 f0 -( ) show -31.5 695.2 moveto -12 f2 -(1977:) show -59.4 695.2 moveto -12 f0 -( Trans-Europe Express ) show -172.3 695.2 moveto -12 f2 -(\(EP\)) show -194.9 695.2 moveto -12 f0 -( ) show -298.1 709 moveto -12 f2 -(UBL Card: ) show -355.4 709 moveto -12 f0 -(1027) show -379.4 709 moveto -12 f0 -( ) show -298.1 695.7 moveto -12 f2 -(See also: ) show -344.7 695.7 moveto -12 f0 -(wwwtdb.cs.umu.se) show -436.3 695.7 moveto -12 f0 -( ) show -298.1 682.4 moveto -12 f2 -(See also: ) show -344.7 682.4 moveto -12 f0 -(rt66.com) show -387.6 682.4 moveto -12 f0 -( ) show -18.1 669.7 moveto -3.3 3.3 c fill -31.5 661.6 moveto -12 f1 -(L7) show -45.5 661.6 moveto -12 f0 -( ) show -31.5 648.3 moveto -12 f2 -(1988:) show -59.4 648.3 moveto -12 f0 -( L7 ) show -31.5 635 moveto -12 f2 -(1990:) show -59.4 635 moveto -12 f0 -( Smell the Magic ) show -31.5 621.7 moveto -12 f2 -(1992:) show -59.4 621.7 moveto -12 f0 -( Bricks are Heavy ) show -31.5 608.4 moveto -12 f2 -(1994:) show -59.4 608.4 moveto -12 f0 -( Hungry for Stink ) show -298.1 662.1 moveto -12 f2 -(UBL Card: ) show -355.4 662.1 moveto -12 f0 -(1998) show -379.4 662.1 moveto -12 f0 -( ) show -18.1 595.7 moveto -3.3 3.3 c fill -31.5 587.6 moveto -12 f1 -(Le&ae;ther Strip) show -120.4 587.6 moveto -12 f0 -( ) show -31.5 574.3 moveto -12 f2 -(1995:) show -59.4 574.3 moveto -12 f0 -( Legacy of Hate and Lust ) show -18.1 561.6 moveto -3.3 3.3 c fill -31.5 553.5 moveto -12 f1 -(Lemon Kittens) show -107.8 553.5 moveto -12 f0 -( ) show -31.5 540.2 moveto -12 f2 -(1978-1980:) show -87.4 540.2 moveto -12 f0 -( We Buy a Hammer for Daddy ) show -300.6 554 moveto -12 f2 -(UBL Card: ) show -357.9 554 moveto -12 f0 -(1746) show -381.9 554 moveto -12 f0 -( ) show -18.1 527.5 moveto -3.3 3.3 c fill -31.5 519.4 moveto -12 f1 -(Letters to Cleo) show -107.4 519.4 moveto -12 f0 -( ) show -31.5 506.1 moveto -12 f2 -(1994:) show -59.4 506.1 moveto -12 f0 -( Aurora Gory Alice ) show -298.1 519.9 moveto -12 f2 -(UBL Card: ) show -355.4 519.9 moveto -12 f0 -(3000) show -379.4 519.9 moveto -12 f0 -( ) show -18.1 493.4 moveto -3.3 3.3 c fill -31.5 485.3 moveto -12 f1 -(LFO) show -56.1 485.3 moveto -12 f0 -( ) show -31.5 472 moveto -12 f2 -(1991:) show -59.4 472 moveto -12 f0 -( Frequencies ) show -31.5 458.7 moveto -12 f2 -(1996:) show -59.4 458.7 moveto -12 f0 -( Advance ) show -18.1 446 moveto -3.3 3.3 c fill -31.5 437.9 moveto -12 f1 -(London After Midnight) show -152.8 437.9 moveto -12 f0 -( ) show -31.5 424.6 moveto -12 f2 -(1989:) show -59.4 424.6 moveto -12 f0 -( Selected Scenes from the End of the World ) show -18.1 411.9 moveto -3.3 3.3 c fill -31.5 403.8 moveto -12 f1 -(Lords of Acid) show -102.1 403.8 moveto -12 f0 -( ) show -31.5 390.5 moveto -12 f2 -(1991:) show -59.4 390.5 moveto -12 f0 -( Rough Sex ) show -118.4 390.5 moveto -12 f2 -(\(single\)) show -155 390.5 moveto -12 f0 -( ) show -31.5 377.2 moveto -12 f2 -(1993:) show -59.4 377.2 moveto -12 f0 -( Voodoo U ) show -31.5 363.9 moveto -12 f2 -(1994:) show -59.4 363.9 moveto -12 f0 -( The Crablouse: Variations on a Species ) show -255 363.9 moveto -12 f2 -(\(single\)) show -291.6 363.9 moveto -12 f0 -( ) show -300.2 404.3 moveto -12 f2 -(UBL Card: ) show -357.5 404.3 moveto -12 f0 -(2356) show -381.5 404.3 moveto -12 f0 -( ) show -18.1 351.2 moveto -3.3 3.3 c fill -31.5 343.1 moveto -12 f1 -(Lords of the New Church, The) show -188.1 343.1 moveto -12 f0 -( ) show -31.5 329.8 moveto -12 f2 -(1983:) show -59.4 329.8 moveto -12 f0 -( Is Nothing Sacred? ) show -18.1 317.1 moveto -3.3 3.3 c fill -31.5 309 moveto -12 f1 -(Love and Rockets) show -122.8 309 moveto -12 f0 -( ) show -31.5 295.7 moveto -12 f2 -(1985:) show -59.4 295.7 moveto -12 f0 -( Ball of Confusion / Inside the Outside ) show -248 295.7 moveto -12 f2 -(\(single\)) show -284.6 295.7 moveto -12 f0 -( ) show -31.5 282.4 moveto -12 f2 -(1985:) show -59.4 282.4 moveto -12 f0 -( Seventh Dream of Teenage Heaven ) show -31.5 269.1 moveto -12 f2 -(1986:) show -59.4 269.1 moveto -12 f0 -( Express ) show -31.5 255.8 moveto -12 f2 -(1986:) show -59.4 255.8 moveto -12 f0 -( Kundalini Express / Lucifer Sam / Holiday on) show -31.5 242.5 moveto -12 f0 -(the Moon ) show -80.8 242.5 moveto -12 f2 -(\(single\)) show -117.4 242.5 moveto -12 f0 -( ) show -31.5 229.2 moveto -12 f2 -(1987:) show -59.4 229.2 moveto -12 f0 -( Earth, Sun, Moon ) show -31.5 215.9 moveto -12 f2 -(1989:) show -59.4 215.9 moveto -12 f0 -( No Big Deal ) show -126 215.9 moveto -12 f2 -(\(single\)) show -162.6 215.9 moveto -12 f0 -( ) show -31.5 202.6 moveto -12 f2 -(1989:) show -59.4 202.6 moveto -12 f0 -( Motorcycle ) show -120.7 202.6 moveto -12 f2 -(\(single\)) show -157.3 202.6 moveto -12 f0 -( ) show -31.5 189.3 moveto -12 f2 -(1989:) show -59.4 189.3 moveto -12 f0 -( Love and Rockets ) show -31.5 176 moveto -12 f2 -(1994:) show -59.4 176 moveto -12 f0 -( This Heaven ) show -126.3 176 moveto -12 f2 -(\(EP\)) show -148.9 176 moveto -12 f0 -( ) show -31.5 162.7 moveto -12 f2 -(1994:) show -59.4 162.7 moveto -12 f0 -( Body and Soul ) show -136.7 162.7 moveto -12 f2 -(\(EP\)) show -159.3 162.7 moveto -12 f0 -( ) show -31.5 149.4 moveto -12 f2 -(1994:) show -59.4 149.4 moveto -12 f0 -( Hot Trip to Heaven ) show -31.5 136.1 moveto -12 f2 -(1995:) show -59.4 136.1 moveto -12 f0 -( The Glittering Darkness ) show -181.3 136.1 moveto -12 f2 -(\(EP\)) show -203.9 136.1 moveto -12 f0 -( ) show -31.5 122.8 moveto -12 f2 -(1996:) show -59.4 122.8 moveto -12 f0 -( Sweet F. A. ) show -298.1 309.5 moveto -12 f2 -(UBL Card: ) show -355.4 309.5 moveto -12 f0 -(1215) show -379.4 309.5 moveto -12 f0 -( ) show -298.1 296.2 moveto -12 f2 -(See also: ) show -344.7 296.2 moveto -12 f0 -(american.recordings.com) show -465.9 296.2 moveto -12 f0 -( ) show -298.1 282.9 moveto -12 f2 -(See also: ) show -344.7 282.9 moveto -12 f0 -(gothic.acs.csulb.edu) show -441.6 282.9 moveto -12 f0 -( ) show -18.1 110.1 moveto -3.3 3.3 c fill -31.5 102 moveto -12 f1 -(Love is Colder than Death) show -166.1 102 moveto -12 f0 -( ) show -31.5 88.7 moveto -12 f2 -(1993:) show -59.4 88.7 moveto -12 f0 -( Oxeia ) show -31.5 75.4 moveto -12 f2 -(19??:) show -59.4 75.4 moveto -12 f0 -( Mental Traveller ) show -pagelevel restore -showpage -%%Page: 16 16 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(19??:) show -59.4 709.2 moveto -12 f0 -( Teignmouth ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Low Pop Suicide) show -117.5 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1992:) show -59.4 675.1 moveto -12 f0 -( Disengagement ) show -140 675.1 moveto -12 f2 -(\(EP\)) show -162.6 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1992:) show -59.4 661.8 moveto -12 f0 -( On the Cross of Commerce ) show -31.5 648.5 moveto -12 f2 -(1994:) show -59.4 648.5 moveto -12 f0 -( Kiss Your Lips ) show -138.7 648.5 moveto -12 f2 -(\(remixes\)) show -184 648.5 moveto -12 f0 -( ) show -31.5 635.2 moveto -12 f2 -(1995:) show -59.4 635.2 moveto -12 f0 -( The Death of Excellence ) show -306.4 688.9 moveto -12 f2 -(UBL Card: ) show -363.7 688.9 moveto -12 f0 -(1984) show -387.7 688.9 moveto -12 f0 -( ) show -18.1 622.5 moveto -3.3 3.3 c fill -31.5 614.4 moveto -12 f1 -(Luscious Jackson) show -121.1 614.4 moveto -12 f0 -( ) show -31.5 601.1 moveto -12 f2 -(1992:) show -59.4 601.1 moveto -12 f0 -( In Search of Manny ) show -31.5 587.8 moveto -12 f2 -(1994:) show -59.4 587.8 moveto -12 f0 -( Natural Ingredients ) show -18.1 575.1 moveto -3.3 3.3 c fill -31.5 567 moveto -12 f1 -(Lush) show -57.5 567 moveto -12 f0 -( ) show -31.5 553.7 moveto -12 f2 -(1990:) show -59.4 553.7 moveto -12 f0 -( Gala ) show -31.5 540.4 moveto -12 f2 -(1992:) show -59.4 540.4 moveto -12 f0 -( Spooky ) show -31.5 527.1 moveto -12 f2 -(1994:) show -59.4 527.1 moveto -12 f0 -( Split ) show -298.1 567.5 moveto -12 f2 -(UBL Card: ) show -355.4 567.5 moveto -12 f0 -(2359) show -379.4 567.5 moveto -12 f0 -( ) show -298.1 554.2 moveto -12 f2 -(See also: ) show -344.7 554.2 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 554.2 moveto -12 f0 -( ) show -18.1 514.4 moveto -3.3 3.3 c fill -31.5 506.3 moveto -12 f1 -(Lwin, Annabella) show -116.8 506.3 moveto -12 f0 -( ) show -31.5 493 moveto -12 f2 -(1986:) show -59.4 493 moveto -12 f0 -( War Boys ) show -113.7 493 moveto -12 f2 -(\(single\)) show -150.3 493 moveto -12 f0 -( ) show -31.5 479.7 moveto -12 f2 -(1994:) show -59.4 479.7 moveto -12 f0 -( Car Sex ) show -103.7 479.7 moveto -12 f2 -(\(EP\)) show -126.3 479.7 moveto -12 f0 -( ) show -300.5 506.8 moveto -12 f2 -(UBL Card: ) show -357.8 506.8 moveto -12 f0 -(2301) show -381.8 506.8 moveto -12 f0 -( ) show -18.1 467 moveto -3.3 3.3 c fill -31.5 458.9 moveto -12 f1 -(Lycea) show -62.1 458.9 moveto -12 f0 -( ) show -31.5 445.6 moveto -12 f2 -(1993:) show -59.4 445.6 moveto -12 f0 -( A Day in the Stark Corner ) show -298.1 459.4 moveto -12 f2 -(See also: ) show -344.7 459.4 moveto -12 f0 -(www.projekt.com) show -431.3 459.4 moveto -12 f0 -( ) show -18.1 432.9 moveto -3.3 3.3 c fill -31.5 424.8 moveto -12 f1 -(M) show -42.8 424.8 moveto -12 f0 -( ) show -31.5 411.5 moveto -12 f2 -(1979:) show -59.4 411.5 moveto -12 f0 -( Pop Musik ) show -117.7 411.5 moveto -12 f2 -(\(7inch\)) show -152.3 411.5 moveto -12 f0 -( ) show -18.1 398.8 moveto -3.3 3.3 c fill -31.5 390.7 moveto -12 f1 -(Machines of Loving Grace) show -167.1 390.7 moveto -12 f0 -( ) show -31.5 377.4 moveto -12 f2 -(1991:) show -59.4 377.4 moveto -12 f0 -( Rite of Shiva ) show -128.7 377.4 moveto -12 f2 -(\(single\)) show -165.3 377.4 moveto -12 f0 -( ) show -31.5 364.1 moveto -12 f2 -(1991:) show -59.4 364.1 moveto -12 f0 -( Machines of Loving Grace ) show -31.5 350.8 moveto -12 f2 -(1992:) show -59.4 350.8 moveto -12 f0 -( Burn Like Brilliant Trash ) show -187.7 350.8 moveto -12 f2 -(\(EP\)) show -210.3 350.8 moveto -12 f0 -( ) show -31.5 337.5 moveto -12 f2 -(1993:) show -59.4 337.5 moveto -12 f0 -( Concentration ) show -31.5 324.2 moveto -12 f2 -(1995:) show -59.4 324.2 moveto -12 f0 -( Gilt ) show -298.1 391.2 moveto -12 f2 -(UBL Card: ) show -355.4 391.2 moveto -12 f0 -(1219) show -379.4 391.2 moveto -12 f0 -( ) show -298.1 377.9 moveto -12 f2 -(See also: ) show -344.7 377.9 moveto -12 f0 -(www.nando.net) show -420.6 377.9 moveto -12 f0 -( ) show -18.1 311.5 moveto -3.3 3.3 c fill -31.5 303.4 moveto -12 f1 -(M|A|R|R|S) show -86 303.4 moveto -12 f0 -( ) show -31.5 290.1 moveto -12 f2 -(1987:) show -59.4 290.1 moveto -12 f0 -( Pump Up the Volume / Anitina ) show -215.7 290.1 moveto -12 f2 -(\(single\)) show -252.3 290.1 moveto -12 f0 -( ) show -18.1 277.4 moveto -3.3 3.3 c fill -31.5 269.3 moveto -12 f1 -(Mallinder, Stephen) show -130.1 269.3 moveto -12 f0 -( ) show -31.5 256 moveto -12 f2 -(1982:) show -59.4 256 moveto -12 f0 -( Pow Wow ) show -299.9 269.8 moveto -12 f2 -(UBL Card: ) show -357.2 269.8 moveto -12 f0 -(2307) show -381.2 269.8 moveto -12 f0 -( ) show -18.1 243.3 moveto -3.3 3.3 c fill -31.5 235.2 moveto -12 f1 -(Manufacture) show -98.8 235.2 moveto -12 f0 -( ) show -31.5 221.9 moveto -12 f2 -(1988:) show -59.4 221.9 moveto -12 f0 -( Terrorvision ) show -18.1 209.2 moveto -3.3 3.3 c fill -31.5 201.1 moveto -12 f1 -(March Violets, The) show -130.4 201.1 moveto -12 f0 -( ) show -31.5 187.8 moveto -12 f2 -(1984:) show -59.4 187.8 moveto -12 f0 -( Natural History ) show -31.5 174.5 moveto -12 f2 -(1982-1984:) show -87.4 174.5 moveto -12 f0 -( The Botanic Verses ) show -188 174.5 moveto -12 f2 -(\(comp\)) show -221.9 174.5 moveto -12 f0 -( ) show -31.5 161.2 moveto -12 f2 -(1983-1985:) show -87.4 161.2 moveto -12 f0 -( Electric Shades ) show -167.7 161.2 moveto -12 f2 -(\(comp\)) show -201.6 161.2 moveto -12 f0 -( ) show -31.5 147.9 moveto -12 f2 -(1985:) show -59.4 147.9 moveto -12 f0 -( Deep ) show -90.7 147.9 moveto -12 f2 -(\(EP\)) show -113.3 147.9 moveto -12 f0 -( ) show -31.5 134.6 moveto -12 f2 -(1986:) show -59.4 134.6 moveto -12 f0 -( A Turn to the Sky / Never Look Back / Deep /) show -31.5 121.3 moveto -12 f0 -(Rebirth ) show -70.5 121.3 moveto -12 f2 -(\(single\)) show -107.1 121.3 moveto -12 f0 -( ) show -298.1 201.6 moveto -12 f2 -(UBL Card: ) show -355.4 201.6 moveto -12 f0 -(1114) show -379.4 201.6 moveto -12 f0 -( ) show -298.1 188.3 moveto -12 f2 -(See also: ) show -344.7 188.3 moveto -12 f0 -(www.cm.cf.ac.uk) show -429.3 188.3 moveto -12 f0 -( ) show -18.1 108.6 moveto -3.3 3.3 c fill -31.5 100.5 moveto -12 f1 -(Martha and the Muffins) show -155.8 100.5 moveto -12 f0 -( ) show -31.5 87.2 moveto -12 f2 -(1980-1984:) show -87.4 87.2 moveto -12 f0 -( Far Away in Time ) show -181.7 87.2 moveto -12 f2 -(\(comp\)) show -215.6 87.2 moveto -12 f0 -( ) show -300.6 101 moveto -12 f2 -(UBL Card: ) show -357.9 101 moveto -12 f0 -(2529) show -381.9 101 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 17 17 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 716.6 moveto -3.3 3.3 c fill -31.5 708.5 moveto -12 f1 -(Mary's Danish) show -107.8 708.5 moveto -12 f0 -( ) show -31.5 695.2 moveto -12 f2 -(1991:) show -59.4 695.2 moveto -12 f0 -( Circa ) show -298.1 709 moveto -12 f2 -(UBL Card: ) show -355.4 709 moveto -12 f0 -(3727) show -379.4 709 moveto -12 f0 -( ) show -18.1 682.5 moveto -3.3 3.3 c fill -31.5 674.4 moveto -12 f1 -(MC 900 Foot Jesus) show -129.1 674.4 moveto -12 f0 -( ) show -31.5 661.1 moveto -12 f2 -(1989:) show -59.4 661.1 moveto -12 f0 -( Hell With the Lid Off ) show -31.5 647.8 moveto -12 f2 -(1989:) show -59.4 647.8 moveto -12 f0 -( UFOs Are Real ) show -140 647.8 moveto -12 f2 -(\(EP\)) show -162.6 647.8 moveto -12 f0 -( ) show -31.5 634.5 moveto -12 f2 -(1990:) show -59.4 634.5 moveto -12 f0 -( Welcome to My Dream ) show -31.5 621.2 moveto -12 f2 -(1990:) show -59.4 621.2 moveto -12 f0 -( Killer Inside Me ) show -144.7 621.2 moveto -12 f2 -(\(EP\)) show -167.3 621.2 moveto -12 f0 -( ) show -298.1 674.9 moveto -12 f2 -(UBL Card: ) show -355.4 674.9 moveto -12 f0 -(1229) show -379.4 674.9 moveto -12 f0 -( ) show -298.1 661.6 moveto -12 f2 -(See also: ) show -344.7 661.6 moveto -12 f0 -(american.recordings.com) show -465.9 661.6 moveto -12 f0 -( ) show -18.1 608.5 moveto -3.3 3.3 c fill -31.5 600.4 moveto -12 f1 -(McLachlan, Sarah) show -126.8 600.4 moveto -12 f0 -( ) show -31.5 587.1 moveto -12 f2 -(1992:) show -59.4 587.1 moveto -12 f0 -( Into the Fire ) show -124.7 587.1 moveto -12 f2 -(\(single\)) show -161.3 587.1 moveto -12 f0 -( ) show -302.9 600.9 moveto -12 f2 -(UBL Card: ) show -360.2 600.9 moveto -12 f0 -(1389) show -384.2 600.9 moveto -12 f0 -( ) show -18.1 574.4 moveto -3.3 3.3 c fill -31.5 566.3 moveto -12 f1 -(Meat Beat Manifesto) show -138.8 566.3 moveto -12 f0 -( ) show -31.5 553 moveto -12 f2 -(1988:) show -59.4 553 moveto -12 f0 -( Armed Audio Warfare ) show -31.5 539.7 moveto -12 f2 -(1990:) show -59.4 539.7 moveto -12 f0 -( Dog Star Man ) show -133.3 539.7 moveto -12 f2 -(\(EP\)) show -155.9 539.7 moveto -12 f0 -( ) show -31.5 526.4 moveto -12 f2 -(1990:) show -59.4 526.4 moveto -12 f0 -( 99% ) show -31.5 513.1 moveto -12 f2 -(1990:) show -59.4 513.1 moveto -12 f0 -( Psyche Out ) show -120.3 513.1 moveto -12 f2 -(\(EP\)) show -142.9 513.1 moveto -12 f0 -( ) show -31.5 499.8 moveto -12 f2 -(1990:) show -59.4 499.8 moveto -12 f0 -( Now ) show -88.7 499.8 moveto -12 f2 -(\(EP\)) show -111.3 499.8 moveto -12 f0 -( ) show -31.5 486.5 moveto -12 f2 -(1992:) show -59.4 486.5 moveto -12 f0 -( Satryicon ) show -31.5 473.2 moveto -12 f2 -(1993:) show -59.4 473.2 moveto -12 f0 -( Peel Session ) show -125.7 473.2 moveto -12 f2 -(\(EP\)) show -148.3 473.2 moveto -12 f0 -( ) show -300 566.8 moveto -12 f2 -(UBL Card: ) show -357.3 566.8 moveto -12 f0 -(3626) show -381.3 566.8 moveto -12 f0 -( ) show -18.1 460.5 moveto -3.3 3.3 c fill -31.5 452.4 moveto -12 f1 -(Medicine) show -78.8 452.4 moveto -12 f0 -( ) show -31.5 439.1 moveto -12 f2 -(1993:) show -59.4 439.1 moveto -12 f0 -( The Buried Life ) show -31.5 425.8 moveto -12 f2 -(1994:) show -59.4 425.8 moveto -12 f0 -( Shot Forth Self Living ) show -298.1 452.9 moveto -12 f2 -(UBL Card: ) show -355.4 452.9 moveto -12 f0 -(1432) show -379.4 452.9 moveto -12 f0 -( ) show -298.1 439.6 moveto -12 f2 -(See also: ) show -344.7 439.6 moveto -12 f0 -(kspace.com) show -401 439.6 moveto -12 f0 -( ) show -18.1 413.1 moveto -3.3 3.3 c fill -31.5 405 moveto -12 f1 -(Mephisto Walz) show -109.1 405 moveto -12 f0 -( ) show -31.5 391.7 moveto -12 f2 -(1986-1992:) show -87.4 391.7 moveto -12 f0 -( Crocosmia ) show -31.5 378.4 moveto -12 f2 -(1993:) show -59.4 378.4 moveto -12 f0 -( Terra-Regina ) show -129.3 378.4 moveto -12 f2 -(\(comp\)) show -163.2 378.4 moveto -12 f0 -( ) show -31.5 365.1 moveto -12 f2 -(1994:) show -59.4 365.1 moveto -12 f0 -( The Eternal Deep ) show -31.5 351.8 moveto -12 f2 -(1995:) show -59.4 351.8 moveto -12 f0 -( Thalia ) show -18.1 339.1 moveto -3.3 3.3 c fill -31.5 331 moveto -12 f1 -(Midnight Oil) show -98.5 331 moveto -12 f0 -( ) show -31.5 317.7 moveto -12 f2 -(1979:) show -59.4 317.7 moveto -12 f0 -( Head Injuries ) show -31.5 304.4 moveto -12 f2 -(1981:) show -59.4 304.4 moveto -12 f0 -( Place without a Postcard ) show -31.5 291.1 moveto -12 f2 -(1983:) show -59.4 291.1 moveto -12 f0 -( 10, 9, 8, 7, 6, 5, 4, 3, 2, 1... ) show -31.5 277.8 moveto -12 f2 -(1985:) show -59.4 277.8 moveto -12 f0 -( Red Sails in the Sunset ) show -298.1 331.5 moveto -12 f2 -(UBL Card: ) show -355.4 331.5 moveto -12 f0 -(1102) show -379.4 331.5 moveto -12 f0 -( ) show -298.1 318.2 moveto -12 f2 -(See also: ) show -344.7 318.2 moveto -12 f0 -(www.stevens-tech.edu) show -453.3 318.2 moveto -12 f0 -( ) show -18.1 265.1 moveto -3.3 3.3 c fill -31.5 257 moveto -12 f1 -(Miller, Roger) show -100.8 257 moveto -12 f0 -( ) show -31.5 243.7 moveto -12 f2 -(1987:) show -59.4 243.7 moveto -12 f0 -( Maximum Electric Piano ) show -18.1 231 moveto -3.3 3.3 c fill -31.5 222.9 moveto -12 f1 -(Ministry) show -76.1 222.9 moveto -12 f0 -( ) show -31.5 209.6 moveto -12 f2 -(1983:) show -59.4 209.6 moveto -12 f0 -( With Sympathy ) show -31.5 196.3 moveto -12 f2 -(1984:) show -59.4 196.3 moveto -12 f0 -( Halloween Remix / The Nature of Outtakes) show -31.5 183 moveto -12 f2 -(\(EP\)) show -54.1 183 moveto -12 f0 -( ) show -31.5 169.7 moveto -12 f2 -(1981-1984:) show -87.4 169.7 moveto -12 f0 -( various singles ) show -31.5 156.4 moveto -12 f2 -(1985:) show -59.4 156.4 moveto -12 f0 -( Cold Life ) show -31.5 143.1 moveto -12 f2 -(1985:) show -59.4 143.1 moveto -12 f0 -( Over the Shoulder / Isle of Man ) show -218 143.1 moveto -12 f2 -(\(EP\)) show -240.6 143.1 moveto -12 f0 -( ) show -31.5 129.8 moveto -12 f2 -(1986:) show -59.4 129.8 moveto -12 f0 -( Twitch ) show -31.5 116.5 moveto -12 f2 -(1988:) show -59.4 116.5 moveto -12 f0 -( 12 Inch Singles ) show -140 116.5 moveto -12 f2 -(\(comp\)) show -173.9 116.5 moveto -12 f0 -( ) show -31.5 103.2 moveto -12 f2 -(1988:) show -59.4 103.2 moveto -12 f0 -( The Land of Rape and Honey ) show -31.5 89.9 moveto -12 f2 -(1988:) show -59.4 89.9 moveto -12 f0 -( Stigmata / Tonight we Murder ) show -211.3 89.9 moveto -12 f2 -(\(EP\)) show -233.9 89.9 moveto -12 f0 -( ) show -31.5 76.6 moveto -12 f2 -(1989:) show -59.4 76.6 moveto -12 f0 -( The Mind is a Terrible Thing to Taste ) show -298.1 223.4 moveto -12 f2 -(UBL Card: ) show -355.4 223.4 moveto -12 f0 -(1100) show -379.4 223.4 moveto -12 f0 -( ) show -298.1 210.1 moveto -12 f2 -(See also: ) show -344.7 210.1 moveto -12 f0 -(csclub.uwaterloo.ca) show -440 210.1 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 18 18 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1991:) show -59.4 709.2 moveto -12 f0 -( Jesus Built my Hotrod ) show -173 709.2 moveto -12 f2 -(\(EP\)) show -195.6 709.2 moveto -12 f0 -( ) show -31.5 695.9 moveto -12 f2 -(1992:) show -59.4 695.9 moveto -12 f0 -( Psalm 69 ) show -18.1 683.2 moveto -3.3 3.3 c fill -31.5 675.1 moveto -12 f1 -(Miranda Sex Garden) show -140.1 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1991:) show -59.4 661.8 moveto -12 f0 -( Gush Forth my Tears ) show -31.5 648.5 moveto -12 f2 -(1991:) show -59.4 648.5 moveto -12 f0 -( Madra ) show -31.5 635.2 moveto -12 f2 -(1992:) show -59.4 635.2 moveto -12 f0 -( Iris ) show -31.5 621.9 moveto -12 f2 -(1993:) show -59.4 621.9 moveto -12 f0 -( Suspiria ) show -31.5 608.6 moveto -12 f2 -(1994:) show -59.4 608.6 moveto -12 f0 -( Fairytales of Slavery ) show -298.1 675.6 moveto -12 f2 -(UBL Card: ) show -355.4 675.6 moveto -12 f0 -(3007) show -379.4 675.6 moveto -12 f0 -( ) show -298.1 662.3 moveto -12 f2 -(See also: ) show -344.7 662.3 moveto -12 f0 -(sksol1.physics.sunysb.edu) show -471 662.3 moveto -12 f0 -( ) show -18.1 595.9 moveto -3.3 3.3 c fill -31.5 587.8 moveto -12 f1 -(Missing Persons) show -114.5 587.8 moveto -12 f0 -( ) show -31.5 574.5 moveto -12 f2 -(1982:) show -59.4 574.5 moveto -12 f0 -( Missing Persons ) show -144.4 574.5 moveto -12 f2 -(\(EP\)) show -167 574.5 moveto -12 f0 -( ) show -31.5 561.2 moveto -12 f2 -(1982:) show -59.4 561.2 moveto -12 f0 -( Spring Session M ) show -31.5 547.9 moveto -12 f2 -(1984:) show -59.4 547.9 moveto -12 f0 -( Rhyme & Reason ) show -31.5 534.6 moveto -12 f2 -(1982-1984:) show -87.4 534.6 moveto -12 f0 -( Best of ) show -127.7 534.6 moveto -12 f2 -(\(comp\)) show -161.6 534.6 moveto -12 f0 -( ) show -18.1 521.9 moveto -3.3 3.3 c fill -31.5 513.8 moveto -12 f1 -(Mistle Thrush) show -104.5 513.8 moveto -12 f0 -( ) show -31.5 500.5 moveto -12 f2 -(199?:) show -59.4 500.5 moveto -12 f0 -( Silt ) show -31.5 487.2 moveto -12 f2 -(1994:) show -59.4 487.2 moveto -12 f0 -( Agus Am\340rach ) show -18.1 474.5 moveto -3.3 3.3 c fill -31.5 466.4 moveto -12 f1 -(Mission, The) show -97.5 466.4 moveto -12 f0 -( ) show -31.5 453.1 moveto -12 f2 -(1986:) show -59.4 453.1 moveto -12 f0 -( God's Own Medicine ) show -31.5 439.8 moveto -12 f2 -(1987:) show -59.4 439.8 moveto -12 f0 -( the First Chapter ) show -298.1 466.9 moveto -12 f2 -(UBL Card: ) show -355.4 466.9 moveto -12 f0 -(2045) show -379.4 466.9 moveto -12 f0 -( ) show -18.1 427.1 moveto -3.3 3.3 c fill -31.5 419 moveto -12 f1 -(Mission of Burma) show -123.5 419 moveto -12 f0 -( ) show -31.5 405.7 moveto -12 f2 -(1987:) show -59.4 405.7 moveto -12 f0 -( Forget ) show -18.1 393 moveto -3.3 3.3 c fill -31.5 384.9 moveto -12 f1 -(Morissette, Alanis) show -124.1 384.9 moveto -12 f0 -( ) show -31.5 371.6 moveto -12 f2 -(1995:) show -59.4 371.6 moveto -12 f0 -( Jagged Little Pill ) show -301 385.4 moveto -12 f2 -(UBL Card: ) show -358.3 385.4 moveto -12 f0 -(3127) show -382.3 385.4 moveto -12 f0 -( ) show -18.1 358.9 moveto -3.3 3.3 c fill -31.5 350.8 moveto -12 f1 -(Morrison, Patricia) show -126.8 350.8 moveto -12 f0 -( ) show -31.5 337.5 moveto -12 f2 -(1994:) show -59.4 337.5 moveto -12 f0 -( Reflect on This ) show -298.8 351.3 moveto -12 f2 -(UBL Card: ) show -356.1 351.3 moveto -12 f0 -(1062) show -380.1 351.3 moveto -12 f0 -( ) show -18.1 324.8 moveto -3.3 3.3 c fill -31.5 316.7 moveto -12 f1 -(Moyet, Allison) show -106.1 316.7 moveto -12 f0 -( ) show -31.5 303.4 moveto -12 f2 -(1985:) show -59.4 303.4 moveto -12 f0 -( ALF ) show -298.1 317.2 moveto -12 f2 -(UBL Card: ) show -355.4 317.2 moveto -12 f0 -(3410) show -379.4 317.2 moveto -12 f0 -( ) show -298.1 303.9 moveto -12 f2 -(See also: ) show -344.7 303.9 moveto -12 f0 -(rt66.com) show -387.6 303.9 moveto -12 f0 -( ) show -18.1 290.7 moveto -3.3 3.3 c fill -31.5 282.6 moveto -12 f1 -(Murder Inc.) show -94.8 282.6 moveto -12 f0 -( ) show -31.5 269.3 moveto -12 f2 -(1992:) show -59.4 269.3 moveto -12 f0 -( Murder Inc. ) show -18.1 256.6 moveto -3.3 3.3 c fill -31.5 248.5 moveto -12 f1 -(Mussolini Headkick) show -133.8 248.5 moveto -12 f0 -( ) show -31.5 235.2 moveto -12 f2 -(1990:) show -59.4 235.2 moveto -12 f0 -( Blood on the Flag ) show -18.1 222.5 moveto -3.3 3.3 c fill -31.5 214.4 moveto -12 f1 -(Murphy, Peter) show -107.4 214.4 moveto -12 f0 -( ) show -31.5 201.1 moveto -12 f2 -(1986:) show -59.4 201.1 moveto -12 f0 -( Should the World Fail to Fall Apart ) show -298.1 214.9 moveto -12 f2 -(UBL Card: ) show -355.4 214.9 moveto -12 f0 -(1235) show -379.4 214.9 moveto -12 f0 -( ) show -298.1 201.6 moveto -12 f2 -(See also: ) show -344.7 201.6 moveto -12 f0 -(gothic.acs.csulb.edu) show -441.6 201.6 moveto -12 f0 -( ) show -298.1 188.3 moveto -12 f2 -(See also: ) show -344.7 188.3 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 188.3 moveto -12 f0 -( ) show -18.1 175.6 moveto -3.3 3.3 c fill -31.5 167.5 moveto -12 f1 -(My Bloody Valentine) show -140.1 167.5 moveto -12 f0 -( ) show -31.5 154.2 moveto -12 f2 -(1988:) show -59.4 154.2 moveto -12 f0 -( Isn't Anything ) show -31.5 140.9 moveto -12 f2 -(1991:) show -59.4 140.9 moveto -12 f0 -( Loveless ) show -299.1 168 moveto -12 f2 -(UBL Card: ) show -356.4 168 moveto -12 f0 -(1912) show -380.4 168 moveto -12 f0 -( ) show -18.1 128.2 moveto -3.3 3.3 c fill -31.5 120.1 moveto -12 f1 -(My Life with the Thrill Kill Kult) show -198.8 120.1 moveto -12 f0 -( ) show -31.5 106.8 moveto -12 f2 -(1988:) show -59.4 106.8 moveto -12 f0 -( I See Good Spirits and I See Bad Spirits ) show -31.5 93.5 moveto -12 f2 -(1989:) show -59.4 93.5 moveto -12 f0 -( K00Ler than Jesus ) show -31.5 80.2 moveto -12 f2 -(1990:) show -59.4 80.2 moveto -12 f0 -( Confessions of a Knife... ) show -302.9 120.6 moveto -12 f2 -(UBL Card: ) show -360.2 120.6 moveto -12 f0 -(3478) show -384.2 120.6 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 19 19 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1990:) show -59.4 709.2 moveto -12 f0 -( Swine & Roses / Naive \(KMFDM\) ) show -233.7 709.2 moveto -12 f2 -(\(single\)) show -270.3 709.2 moveto -12 f0 -( ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Neither/Neither World) show -148.4 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1994:) show -59.4 675.1 moveto -12 f0 -( Tales of True Crime ) show -18.1 662.4 moveto -3.3 3.3 c fill -31.5 654.3 moveto -12 f1 -(Neotek) show -67.4 654.3 moveto -12 f0 -( ) show -31.5 641 moveto -12 f2 -(1995:) show -59.4 641 moveto -12 f0 -( Brain over Muscle ) show -18.1 628.3 moveto -3.3 3.3 c fill -31.5 620.2 moveto -12 f1 -(New Fast Automatic Daffodils) show -185.8 620.2 moveto -12 f0 -( ) show -31.5 606.9 moveto -12 f2 -(1991:) show -59.4 606.9 moveto -12 f0 -( Pigeonhole ) show -31.5 593.6 moveto -12 f2 -(1992:) show -59.4 593.6 moveto -12 f0 -( Bong ) show -18.1 580.9 moveto -3.3 3.3 c fill -31.5 572.8 moveto -12 f1 -(New Order) show -89.1 572.8 moveto -12 f0 -( ) show -31.5 559.5 moveto -12 f2 -(1981:) show -59.4 559.5 moveto -12 f0 -( Movement ) show -31.5 546.2 moveto -12 f2 -(1981:) show -59.4 546.2 moveto -12 f0 -( Temptation / Hurt ) show -152 546.2 moveto -12 f2 -(\(single\)) show -188.6 546.2 moveto -12 f0 -( ) show -31.5 532.9 moveto -12 f2 -(1982:) show -59.4 532.9 moveto -12 f0 -( Factus 8 ) show -31.5 519.6 moveto -12 f2 -(1984:) show -59.4 519.6 moveto -12 f0 -( Power, Corruption, and Lies ) show -31.5 506.3 moveto -12 f2 -(1984:) show -59.4 506.3 moveto -12 f0 -( Blue Monday ) show -131 506.3 moveto -12 f2 -(\(single\)) show -167.6 506.3 moveto -12 f0 -( ) show -31.5 493 moveto -12 f2 -(1985:) show -59.4 493 moveto -12 f0 -( The Perfect Kiss ) show -145.3 493 moveto -12 f2 -(\(single\)) show -181.9 493 moveto -12 f0 -( ) show -31.5 479.7 moveto -12 f2 -(1985:) show -59.4 479.7 moveto -12 f0 -( Confusion ) show -115.4 479.7 moveto -12 f2 -(\(single\)) show -152 479.7 moveto -12 f0 -( ) show -31.5 466.4 moveto -12 f2 -(1985:) show -59.4 466.4 moveto -12 f0 -( Low Life ) show -31.5 453.1 moveto -12 f2 -(1983-5:) show -69.4 453.1 moveto -12 f0 -( various singles ) show -31.5 439.8 moveto -12 f2 -(1986:) show -59.4 439.8 moveto -12 f0 -( Brotherhood ) show -298.1 573.3 moveto -12 f2 -(UBL Card: ) show -355.4 573.3 moveto -12 f0 -(1126) show -379.4 573.3 moveto -12 f0 -( ) show -298.1 560 moveto -12 f2 -(See also: ) show -344.7 560 moveto -12 f0 -(topquark.cecer.army.mil) show -462.3 560 moveto -12 f0 -( ) show -18.1 427.1 moveto -3.3 3.3 c fill -31.5 419 moveto -12 f1 -(Nine Inch Nails) show -110.8 419 moveto -12 f0 -( ) show -31.5 405.7 moveto -12 f2 -(1989:) show -59.4 405.7 moveto -12 f0 -( Pretty Hate Machine ) show -31.5 392.4 moveto -12 f2 -(1989:) show -59.4 392.4 moveto -12 f0 -( Head Like a Hole ) show -150.3 392.4 moveto -12 f2 -(\(remixes\)) show -195.6 392.4 moveto -12 f0 -( ) show -31.5 379.1 moveto -12 f2 -(1990:) show -59.4 379.1 moveto -12 f0 -( Sin ) show -81.4 379.1 moveto -12 f2 -(\(remixes\)) show -126.7 379.1 moveto -12 f0 -( ) show -31.5 365.8 moveto -12 f2 -(1992:) show -59.4 365.8 moveto -12 f0 -( Broken ) show -100.7 365.8 moveto -12 f2 -(\(EP\)) show -123.3 365.8 moveto -12 f0 -( ) show -31.5 352.5 moveto -12 f2 -(1992:) show -59.4 352.5 moveto -12 f0 -( Fixed ) show -92.7 352.5 moveto -12 f2 -(\(remixes\)) show -138 352.5 moveto -12 f0 -( ) show -31.5 339.2 moveto -12 f2 -(1994:) show -59.4 339.2 moveto -12 f0 -( March of the Pigs ) show -151 339.2 moveto -12 f2 -(\(EP\)) show -173.6 339.2 moveto -12 f0 -( ) show -31.5 325.9 moveto -12 f2 -(1994:) show -59.4 325.9 moveto -12 f0 -( The Downward Spiral ) show -31.5 312.6 moveto -12 f2 -(1994:) show -59.4 312.6 moveto -12 f0 -( Closer to God ) show -132.7 312.6 moveto -12 f2 -(\(EP\)) show -155.3 312.6 moveto -12 f0 -( ) show -31.5 299.3 moveto -12 f2 -(1994:) show -59.4 299.3 moveto -12 f0 -( Closer \(Further Away\) ) show -174.7 299.3 moveto -12 f2 -(\(EP\)) show -197.3 299.3 moveto -12 f0 -( ) show -31.5 286 moveto -12 f2 -(1994:) show -59.4 286 moveto -12 f0 -( Further Down the Spiral ) show -182.3 286 moveto -12 f2 -(\(remixes\)) show -227.6 286 moveto -12 f0 -( ) show -298.1 419.5 moveto -12 f2 -(UBL Card: ) show -355.4 419.5 moveto -12 f0 -(1046) show -379.4 419.5 moveto -12 f0 -( ) show -298.1 406.2 moveto -12 f2 -(See also: ) show -344.7 406.2 moveto -12 f0 -(www.scri.fsu.edu) show -429 406.2 moveto -12 f0 -( ) show -298.1 392.9 moveto -12 f2 -(See also: ) show -344.7 392.9 moveto -12 f0 -(metaverse.com) show -417 392.9 moveto -12 f0 -( ) show -18.1 273.3 moveto -3.3 3.3 c fill -31.5 265.2 moveto -12 f1 -(Nirvana) show -73.5 265.2 moveto -12 f0 -( ) show -31.5 251.9 moveto -12 f2 -(1991:) show -59.4 251.9 moveto -12 f0 -( Nevermind ) show -298.1 265.7 moveto -12 f2 -(UBL Card: ) show -355.4 265.7 moveto -12 f0 -(1052) show -379.4 265.7 moveto -12 f0 -( ) show -298.1 252.4 moveto -12 f2 -(See also: ) show -344.7 252.4 moveto -12 f0 -(www.ludd.luth.se) show -429.6 252.4 moveto -12 f0 -( ) show -298.1 239.1 moveto -12 f2 -(See also: ) show -344.7 239.1 moveto -12 f0 -(home.earthlink.net) show -434.7 239.1 moveto -12 f0 -( ) show -18.1 226.4 moveto -3.3 3.3 c fill -31.5 218.3 moveto -12 f1 -(Nitzer Ebb) show -87.8 218.3 moveto -12 f0 -( ) show -31.5 205 moveto -12 f2 -(1987:) show -59.4 205 moveto -12 f0 -( That Total Age ) show -31.5 191.7 moveto -12 f2 -(1987:) show -59.4 191.7 moveto -12 f0 -( Warsaw Ghetto ) show -140.3 191.7 moveto -12 f2 -(\(EP\)) show -162.9 191.7 moveto -12 f0 -( ) show -31.5 178.4 moveto -12 f2 -(1987:) show -59.4 178.4 moveto -12 f0 -( So Bright So Strong ) show -162.4 178.4 moveto -12 f2 -(\(remixes\)) show -207.7 178.4 moveto -12 f0 -( ) show -31.5 165.1 moveto -12 f2 -(1987:) show -59.4 165.1 moveto -12 f0 -( Get Clean ) show -113.7 165.1 moveto -12 f2 -(\(remixes\)) show -159 165.1 moveto -12 f0 -( ) show -31.5 151.8 moveto -12 f2 -(1988:) show -59.4 151.8 moveto -12 f0 -( Control: I'm Here ) show -152 151.8 moveto -12 f2 -(\(single\)) show -188.6 151.8 moveto -12 f0 -( ) show -31.5 138.5 moveto -12 f2 -(1989:) show -59.4 138.5 moveto -12 f0 -( Hearts and Minds ) show -150.7 138.5 moveto -12 f2 -(\(single\)) show -187.3 138.5 moveto -12 f0 -( ) show -31.5 125.2 moveto -12 f2 -(1989:) show -59.4 125.2 moveto -12 f0 -( Belief ) show -31.5 111.9 moveto -12 f2 -(1990:) show -59.4 111.9 moveto -12 f0 -( Showtime ) show -31.5 98.6 moveto -12 f2 -(1991:) show -59.4 98.6 moveto -12 f0 -( I Give to You ) show -131.7 98.6 moveto -12 f2 -(\(single\)) show -168.3 98.6 moveto -12 f0 -( ) show -31.5 85.3 moveto -12 f2 -(1991:) show -59.4 85.3 moveto -12 f0 -( As Is ) show -90.3 85.3 moveto -12 f2 -(\(single\)) show -126.9 85.3 moveto -12 f0 -( ) show -298.1 218.8 moveto -12 f2 -(UBL Card: ) show -355.4 218.8 moveto -12 f0 -(1164) show -379.4 218.8 moveto -12 f0 -( ) show -298.1 205.5 moveto -12 f2 -(See also: ) show -344.7 205.5 moveto -12 f0 -(www.eecs.nwu.edu) show -438.3 205.5 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 20 20 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1991:) show -59.4 709.2 moveto -12 f0 -( Ebbhead ) show -31.5 695.9 moveto -12 f2 -(1991:) show -59.4 695.9 moveto -12 f0 -( Godhead ) show -108.7 695.9 moveto -12 f2 -(\(EP\)) show -131.3 695.9 moveto -12 f0 -( ) show -18.1 683.2 moveto -3.3 3.3 c fill -31.5 675.1 moveto -12 f1 -(No Doubt) show -81.1 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1995:) show -59.4 661.8 moveto -12 f0 -( Tragic Kingdom ) show -18.1 649.1 moveto -3.3 3.3 c fill -31.5 641 moveto -12 f1 -(Noise Unit) show -85.1 641 moveto -12 f0 -( ) show -31.5 627.7 moveto -12 f2 -(1989:) show -59.4 627.7 moveto -12 f0 -( Grinding Into Emptiness ) show -18.1 615 moveto -3.3 3.3 c fill -31.5 606.9 moveto -12 f1 -(Nosferatu) show -82.1 606.9 moveto -12 f0 -( ) show -31.5 593.6 moveto -12 f2 -(1993:) show -59.4 593.6 moveto -12 f0 -( Rise ) show -18.1 580.9 moveto -3.3 3.3 c fill -31.5 572.8 moveto -12 f1 -(Numan, Gary) show -102.1 572.8 moveto -12 f0 -( ) show -31.5 559.5 moveto -12 f2 -(1978:) show -59.4 559.5 moveto -12 f0 -( Tubeway Army ) show -31.5 546.2 moveto -12 f2 -(1978:) show -59.4 546.2 moveto -12 f0 -( The Plan ) show -31.5 532.9 moveto -12 f2 -(1979:) show -59.4 532.9 moveto -12 f0 -( Replicas ) show -31.5 519.6 moveto -12 f2 -(1979:) show -59.4 519.6 moveto -12 f0 -( The Pleasure Principle ) show -31.5 506.3 moveto -12 f2 -(1980:) show -59.4 506.3 moveto -12 f0 -( Telekon ) show -31.5 493 moveto -12 f2 -(1981:) show -59.4 493 moveto -12 f0 -( Warriors ) show -31.5 479.7 moveto -12 f2 -(1981:) show -59.4 479.7 moveto -12 f0 -( Dance ) show -31.5 466.4 moveto -12 f2 -(1982:) show -59.4 466.4 moveto -12 f0 -( I, Assassin ) show -31.5 453.1 moveto -12 f2 -(1984:) show -59.4 453.1 moveto -12 f0 -( White Noise ) show -125.7 453.1 moveto -12 f2 -(\(double live\)) show -186.6 453.1 moveto -12 f0 -( ) show -31.5 439.8 moveto -12 f2 -(1987:) show -59.4 439.8 moveto -12 f0 -( Ghost ) show -94 439.8 moveto -12 f2 -(\(double live\)) show -154.9 439.8 moveto -12 f0 -( ) show -298.1 573.3 moveto -12 f2 -(UBL Card: ) show -355.4 573.3 moveto -12 f0 -(1409) show -379.4 573.3 moveto -12 f0 -( ) show -18.1 427.1 moveto -3.3 3.3 c fill -31.5 419 moveto -12 f1 -(Offspring) show -81.5 419 moveto -12 f0 -( ) show -31.5 405.7 moveto -12 f2 -(1994:) show -59.4 405.7 moveto -12 f0 -( Smash ) show -18.1 393 moveto -3.3 3.3 c fill -31.5 384.9 moveto -12 f1 -(Oingo Boingo) show -101.8 384.9 moveto -12 f0 -( ) show -31.5 371.6 moveto -12 f2 -(1980:) show -59.4 371.6 moveto -12 f0 -( Forbidden Zone ) show -142.3 371.6 moveto -12 f2 -(\(soundtrack\)) show -203.6 371.6 moveto -12 f0 -( ) show -31.5 358.3 moveto -12 f2 -(1981:) show -59.4 358.3 moveto -12 f0 -( Only a Lad ) show -31.5 345 moveto -12 f2 -(1983:) show -59.4 345 moveto -12 f0 -( Good for Your Soul ) show -31.5 331.7 moveto -12 f2 -(1986:) show -59.4 331.7 moveto -12 f0 -( Dead Man's Party ) show -31.5 318.4 moveto -12 f2 -(1987:) show -59.4 318.4 moveto -12 f0 -( Nothing to Fear ) show -298.1 385.4 moveto -12 f2 -(UBL Card: ) show -355.4 385.4 moveto -12 f0 -(1089) show -379.4 385.4 moveto -12 f0 -( ) show -298.1 372.1 moveto -12 f2 -(See also: ) show -344.7 372.1 moveto -12 f0 -(rhino.harvard.edu) show -430 372.1 moveto -12 f0 -( ) show -18.1 305.7 moveto -3.3 3.3 c fill -31.5 297.6 moveto -12 f1 -(Orb, The) show -78.8 297.6 moveto -12 f0 -( ) show -31.5 284.3 moveto -12 f2 -(1991:) show -59.4 284.3 moveto -12 f0 -( The Orb's Adventures Beyond the Ultraworld ) show -31.5 271 moveto -12 f2 -(1991:) show -59.4 271 moveto -12 f0 -( Aubrey Mixes, the Ultraworld Excursions ) show -31.5 257.7 moveto -12 f2 -(1991:) show -59.4 257.7 moveto -12 f0 -( Little Fluffy Clouds ) show -161.4 257.7 moveto -12 f2 -(\(EP\)) show -184 257.7 moveto -12 f0 -( ) show -31.5 244.4 moveto -12 f2 -(1992:) show -59.4 244.4 moveto -12 f0 -( U.F.Orb ) show -31.5 231.1 moveto -12 f2 -(1993:) show -59.4 231.1 moveto -12 f0 -( live 93 ) show -98.4 231.1 moveto -12 f2 -(\(double live\)) show -159.3 231.1 moveto -12 f0 -( ) show -31.5 217.8 moveto -12 f2 -(1994:) show -59.4 217.8 moveto -12 f0 -( Pomme Fritz ) show -298.1 298.1 moveto -12 f2 -(UBL Card: ) show -355.4 298.1 moveto -12 f0 -(1121) show -379.4 298.1 moveto -12 f0 -( ) show -298.1 284.8 moveto -12 f2 -(See also: ) show -344.7 284.8 moveto -12 f0 -(www.hyperlink.com) show -443.3 284.8 moveto -12 f0 -( ) show -298.1 271.5 moveto -12 f2 -(See also: ) show -344.7 271.5 moveto -12 f0 -(www.phlab.missouri.edu) show -465 271.5 moveto -12 f0 -( ) show -298.1 258.2 moveto -12 f2 -(See also: ) show -344.7 258.2 moveto -12 f0 -(rt66.com) show -387.6 258.2 moveto -12 f0 -( ) show -18.1 205.1 moveto -3.3 3.3 c fill -31.5 197 moveto -12 f1 -(Orbital) show -69.5 197 moveto -12 f0 -( ) show -31.5 183.7 moveto -12 f2 -(1993:) show -59.4 183.7 moveto -12 f0 -( Orbital 2 ) show -298.1 197.5 moveto -12 f2 -(UBL Card: ) show -355.4 197.5 moveto -12 f0 -(2049) show -379.4 197.5 moveto -12 f0 -( ) show -298.1 184.2 moveto -12 f2 -(See also: ) show -344.7 184.2 moveto -12 f0 -(rt66.com) show -387.6 184.2 moveto -12 f0 -( ) show -18.1 171 moveto -3.3 3.3 c fill -31.5 162.9 moveto -12 f1 -(Orchestral Manoeuvers in the Dark) show -214.8 162.9 moveto -12 f0 -( ) show -31.5 149.6 moveto -12 f2 -(1980:) show -59.4 149.6 moveto -12 f0 -( OMD ) show -93.3 149.6 moveto -12 f2 -(\(US release\)) show -153.6 149.6 moveto -12 f0 -( ) show -31.5 136.3 moveto -12 f2 -(1980:) show -59.4 136.3 moveto -12 f0 -( OMD ) show -93.3 136.3 moveto -12 f2 -(\(UK release\)) show -155.6 136.3 moveto -12 f0 -( ) show -31.5 123 moveto -12 f2 -(1981:) show -59.4 123 moveto -12 f0 -( Bunker Soldiers ) show -31.5 109.7 moveto -12 f2 -(1981:) show -59.4 109.7 moveto -12 f0 -( Architecture & Morality ) show -31.5 96.4 moveto -12 f2 -(1983:) show -59.4 96.4 moveto -12 f0 -( Dazzle Ships ) show -31.5 83.1 moveto -12 f2 -(1984:) show -59.4 83.1 moveto -12 f0 -( Junk Culture ) show -304.9 163.4 moveto -12 f2 -(UBL Card: ) show -362.2 163.4 moveto -12 f0 -(5370) show -386.2 163.4 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 21 21 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1985:) show -59.4 709.2 moveto -12 f0 -( Crush ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Oxygiene 23) show -94.5 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1995:) show -59.4 675.1 moveto -12 f0 -( Blue ) show -18.1 662.4 moveto -3.3 3.3 c fill -31.5 654.3 moveto -12 f1 -(187 Calm) show -80.4 654.3 moveto -12 f0 -( ) show -31.5 641 moveto -12 f2 -(1995:) show -59.4 641 moveto -12 f0 -( One Eighty Seven Calm ) show -181.7 641 moveto -12 f2 -(\(EP\)) show -204.3 641 moveto -12 f0 -( ) show -18.1 628.3 moveto -3.3 3.3 c fill -31.5 620.2 moveto -12 f1 -(1000 Homo DJs) show -112.1 620.2 moveto -12 f0 -( ) show -31.5 606.9 moveto -12 f2 -(1990:) show -59.4 606.9 moveto -12 f0 -( Supernaut ) show -114 606.9 moveto -12 f2 -(\(EP\)) show -136.6 606.9 moveto -12 f0 -( ) show -18.1 594.2 moveto -3.3 3.3 c fill -31.5 586.1 moveto -12 f1 -(Opus III) show -75.8 586.1 moveto -12 f0 -( ) show -31.5 572.8 moveto -12 f2 -(1991:) show -59.4 572.8 moveto -12 f0 -( Mind Fruit ) show -31.5 559.5 moveto -12 f2 -(1994:) show -59.4 559.5 moveto -12 f0 -( Guru Mother ) show -18.1 546.8 moveto -3.3 3.3 c fill -31.5 538.7 moveto -12 f1 -(Pain Teens) show -87.8 538.7 moveto -12 f0 -( ) show -31.5 525.4 moveto -12 f2 -(1990:) show -59.4 525.4 moveto -12 f0 -( Born in Blood / Case Histories ) show -31.5 512.1 moveto -12 f2 -(1992:) show -59.4 512.1 moveto -12 f0 -( Stimulation Festival ) show -31.5 498.8 moveto -12 f2 -(1993:) show -59.4 498.8 moveto -12 f0 -( Destroy Me, Lover ) show -31.5 485.5 moveto -12 f2 -(1995:) show -59.4 485.5 moveto -12 f0 -( Beast of Dreams ) show -18.1 472.8 moveto -3.3 3.3 c fill -31.5 464.7 moveto -12 f1 -(Paralysed Age) show -105.1 464.7 moveto -12 f0 -( ) show -31.5 451.4 moveto -12 f2 -(1994:) show -59.4 451.4 moveto -12 f0 -( Nocturne ) show -18.1 438.7 moveto -3.3 3.3 c fill -31.5 430.6 moveto -12 f1 -(Pigface) show -68.8 430.6 moveto -12 f0 -( ) show -31.5 417.3 moveto -12 f2 -(1990:) show -59.4 417.3 moveto -12 f0 -( Gub ) show -298.1 431.1 moveto -12 f2 -(UBL Card: ) show -355.4 431.1 moveto -12 f0 -(1165) show -379.4 431.1 moveto -12 f0 -( ) show -298.1 417.8 moveto -12 f2 -(See also: ) show -344.7 417.8 moveto -12 f0 -(www.eecs.nwu.edu) show -438.3 417.8 moveto -12 f0 -( ) show -18.1 404.6 moveto -3.3 3.3 c fill -31.5 396.5 moveto -12 f1 -(Pink Floyd) show -87.8 396.5 moveto -12 f0 -( ) show -31.5 383.2 moveto -12 f2 -(1973:) show -59.4 383.2 moveto -12 f0 -( Dark Side of the Moon ) show -31.5 369.9 moveto -12 f2 -(1975:) show -59.4 369.9 moveto -12 f0 -( Wish You were Here ) show -31.5 356.6 moveto -12 f2 -(1978:) show -59.4 356.6 moveto -12 f0 -( The Wall ) show -110.3 356.6 moveto -12 f2 -(\(double soundtrack\)) show -207.2 356.6 moveto -12 f0 -( ) show -31.5 343.3 moveto -12 f2 -(1981:) show -59.4 343.3 moveto -12 f0 -( A Collection of Great Dance Songs ) show -235.7 343.3 moveto -12 f2 -(\(comp\)) show -269.6 343.3 moveto -12 f0 -( ) show -31.5 330 moveto -12 f2 -(1995:) show -59.4 330 moveto -12 f0 -( A Saucerful of Pink: a Tribute ) show -211 330 moveto -12 f2 -(\(double, various\)) show -293.6 330 moveto -12 f0 -( ) show -302.4 397 moveto -12 f2 -(UBL Card: ) show -359.7 397 moveto -12 f0 -(1008) show -383.7 397 moveto -12 f0 -( ) show -18.1 317.3 moveto -3.3 3.3 c fill -31.5 309.2 moveto -12 f1 -(Polygon Window) show -119.1 309.2 moveto -12 f0 -( ) show -31.5 295.9 moveto -12 f2 -(1993:) show -59.4 295.9 moveto -12 f0 -( Surfing on Sine Waves ) show -298.1 309.7 moveto -12 f2 -(UBL Card: ) show -355.4 309.7 moveto -12 f0 -(5279) show -379.4 309.7 moveto -12 f0 -( ) show -18.1 283.2 moveto -3.3 3.3 c fill -31.5 275.1 moveto -12 f1 -(Police) show -62.1 275.1 moveto -12 f0 -( ) show -31.5 261.8 moveto -12 f2 -(1979:) show -59.4 261.8 moveto -12 f0 -( Outlandos D'Amour ) show -31.5 248.5 moveto -12 f2 -(1980:) show -59.4 248.5 moveto -12 f0 -( Ghost in the Machine ) show -31.5 235.2 moveto -12 f2 -(1981:) show -59.4 235.2 moveto -12 f0 -( Zenyatta Mondatta ) show -31.5 221.9 moveto -12 f2 -(1983:) show -59.4 221.9 moveto -12 f0 -( Synchronicity ) show -306.4 275.6 moveto -12 f2 -(UBL Card: ) show -363.7 275.6 moveto -12 f0 -(1172) show -387.7 275.6 moveto -12 f0 -( ) show -18.1 209.2 moveto -3.3 3.3 c fill -31.5 201.1 moveto -12 f1 -(Poe) show -50.1 201.1 moveto -12 f0 -( ) show -31.5 187.8 moveto -12 f2 -(1995:) show -59.4 187.8 moveto -12 f0 -( Hello ) show -18.1 175.1 moveto -3.3 3.3 c fill -31.5 167 moveto -12 f1 -(Pop, Iggy) show -80.1 167 moveto -12 f0 -( ) show -31.5 153.7 moveto -12 f2 -(1977:) show -59.4 153.7 moveto -12 f0 -( Lust for Life ) show -298.1 167.5 moveto -12 f2 -(UBL Card: ) show -355.4 167.5 moveto -12 f0 -(4345) show -379.4 167.5 moveto -12 f0 -( ) show -18.1 141 moveto -3.3 3.3 c fill -31.5 132.9 moveto -12 f1 -(Powerman 5000) show -113.8 132.9 moveto -12 f0 -( ) show -31.5 119.6 moveto -12 f2 -(1995:) show -59.4 119.6 moveto -12 f0 -( The Blood Splat Rating System ) show -18.1 106.9 moveto -3.3 3.3 c fill -31.5 98.8 moveto -12 f1 -(Powerstation, The) show -124.8 98.8 moveto -12 f0 -( ) show -31.5 85.5 moveto -12 f2 -(1985:) show -59.4 85.5 moveto -12 f0 -( The Powerstation ) show -306.4 99.3 moveto -12 f2 -(UBL Card: ) show -363.7 99.3 moveto -12 f0 -(1259) show -387.7 99.3 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 22 22 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 716.6 moveto -3.3 3.3 c fill -31.5 708.5 moveto -12 f1 -(Pram) show -60.1 708.5 moveto -12 f0 -( ) show -31.5 695.2 moveto -12 f2 -(199?:) show -59.4 695.2 moveto -12 f0 -( Iron Lung ) show -113.7 695.2 moveto -12 f2 -(\(EP\)) show -136.3 695.2 moveto -12 f0 -( ) show -31.5 681.9 moveto -12 f2 -(1995:) show -59.4 681.9 moveto -12 f0 -( Helium ) show -31.5 668.6 moveto -12 f2 -(1995:) show -59.4 668.6 moveto -12 f0 -( Sargasso Sea ) show -18.1 655.9 moveto -3.3 3.3 c fill -31.5 647.8 moveto -12 f1 -(Prick) show -59.4 647.8 moveto -12 f0 -( ) show -31.5 634.5 moveto -12 f2 -(1995:) show -59.4 634.5 moveto -12 f0 -( Prick ) show -298.1 648.3 moveto -12 f2 -(UBL Card: ) show -355.4 648.3 moveto -12 f0 -(3683) show -379.4 648.3 moveto -12 f0 -( ) show -18.1 621.8 moveto -3.3 3.3 c fill -31.5 613.7 moveto -12 f1 -(Primus) show -68.8 613.7 moveto -12 f0 -( ) show -31.5 600.4 moveto -12 f2 -(1991:) show -59.4 600.4 moveto -12 f0 -( Sailing on the Seas of Cheese ) show -298.1 614.2 moveto -12 f2 -(UBL Card: ) show -355.4 614.2 moveto -12 f0 -(1055) show -379.4 614.2 moveto -12 f0 -( ) show -18.1 587.7 moveto -3.3 3.3 c fill -31.5 579.6 moveto -12 f1 -(Project Pitchfork) show -120.4 579.6 moveto -12 f0 -( ) show -31.5 566.3 moveto -12 f2 -(1991:) show -59.4 566.3 moveto -12 f0 -( Dhyani ) show -18.1 553.6 moveto -3.3 3.3 c fill -31.5 545.5 moveto -12 f1 -(Propaganda) show -94.1 545.5 moveto -12 f0 -( ) show -31.5 532.2 moveto -12 f2 -(1985:) show -59.4 532.2 moveto -12 f0 -( A Secret Wish, US version ) show -31.5 518.9 moveto -12 f2 -(1985:) show -59.4 518.9 moveto -12 f0 -( A Secret Wish, UK version ) show -197 518.9 moveto -12 f2 -(\(remixes\)) show -242.3 518.9 moveto -12 f0 -( ) show -31.5 505.6 moveto -12 f2 -(1985:) show -59.4 505.6 moveto -12 f0 -( p:machinery \(polish / passive\) / Frozen Faces) show -31.5 492.3 moveto -12 f2 -(\(single\)) show -68.1 492.3 moveto -12 f0 -( ) show -31.5 479 moveto -12 f2 -(1985:) show -59.4 479 moveto -12 f0 -( Duel / Jewel ) show -125.3 479 moveto -12 f2 -(\(single\)) show -161.9 479 moveto -12 f0 -( ) show -31.5 465.7 moveto -12 f2 -(1985:) show -59.4 465.7 moveto -12 f0 -( Wishful Thinking ) show -151 465.7 moveto -12 f2 -(\(remixes\)) show -196.3 465.7 moveto -12 f0 -( ) show -31.5 452.4 moveto -12 f2 -(1990:) show -59.4 452.4 moveto -12 f0 -( Heaven Give Me Words ) show -182.3 452.4 moveto -12 f2 -(\(EP\)) show -204.9 452.4 moveto -12 f0 -( ) show -31.5 439.1 moveto -12 f2 -(1995:) show -59.4 439.1 moveto -12 f0 -( p:machinery t-empo remix ) show -193.3 439.1 moveto -12 f2 -(\(single\)) show -229.9 439.1 moveto -12 f0 -( ) show -298.1 546 moveto -12 f2 -(UBL Card: ) show -355.4 546 moveto -12 f0 -(4636) show -379.4 546 moveto -12 f0 -( ) show -298.1 532.7 moveto -12 f2 -(See also: ) show -344.7 532.7 moveto -12 f0 -(rt66.com) show -387.6 532.7 moveto -12 f0 -( ) show -298.1 519.4 moveto -12 f2 -(See also: ) show -344.7 519.4 moveto -12 f0 -(hcl.chass.ncsu.edu) show -433.6 519.4 moveto -12 f0 -( ) show -18.1 426.4 moveto -3.3 3.3 c fill -31.5 418.3 moveto -12 f1 -(Prophetess, The) show -113.4 418.3 moveto -12 f0 -( ) show -31.5 405 moveto -12 f2 -(1993:) show -59.4 405 moveto -12 f0 -( The Prophetess ) show -18.1 392.3 moveto -3.3 3.3 c fill -31.5 384.2 moveto -12 f1 -(Public Image Limited) show -142.8 384.2 moveto -12 f0 -( ) show -31.5 370.9 moveto -12 f2 -(1985:) show -59.4 370.9 moveto -12 f0 -( Album ) show -18.1 358.2 moveto -3.3 3.3 c fill -31.5 350.1 moveto -12 f1 -(Rage Against the Machine) show -166.4 350.1 moveto -12 f0 -( ) show -31.5 336.8 moveto -12 f2 -(1992:) show -59.4 336.8 moveto -12 f0 -( Rage Against the Machine ) show -298.1 350.6 moveto -12 f2 -(UBL Card: ) show -355.4 350.6 moveto -12 f0 -(1424) show -379.4 350.6 moveto -12 f0 -( ) show -18.1 324.1 moveto -3.3 3.3 c fill -31.5 316 moveto -12 f1 -(Romeo Void) show -95.1 316 moveto -12 f0 -( ) show -31.5 302.7 moveto -12 f2 -(1981:) show -59.4 302.7 moveto -12 f0 -( Never Say Never / Present Tense ) show -224.3 302.7 moveto -12 f2 -(\(single\)) show -260.9 302.7 moveto -12 f0 -( ) show -18.1 290 moveto -3.3 3.3 c fill -31.5 281.9 moveto -12 f1 -(Blaine Reininger) show -117.8 281.9 moveto -12 f0 -( ) show -31.5 268.6 moveto -12 f2 -(1989:) show -59.4 268.6 moveto -12 f0 -( Expatriate Journals ) show -18.1 255.9 moveto -3.3 3.3 c fill -31.5 247.8 moveto -12 f1 -(Red Aunts) show -85.8 247.8 moveto -12 f0 -( ) show -31.5 234.5 moveto -12 f2 -(1993:) show -59.4 234.5 moveto -12 f0 -( Drag ) show -31.5 221.2 moveto -12 f2 -(1994:) show -59.4 221.2 moveto -12 f0 -( Bad Motherfucker 400-Z ) show -31.5 207.9 moveto -12 f2 -(1995:) show -59.4 207.9 moveto -12 f0 -( #1 Chicken ) show -306 248.3 moveto -12 f2 -(UBL Card: ) show -363.3 248.3 moveto -12 f0 -(4619) show -387.3 248.3 moveto -12 f0 -( ) show -18.1 195.2 moveto -3.3 3.3 c fill -31.5 187.1 moveto -12 f1 -(Re-Flex) show -71.4 187.1 moveto -12 f0 -( ) show -31.5 173.8 moveto -12 f2 -(1983:) show -59.4 173.8 moveto -12 f0 -( The Politics of Dancing / Re-Flex It ) show -238 173.8 moveto -12 f2 -(\(single\)) show -274.6 173.8 moveto -12 f0 -( ) show -18.1 161.1 moveto -3.3 3.3 c fill -31.5 153 moveto -12 f1 -(Revolting Cocks) show -115.1 153 moveto -12 f0 -( ) show -31.5 139.7 moveto -12 f2 -(1986:) show -59.4 139.7 moveto -12 f0 -( Big Sexy Land ) show -31.5 126.4 moveto -12 f2 -(1988:) show -59.4 126.4 moveto -12 f0 -( You Goddamned Son of a Bitch ) show -219.7 126.4 moveto -12 f2 -(\(double live\)) show -280.6 126.4 moveto -12 f0 -( ) show -31.5 113.1 moveto -12 f2 -(1989:) show -59.4 113.1 moveto -12 f0 -( Stainless Steel Providers ) show -184 113.1 moveto -12 f2 -(\(EP\)) show -206.6 113.1 moveto -12 f0 -( ) show -31.5 99.8 moveto -12 f2 -(1990:) show -59.4 99.8 moveto -12 f0 -( Beers, Steers, and Queers ) show -31.5 86.5 moveto -12 f2 -(1993:) show -59.4 86.5 moveto -12 f0 -( Linger Ficken' Good ) show -303 153.5 moveto -12 f2 -(UBL Card: ) show -360.3 153.5 moveto -12 f0 -(1100) show -384.3 153.5 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 23 23 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 716.6 moveto -3.3 3.3 c fill -31.5 708.5 moveto -12 f1 -(Ridgway, Stan) show -106.1 708.5 moveto -12 f0 -( ) show -31.5 695.2 moveto -12 f2 -(1986:) show -59.4 695.2 moveto -12 f0 -( The Big Heat ) show -298.1 709 moveto -12 f2 -(UBL Card: ) show -355.4 709 moveto -12 f0 -(2904) show -379.4 709 moveto -12 f0 -( ) show -18.1 682.5 moveto -3.3 3.3 c fill -31.5 674.4 moveto -12 f1 -(Rosemarys, The) show -114.1 674.4 moveto -12 f0 -( ) show -31.5 661.1 moveto -12 f2 -(1993:) show -59.4 661.1 moveto -12 f0 -( Providence ) show -18.1 648.4 moveto -3.3 3.3 c fill -31.5 640.3 moveto -12 f1 -(Rosetta Stone) show -101.8 640.3 moveto -12 f0 -( ) show -31.5 627 moveto -12 f2 -(1993:) show -59.4 627 moveto -12 f0 -( Adrenaline ) show -31.5 613.7 moveto -12 f2 -(1995:) show -59.4 613.7 moveto -12 f0 -( The Tyrrany of Inaction ) show -18.1 601 moveto -3.3 3.3 c fill -31.5 592.9 moveto -12 f1 -(Ruby) show -59.5 592.9 moveto -12 f0 -( ) show -31.5 579.6 moveto -12 f2 -(1995:) show -59.4 579.6 moveto -12 f0 -( Salt Peter ) show -18.1 566.9 moveto -3.3 3.3 c fill -31.5 558.8 moveto -12 f1 -(Rump) show -63.5 558.8 moveto -12 f0 -( ) show -31.5 545.5 moveto -12 f2 -(1994:) show -59.4 545.5 moveto -12 f0 -( Hating Brenda ) show -18.1 532.8 moveto -3.3 3.3 c fill -31.5 524.7 moveto -12 f1 -(Rush) show -58.1 524.7 moveto -12 f0 -( ) show -31.5 511.4 moveto -12 f2 -(1984:) show -59.4 511.4 moveto -12 f0 -( Grace Under Pressure ) show -298.1 525.2 moveto -12 f2 -(UBL Card: ) show -355.4 525.2 moveto -12 f0 -(1039) show -379.4 525.2 moveto -12 f0 -( ) show -18.1 498.7 moveto -3.3 3.3 c fill -31.5 490.6 moveto -12 f1 -(Sandoz) show -68.8 490.6 moveto -12 f0 -( ) show -31.5 477.3 moveto -12 f2 -(1993:) show -59.4 477.3 moveto -12 f0 -( Digital Lifeforms ) show -18.1 464.6 moveto -3.3 3.3 c fill -31.5 456.5 moveto -12 f1 -(Scatterbrain) show -96.1 456.5 moveto -12 f0 -( ) show -31.5 443.2 moveto -12 f2 -(1990:) show -59.4 443.2 moveto -12 f0 -( Here Comes Trouble ) show -18.1 430.5 moveto -3.3 3.3 c fill -31.5 422.4 moveto -12 f1 -(Scar Tissue) show -90.5 422.4 moveto -12 f0 -( ) show -31.5 409.1 moveto -12 f2 -(1995:) show -59.4 409.1 moveto -12 f0 -( Scar Tissue ) show -18.1 396.4 moveto -3.3 3.3 c fill -31.5 388.3 moveto -12 f1 -(Scritti Politti) show -97.8 388.3 moveto -12 f0 -( ) show -31.5 375 moveto -12 f2 -(1985:) show -59.4 375 moveto -12 f0 -( Cupid & Psyche ) show -18.1 362.3 moveto -3.3 3.3 c fill -31.5 354.2 moveto -12 f1 -(Severed Heads) show -107.1 354.2 moveto -12 f0 -( ) show -31.5 340.9 moveto -12 f2 -(1983:) show -59.4 340.9 moveto -12 f0 -( Since the Accident ) show -31.5 327.6 moveto -12 f2 -(1986:) show -59.4 327.6 moveto -12 f0 -( Come Visit the Big Bigot ) show -31.5 314.3 moveto -12 f2 -(1987:) show -59.4 314.3 moveto -12 f0 -( Bad Mood Guy ) show -298.1 354.7 moveto -12 f2 -(UBL Card: ) show -355.4 354.7 moveto -12 f0 -(1480) show -379.4 354.7 moveto -12 f0 -( ) show -18.1 301.6 moveto -3.3 3.3 c fill -31.5 293.5 moveto -12 f1 -(Sex Gang, Andi) show -111.8 293.5 moveto -12 f0 -( ) show -31.5 280.2 moveto -12 f2 -(1994:) show -59.4 280.2 moveto -12 f0 -( Arco Valley ) show -18.1 267.5 moveto -3.3 3.3 c fill -31.5 259.4 moveto -12 f1 -(Sex Gang Children) show -129.5 259.4 moveto -12 f0 -( ) show -31.5 246.1 moveto -12 f2 -(1992:) show -59.4 246.1 moveto -12 f0 -( Blind ) show -31.5 232.8 moveto -12 f2 -(1993:) show -59.4 232.8 moveto -12 f0 -( Dieche ) show -31.5 219.5 moveto -12 f2 -(1993:) show -59.4 219.5 moveto -12 f0 -( Medea ) show -18.1 206.8 moveto -3.3 3.3 c fill -31.5 198.7 moveto -12 f1 -(Shadow Project) show -112.4 198.7 moveto -12 f0 -( ) show -31.5 185.4 moveto -12 f2 -(1991:) show -59.4 185.4 moveto -12 f0 -( Shadow Project ) show -18.1 172.7 moveto -3.3 3.3 c fill -31.5 164.6 moveto -12 f1 -(Sharkbait) show -82.8 164.6 moveto -12 f0 -( ) show -31.5 151.3 moveto -12 f2 -(1991:) show -59.4 151.3 moveto -12 f0 -( Blowtorch Facelift ) show -31.5 138 moveto -12 f2 -(1993:) show -59.4 138 moveto -12 f0 -( Crushits ) show -18.1 125.3 moveto -3.3 3.3 c fill -31.5 117.2 moveto -12 f1 -(Sheep on Drugs) show -112.1 117.2 moveto -12 f0 -( ) show -31.5 103.9 moveto -12 f2 -(1993:) show -59.4 103.9 moveto -12 f0 -( Greatest Hits ) show -128.3 103.9 moveto -12 f2 -(\(comp\)) show -162.2 103.9 moveto -12 f0 -( ) show -31.5 90.6 moveto -12 f2 -(1995:) show -59.4 90.6 moveto -12 f0 -( Suck ) show -89.4 90.6 moveto -12 f2 -(\(EP\)) show -112 90.6 moveto -12 f0 -( ) show -18.1 77.9 moveto -3.3 3.3 c fill -pagelevel restore -showpage -%%Page: 24 24 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 716.8 moveto -3.3 3.3 c fill -31.5 708.7 moveto -12 f1 -(Shriekback) show -90.1 708.7 moveto -12 f0 -( ) show -31.5 695.4 moveto -12 f2 -(1982:) show -59.4 695.4 moveto -12 f0 -( Tench ) show -31.5 682.1 moveto -12 f2 -(1983:) show -59.4 682.1 moveto -12 f0 -( Care ) show -31.5 668.8 moveto -12 f2 -(1983:) show -59.4 668.8 moveto -12 f0 -( Care ) show -88 668.8 moveto -12 f2 -(\(Y version\)) show -140.9 668.8 moveto -12 f0 -( ) show -31.5 655.5 moveto -12 f2 -(1983:) show -59.4 655.5 moveto -12 f0 -( Lined Up / Hapax Legomena ) show -205.3 655.5 moveto -12 f2 -(\(single\)) show -241.9 655.5 moveto -12 f0 -( ) show -31.5 642.2 moveto -12 f2 -(1983:) show -59.4 642.2 moveto -12 f0 -( Lined Up / My Spine / Accretions /Into Method) show -31.5 628.9 moveto -12 f2 -(\(single\)) show -68.1 628.9 moveto -12 f0 -( ) show -31.5 615.6 moveto -12 f2 -(1983:) show -59.4 615.6 moveto -12 f0 -( My Spine / Accretions / Clear Trails ) show -240 615.6 moveto -12 f2 -(\(single\)) show -276.6 615.6 moveto -12 f0 -( ) show -31.5 602.3 moveto -12 f2 -(1983:) show -59.4 602.3 moveto -12 f0 -( Sexthinkone / Here Comes My Hand ) show -243 602.3 moveto -12 f2 -(\(single\)) show -279.6 602.3 moveto -12 f0 -( ) show -31.5 589 moveto -12 f2 -(1984:) show -59.4 589 moveto -12 f0 -( Jamscience ) show -120 589 moveto -12 f2 -(\(UK release\)) show -182.3 589 moveto -12 f0 -( ) show -31.5 575.7 moveto -12 f2 -(1984:) show -59.4 575.7 moveto -12 f0 -( Jamscience ) show -120 575.7 moveto -12 f2 -(\(Holland release\)) show -204.9 575.7 moveto -12 f0 -( ) show -31.5 562.4 moveto -12 f2 -(1984:) show -59.4 562.4 moveto -12 f0 -( Knowledge, Power, Truth, and Sex ) show -31.5 549.1 moveto -12 f2 -(1984:) show -59.4 549.1 moveto -12 f0 -( Mercy Dash ) show -124.3 549.1 moveto -12 f2 -(\(picture disc, single\)) show -223.2 549.1 moveto -12 f0 -( ) show -31.5 535.8 moveto -12 f2 -(1984:) show -59.4 535.8 moveto -12 f0 -( Hand on my Heart ) show -154.3 535.8 moveto -12 f2 -(\(picture disc, single\)) show -253.2 535.8 moveto -12 f0 -( ) show -31.5 522.5 moveto -12 f2 -(1985:) show -59.4 522.5 moveto -12 f0 -( The Infinite ) show -122.3 522.5 moveto -12 f2 -(\(comp\)) show -156.2 522.5 moveto -12 f0 -( ) show -31.5 509.2 moveto -12 f2 -(1985:) show -59.4 509.2 moveto -12 f0 -( Oil and Gold ) show -31.5 495.9 moveto -12 f2 -(1985:) show -59.4 495.9 moveto -12 f0 -( Fish Below the Ice ) show -155.7 495.9 moveto -12 f2 -(\(EP\)) show -178.3 495.9 moveto -12 f0 -( ) show -31.5 482.6 moveto -12 f2 -(1983-1985:) show -87.4 482.6 moveto -12 f0 -( Priests and Kannibals ) show -197.3 482.6 moveto -12 f2 -(\(comp\)) show -231.2 482.6 moveto -12 f0 -( ) show -31.5 469.3 moveto -12 f2 -(1986:) show -59.4 469.3 moveto -12 f0 -( Big Night Music ) show -31.5 456 moveto -12 f2 -(1986:) show -59.4 456 moveto -12 f0 -( Islam Grotto ) show -126.3 456 moveto -12 f2 -(\(live boot\)) show -175.9 456 moveto -12 f0 -( ) show -31.5 442.7 moveto -12 f2 -(1988:) show -59.4 442.7 moveto -12 f0 -( Evolution ) show -112.7 442.7 moveto -12 f2 -(\(comp\)) show -146.6 442.7 moveto -12 f0 -( ) show -31.5 429.4 moveto -12 f2 -(1990:) show -59.4 429.4 moveto -12 f0 -( The Dancing Years ) show -158.7 429.4 moveto -12 f2 -(\(remixes\)) show -204 429.4 moveto -12 f0 -( ) show -31.5 416.1 moveto -12 f2 -(1993:) show -59.4 416.1 moveto -12 f0 -( Sacred City ) show -298.1 709.2 moveto -12 f2 -(UBL Card: ) show -355.4 709.2 moveto -12 f0 -(1248) show -379.4 709.2 moveto -12 f0 -( ) show -298.1 695.9 moveto -12 f2 -(See also: ) show -344.7 695.9 moveto -12 f0 -(http2.brunel.ac.uk) show -431.7 695.9 moveto -12 f0 -( ) show -18.1 403.4 moveto -3.3 3.3 c fill -31.5 395.3 moveto -12 f1 -(Siglo XX) show -77.1 395.3 moveto -12 f0 -( ) show -31.5 382 moveto -12 f2 -(1983-1986:) show -87.4 382 moveto -12 f0 -( Antler Tracks I ) show -166.7 382 moveto -12 f2 -(\(comp\)) show -200.6 382 moveto -12 f0 -( ) show -31.5 368.7 moveto -12 f2 -(1986:) show -59.4 368.7 moveto -12 f0 -( Fear and Desire ) show -18.1 356 moveto -3.3 3.3 c fill -31.5 347.9 moveto -12 f1 -(Single Gun Theory) show -128.8 347.9 moveto -12 f0 -( ) show -31.5 334.6 moveto -12 f2 -(1989?:) show -65.4 334.6 moveto -12 f0 -( Exorcise this Wasteland ) show -31.5 321.3 moveto -12 f2 -(1991:) show -59.4 321.3 moveto -12 f0 -( Like Stars in my Hands ) show -31.5 308 moveto -12 f2 -(1993:) show -59.4 308 moveto -12 f0 -( Burning Bright \(but Unseen\) ) show -203.7 308 moveto -12 f2 -(\(EP\)) show -226.3 308 moveto -12 f0 -( ) show -31.5 294.7 moveto -12 f2 -(1994:) show -59.4 294.7 moveto -12 f0 -( Flow, River of my Soul ) show -298.1 348.4 moveto -12 f2 -(UBL Card: ) show -355.4 348.4 moveto -12 f0 -(1404) show -379.4 348.4 moveto -12 f0 -( ) show -298.1 335.1 moveto -12 f2 -(See also: ) show -344.7 335.1 moveto -12 f0 -(www.magna.com.au) show -443.6 335.1 moveto -12 f0 -( ) show -18.1 282 moveto -3.3 3.3 c fill -31.5 273.9 moveto -12 f1 -(Siouxsie and the Banshees) show -165.1 273.9 moveto -12 f0 -( ) show -31.5 260.6 moveto -12 f2 -(1977:) show -59.4 260.6 moveto -12 f0 -( Peel Sessions ) show -130.4 260.6 moveto -12 f2 -(\(live EP\)) show -173.3 260.6 moveto -12 f0 -( ) show -31.5 247.3 moveto -12 f2 -(1978:) show -59.4 247.3 moveto -12 f0 -( Peel Sessions 2 ) show -139.4 247.3 moveto -12 f2 -(\(live EP\)) show -182.3 247.3 moveto -12 f0 -( ) show -31.5 234 moveto -12 f2 -(1978:) show -59.4 234 moveto -12 f0 -( The Scream ) show -31.5 220.7 moveto -12 f2 -(1979:) show -59.4 220.7 moveto -12 f0 -( Join Hands ) show -31.5 207.4 moveto -12 f2 -(1980:) show -59.4 207.4 moveto -12 f0 -( Kaleidoscope ) show -31.5 194.1 moveto -12 f2 -(1981:) show -59.4 194.1 moveto -12 f0 -( juju ) show -31.5 180.8 moveto -12 f2 -(1981:) show -59.4 180.8 moveto -12 f0 -( Once Upon a Time ) show -157 180.8 moveto -12 f2 -(\(comp\)) show -190.9 180.8 moveto -12 f0 -( ) show -31.5 167.5 moveto -12 f2 -(1981:) show -59.4 167.5 moveto -12 f0 -( Spellbound / Follow the Sun / Slap Dash Snap) show -31.5 154.2 moveto -12 f2 -(\(single\)) show -68.1 154.2 moveto -12 f0 -( ) show -31.5 140.9 moveto -12 f2 -(1982:) show -59.4 140.9 moveto -12 f0 -( Slowdive / Obsession II / Cannibal Roses ) show -264.7 140.9 moveto -12 f2 -(\(single\)) show -31.5 114.3 moveto -12 f2 -(1982:) show -59.4 114.3 moveto -12 f0 -( A Kiss in the Dream House ) show -31.5 101 moveto -12 f2 -(1983:) show -59.4 101 moveto -12 f0 -( Nocturne ) show -110 101 moveto -12 f2 -(\(double live\)) show -170.9 101 moveto -12 f0 -( ) show -31.5 87.7 moveto -12 f2 -(1984:) show -59.4 87.7 moveto -12 f0 -( Hyaena ) show -305.7 274.4 moveto -12 f2 -(UBL Card: ) show -363 274.4 moveto -12 f0 -(1216) show -387 274.4 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 25 25 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1985:) show -59.4 709.2 moveto -12 f0 -( Tinderbox ) show -31.5 695.9 moveto -12 f2 -(1986:) show -59.4 695.9 moveto -12 f0 -( Through the Looking Glass ) show -31.5 682.6 moveto -12 f2 -(1987:) show -59.4 682.6 moveto -12 f0 -( Song from the Edge of the World ) show -226 682.6 moveto -12 f2 -(\(single\)) show -262.6 682.6 moveto -12 f0 -( ) show -31.5 669.3 moveto -12 f2 -(1988:) show -59.4 669.3 moveto -12 f0 -( Peekaboo / False Face / Catwalk ) show -221.7 669.3 moveto -12 f2 -(\(single\)) show -258.3 669.3 moveto -12 f0 -( ) show -31.5 656 moveto -12 f2 -(1988:) show -59.4 656 moveto -12 f0 -( Peepshow ) show -31.5 642.7 moveto -12 f2 -(1991:) show -59.4 642.7 moveto -12 f0 -( Superstition ) show -31.5 629.4 moveto -12 f2 -(1991:) show -59.4 629.4 moveto -12 f0 -( Kiss Them for Me ) show -153.7 629.4 moveto -12 f2 -(\(EP\)) show -176.3 629.4 moveto -12 f0 -( ) show -31.5 616.1 moveto -12 f2 -(1995:) show -59.4 616.1 moveto -12 f0 -( The Rapture ) show -18.1 603.4 moveto -3.3 3.3 c fill -31.5 595.3 moveto -12 f1 -(Sister Machine Gun) show -134.1 595.3 moveto -12 f0 -( ) show -31.5 582 moveto -12 f2 -(1992:) show -59.4 582 moveto -12 f0 -( Sins of the Flesh ) show -31.5 568.7 moveto -12 f2 -(1994:) show -59.4 568.7 moveto -12 f0 -( The Torture Technique ) show -31.5 555.4 moveto -12 f2 -(1994:) show -59.4 555.4 moveto -12 f0 -( Nothing ) show -104.7 555.4 moveto -12 f2 -(\(single\)) show -141.3 555.4 moveto -12 f0 -( ) show -31.5 542.1 moveto -12 f2 -(1994:) show -59.4 542.1 moveto -12 f0 -( Wired / Lung ) show -130 542.1 moveto -12 f2 -(\(single\)) show -166.6 542.1 moveto -12 f0 -( ) show -31.5 528.8 moveto -12 f2 -(1995:) show -59.4 528.8 moveto -12 f0 -( Burn ) show -299.7 595.8 moveto -12 f2 -(UBL Card: ) show -357 595.8 moveto -12 f0 -(3612) show -381 595.8 moveto -12 f0 -( ) show -18.1 516.1 moveto -3.3 3.3 c fill -31.5 508 moveto -12 f1 -(Sisterhood, The) show -112.1 508 moveto -12 f0 -( ) show -31.5 494.7 moveto -12 f2 -(1986:) show -59.4 494.7 moveto -12 f0 -( Gift ) show -298.1 508.5 moveto -12 f2 -(UBL Card: ) show -355.4 508.5 moveto -12 f0 -(1115) show -379.4 508.5 moveto -12 f0 -( ) show -298.1 495.2 moveto -12 f2 -(See also: ) show -344.7 495.2 moveto -12 f0 -(www.cm.cf.ac.uk) show -429.3 495.2 moveto -12 f0 -( ) show -18.1 482 moveto -3.3 3.3 c fill -31.5 473.9 moveto -12 f1 -(Sisters of Mercy) show -114.8 473.9 moveto -12 f0 -( ) show -31.5 460.6 moveto -12 f2 -(1985:) show -59.4 460.6 moveto -12 f0 -( First and Last and Always ) show -31.5 447.3 moveto -12 f2 -(1988:) show -59.4 447.3 moveto -12 f0 -( Floodland ) show -31.5 434 moveto -12 f2 -(1988:) show -59.4 434 moveto -12 f0 -( More / You Could be the One ) show -208.7 434 moveto -12 f2 -(\(single\)) show -245.3 434 moveto -12 f0 -( ) show -31.5 420.7 moveto -12 f2 -(1990:) show -59.4 420.7 moveto -12 f0 -( Vision Thing ) show -31.5 407.4 moveto -12 f2 -(1992:) show -59.4 407.4 moveto -12 f0 -( Some Girls Wander by Mistake ) show -217.3 407.4 moveto -12 f2 -(\(comp\)) show -251.2 407.4 moveto -12 f0 -( ) show -31.5 394.1 moveto -12 f2 -(1992:) show -59.4 394.1 moveto -12 f0 -( Temple of Love 1992 ) show -169.7 394.1 moveto -12 f2 -(\(single\)) show -206.3 394.1 moveto -12 f0 -( ) show -31.5 380.8 moveto -12 f2 -(1993:) show -59.4 380.8 moveto -12 f0 -( First and Last and Forever: A Tribute ) show -245.3 380.8 moveto -12 f2 -(\(various\)) show -289.2 380.8 moveto -12 f0 -( ) show -31.5 367.5 moveto -12 f2 -(1993:) show -59.4 367.5 moveto -12 f0 -( Under the Gun / Alice 1993 ) show -199 367.5 moveto -12 f2 -(\(single\)) show -235.6 367.5 moveto -12 f0 -( ) show -298.1 474.4 moveto -12 f2 -(UBL Card: ) show -355.4 474.4 moveto -12 f0 -(1062) show -379.4 474.4 moveto -12 f0 -( ) show -298.1 461.1 moveto -12 f2 -(See also: ) show -344.7 461.1 moveto -12 f0 -(www.cm.cf.ac.uk) show -429.3 461.1 moveto -12 f0 -( ) show -18.1 354.8 moveto -3.3 3.3 c fill -31.5 346.7 moveto -12 f1 -(Skeletal Family) show -111.1 346.7 moveto -12 f0 -( ) show -31.5 333.4 moveto -12 f2 -(1984-1985:) show -87.4 333.4 moveto -12 f0 -( Burning Oil / Futile Combat ) show -18.1 320.7 moveto -3.3 3.3 c fill -31.5 312.6 moveto -12 f1 -(Skinny Puppy) show -103.8 312.6 moveto -12 f0 -( ) show -31.5 299.3 moveto -12 f2 -(1983:) show -59.4 299.3 moveto -12 f0 -( Back and Forth, Series Two ) show -31.5 286 moveto -12 f2 -(1984:) show -59.4 286 moveto -12 f0 -( Bites ) show -31.5 272.7 moveto -12 f2 -(1984:) show -59.4 272.7 moveto -12 f0 -( Remission ) show -31.5 259.4 moveto -12 f2 -(1984:) show -59.4 259.4 moveto -12 f0 -( Bites and Remission ) show -31.5 246.1 moveto -12 f2 -(1986:) show -59.4 246.1 moveto -12 f0 -( Mind: the Perpetual Intercourse ) show -31.5 232.8 moveto -12 f2 -(1986:) show -59.4 232.8 moveto -12 f0 -( Dig It ) show -93.7 232.8 moveto -12 f2 -(\(EP\)) show -116.3 232.8 moveto -12 f0 -( ) show -31.5 219.5 moveto -12 f2 -(1987:) show -59.4 219.5 moveto -12 f0 -( Cleanse, Fold, and Manipulate ) show -31.5 206.2 moveto -12 f2 -(1988:) show -59.4 206.2 moveto -12 f0 -( Vivisect VI ) show -31.5 192.9 moveto -12 f2 -(1989:) show -59.4 192.9 moveto -12 f0 -( Rabies ) show -31.5 179.6 moveto -12 f2 -(1990:) show -59.4 179.6 moveto -12 f0 -( Too Dark Park ) show -31.5 166.3 moveto -12 f2 -(1990:) show -59.4 166.3 moveto -12 f0 -( Censor ) show -99.3 166.3 moveto -12 f2 -(\(EP\)) show -121.9 166.3 moveto -12 f0 -( ) show -31.5 153 moveto -12 f2 -(1992:) show -59.4 153 moveto -12 f0 -( 12 Inch Anthology ) show -156 153 moveto -12 f2 -(\(comp\)) show -189.9 153 moveto -12 f0 -( ) show -31.5 139.7 moveto -12 f2 -(1992:) show -59.4 139.7 moveto -12 f0 -( Last Rights ) show -298.1 313.1 moveto -12 f2 -(UBL Card: ) show -355.4 313.1 moveto -12 f0 -(1166) show -379.4 313.1 moveto -12 f0 -( ) show -298.1 299.8 moveto -12 f2 -(See also: ) show -344.7 299.8 moveto -12 f0 -(www.eecs.nwu.edu) show -438.3 299.8 moveto -12 f0 -( ) show -18.1 127 moveto -3.3 3.3 c fill -31.5 118.9 moveto -12 f1 -(Sky Cries Mary) show -112.8 118.9 moveto -12 f0 -( ) show -31.5 105.6 moveto -12 f2 -(1993:) show -59.4 105.6 moveto -12 f0 -( A Return to the Inner Experience ) show -31.5 92.3 moveto -12 f2 -(1994:) show -59.4 92.3 moveto -12 f0 -( This Timeless Turning ) show -31.5 79 moveto -12 f2 -(1994:) show -59.4 79 moveto -12 f0 -( Every Iceberg is Afire / Deep Sunless Sea /) show -298.1 119.4 moveto -12 f2 -(UBL Card: ) show -355.4 119.4 moveto -12 f0 -(1437) show -379.4 119.4 moveto -12 f0 -( ) show -298.1 106.1 moveto -12 f2 -(See also: ) show -344.7 106.1 moveto -12 f0 -(www.starwave.com) show -440 106.1 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 26 26 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f0 -(Cornerman ) show -88.4 709.2 moveto -12 f2 -(\(single\)) show -125 709.2 moveto -12 f0 -( ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Snog) show -56.8 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1995:) show -59.4 675.1 moveto -12 f0 -( Dear Valued Customer ) show -18.1 662.4 moveto -3.3 3.3 c fill -31.5 654.3 moveto -12 f1 -(Soh Daiko) show -84.5 654.3 moveto -12 f0 -( ) show -31.5 641 moveto -12 f2 -(1990:) show -59.4 641 moveto -12 f0 -( Taiko Drum Ensemble ) show -18.1 628.3 moveto -3.3 3.3 c fill -31.5 620.2 moveto -12 f1 -(Some, Belouis) show -102.8 620.2 moveto -12 f0 -( ) show -31.5 606.9 moveto -12 f2 -(1984:) show -59.4 606.9 moveto -12 f0 -( Some People ) show -128.4 606.9 moveto -12 f2 -(\(single\)) show -165 606.9 moveto -12 f0 -( ) show -18.1 594.2 moveto -3.3 3.3 c fill -31.5 586.1 moveto -12 f1 -(Southern Death Cult) show -138.1 586.1 moveto -12 f0 -( ) show -31.5 572.8 moveto -12 f2 -(1982-1983:) show -87.4 572.8 moveto -12 f0 -( Southern Death Cult ) show -192 572.8 moveto -12 f2 -(\(comp\)) show -225.9 572.8 moveto -12 f0 -( ) show -18.1 560.1 moveto -3.3 3.3 c fill -31.5 552 moveto -12 f1 -(Spahn Ranch) show -100.5 552 moveto -12 f0 -( ) show -31.5 538.7 moveto -12 f2 -(1995:) show -59.4 538.7 moveto -12 f0 -( The Coiled One ) show -18.1 526 moveto -3.3 3.3 c fill -31.5 517.9 moveto -12 f1 -(SSQ) show -54.1 517.9 moveto -12 f0 -( ) show -31.5 504.6 moveto -12 f2 -(1984:) show -59.4 504.6 moveto -12 f0 -( Playback ) show -31.5 491.3 moveto -12 f2 -(1986:) show -59.4 491.3 moveto -12 f0 -( Insecurity ) show -113.3 491.3 moveto -12 f2 -(\(single\)) show -149.9 491.3 moveto -12 f0 -( ) show -18.1 478.6 moveto -3.3 3.3 c fill -31.5 470.5 moveto -12 f1 -(Stabbing Westward) show -133.1 470.5 moveto -12 f0 -( ) show -31.5 457.2 moveto -12 f2 -(1993:) show -59.4 457.2 moveto -12 f0 -( Violent Mood Swings ) show -171.4 457.2 moveto -12 f2 -(\(EP\)) show -194 457.2 moveto -12 f0 -( ) show -31.5 443.9 moveto -12 f2 -(1994:) show -59.4 443.9 moveto -12 f0 -( Ungod ) show -31.5 430.6 moveto -12 f2 -(1995:) show -59.4 430.6 moveto -12 f0 -( What Do I Have to Do / Falls Apart ) show -237.3 430.6 moveto -12 f2 -(\(single\)) show -273.9 430.6 moveto -12 f0 -( ) show -31.5 417.3 moveto -12 f2 -(1995:) show -59.4 417.3 moveto -12 f0 -( Wither Blister Burn and Peel ) show -300.5 471 moveto -12 f2 -(UBL Card: ) show -357.8 471 moveto -12 f0 -(2415) show -381.8 471 moveto -12 f0 -( ) show -18.1 404.6 moveto -3.3 3.3 c fill -31.5 396.5 moveto -12 f1 -(Strange Boutique) show -121.1 396.5 moveto -12 f0 -( ) show -31.5 383.2 moveto -12 f2 -(199?:) show -59.4 383.2 moveto -12 f0 -( Charm ) show -31.5 369.9 moveto -12 f2 -(199?:) show -59.4 369.9 moveto -12 f0 -( The Kindest Words ) show -31.5 356.6 moveto -12 f2 -(199?:) show -59.4 356.6 moveto -12 f0 -( The Loved One ) show -298.1 397 moveto -12 f2 -(See also: ) show -344.7 397 moveto -12 f0 -(www.iuma.com) show -421.3 397 moveto -12 f0 -( ) show -18.1 343.9 moveto -3.3 3.3 c fill -31.5 335.8 moveto -12 f1 -(Steroid Maximus) show -119.8 335.8 moveto -12 f0 -( ) show -31.5 322.5 moveto -12 f2 -(1991:) show -59.4 322.5 moveto -12 f0 -( Quilombo ) show -31.5 309.2 moveto -12 f2 -(1992:) show -59.4 309.2 moveto -12 f0 -( Gondwanaland ) show -306.4 336.3 moveto -12 f2 -(UBL Card: ) show -363.7 336.3 moveto -12 f0 -(2750) show -387.7 336.3 moveto -12 f0 -( ) show -18.1 296.5 moveto -3.3 3.3 c fill -31.5 288.4 moveto -12 f1 -(Sugarcubes, The) show -116.8 288.4 moveto -12 f0 -( ) show -31.5 275.1 moveto -12 f2 -(1988:) show -59.4 275.1 moveto -12 f0 -( Life's Too Good ) show -298.1 288.9 moveto -12 f2 -(UBL Card: ) show -355.4 288.9 moveto -12 f0 -(3419) show -379.4 288.9 moveto -12 f0 -( ) show -298.1 275.6 moveto -12 f2 -(See also: ) show -344.7 275.6 moveto -12 f0 -(math-www.uio.no) show -432 275.6 moveto -12 f0 -( ) show -18.1 262.4 moveto -3.3 3.3 c fill -31.5 254.3 moveto -12 f1 -(Sunscreem) show -87.4 254.3 moveto -12 f0 -( ) show -31.5 241 moveto -12 f2 -(1992:) show -59.4 241 moveto -12 f0 -( O3 ) show -18.1 228.3 moveto -3.3 3.3 c fill -31.5 220.2 moveto -12 f1 -(Switchblade Symphony) show -151.8 220.2 moveto -12 f0 -( ) show -31.5 206.9 moveto -12 f2 -(1992:) show -59.4 206.9 moveto -12 f0 -( Fable ) show -92 206.9 moveto -12 f2 -(\(tape/EP\)) show -138.6 206.9 moveto -12 f0 -( ) show -31.5 193.6 moveto -12 f2 -(1993:) show -59.4 193.6 moveto -12 f0 -( Elegy ) show -93.3 193.6 moveto -12 f2 -(\(tape/EP\)) show -139.9 193.6 moveto -12 f0 -( ) show -31.5 180.3 moveto -12 f2 -(1995:) show -59.4 180.3 moveto -12 f0 -( Serpentine Gallery ) show -18.1 167.6 moveto -3.3 3.3 c fill -31.5 159.5 moveto -12 f1 -(Talking Heads) show -106.5 159.5 moveto -12 f0 -( ) show -31.5 146.2 moveto -12 f2 -(1977:) show -59.4 146.2 moveto -12 f0 -( Talking Heads '77 ) show -31.5 132.9 moveto -12 f2 -(1978:) show -59.4 132.9 moveto -12 f0 -( More Songs About Buildings and Food ) show -31.5 119.6 moveto -12 f2 -(1979:) show -59.4 119.6 moveto -12 f0 -( The Name of This Band is Talking Heads) show -31.5 106.3 moveto -12 f2 -(\(double live\)) show -92.4 106.3 moveto -12 f0 -( ) show -31.5 93 moveto -12 f2 -(1981:) show -59.4 93 moveto -12 f0 -( Fear of Music ) show -31.5 79.7 moveto -12 f2 -(1983:) show -59.4 79.7 moveto -12 f0 -( Sp eak in gI n To ngu es ) show -302.4 160 moveto -12 f2 -(UBL Card: ) show -359.7 160 moveto -12 f0 -(1012) show -383.7 160 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 27 27 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1985:) show -59.4 709.2 moveto -12 f0 -( Stop Making Sense ) show -158.7 709.2 moveto -12 f2 -(\(live soundtrack\)) show -240.3 709.2 moveto -12 f0 -( ) show -31.5 695.9 moveto -12 f2 -(1985:) show -59.4 695.9 moveto -12 f0 -( Little Creatures ) show -18.1 683.2 moveto -3.3 3.3 c fill -31.5 675.1 moveto -12 f1 -(Tears For Fears) show -114.1 675.1 moveto -12 f0 -( ) show -31.5 661.8 moveto -12 f2 -(1983:) show -59.4 661.8 moveto -12 f0 -( The Hurting ) show -31.5 648.5 moveto -12 f2 -(1985:) show -59.4 648.5 moveto -12 f0 -( Songs From the Big Chair ) show -298.1 675.6 moveto -12 f2 -(UBL Card: ) show -355.4 675.6 moveto -12 f0 -(2763) show -379.4 675.6 moveto -12 f0 -( ) show -18.1 635.8 moveto -3.3 3.3 c fill -31.5 627.7 moveto -12 f1 -(Tel Basta) show -79.8 627.7 moveto -12 f0 -( ) show -31.5 614.4 moveto -12 f2 -(1996:) show -59.4 614.4 moveto -12 f0 -( Lickerish ) show -18.1 601.7 moveto -3.3 3.3 c fill -31.5 593.6 moveto -12 f1 -(Thanatos) show -79.5 593.6 moveto -12 f0 -( ) show -31.5 580.3 moveto -12 f2 -(1995:) show -59.4 580.3 moveto -12 f0 -( An Embassy in Gaius ) show -18.1 567.6 moveto -3.3 3.3 c fill -31.5 559.5 moveto -12 f1 -(Therapy?) show -81.5 559.5 moveto -12 f0 -( ) show -31.5 546.2 moveto -12 f2 -(1992:) show -59.4 546.2 moveto -12 f0 -( Caucasian Psychosis ) show -31.5 532.9 moveto -12 f2 -(1992:) show -59.4 532.9 moveto -12 f0 -( Nurse ) show -299.1 560 moveto -12 f2 -(UBL Card: ) show -356.4 560 moveto -12 f0 -(2044) show -380.4 560 moveto -12 f0 -( ) show -18.1 520.2 moveto -3.3 3.3 c fill -31.5 512.1 moveto -12 f1 -(13 Mg.) show -66.8 512.1 moveto -12 f0 -( ) show -31.5 498.8 moveto -12 f2 -(1995:) show -59.4 498.8 moveto -12 f0 -( Trust and Obey ) show -18.1 486.1 moveto -3.3 3.3 c fill -31.5 478 moveto -12 f1 -(This Ascension) show -108.5 478 moveto -12 f0 -( ) show -31.5 464.7 moveto -12 f2 -(1991:) show -59.4 464.7 moveto -12 f0 -( Light and Shade ) show -31.5 451.4 moveto -12 f2 -(1994:) show -59.4 451.4 moveto -12 f0 -( Walk Softly, a Dream Lies Here ) show -18.1 438.7 moveto -3.3 3.3 c fill -31.5 430.6 moveto -12 f1 -(Throwing Muses) show -117.8 430.6 moveto -12 f0 -( ) show -31.5 417.3 moveto -12 f2 -(1986:) show -59.4 417.3 moveto -12 f0 -( Throwing Muses ) show -298.4 431.1 moveto -12 f2 -(UBL Card: ) show -355.7 431.1 moveto -12 f0 -(1357) show -379.7 431.1 moveto -12 f0 -( ) show -18.1 404.6 moveto -3.3 3.3 c fill -31.5 396.5 moveto -12 f1 -(Tinfed) show -65.5 396.5 moveto -12 f0 -( ) show -31.5 383.2 moveto -12 f2 -(1993:) show -59.4 383.2 moveto -12 f0 -( Synaptic Hardware ) show -18.1 370.5 moveto -3.3 3.3 c fill -31.5 362.4 moveto -12 f1 -(Tin Machine) show -97.1 362.4 moveto -12 f0 -( ) show -31.5 349.1 moveto -12 f2 -(1989:) show -59.4 349.1 moveto -12 f0 -( Tin Machine ) show -298.1 362.9 moveto -12 f2 -(UBL Card: ) show -355.4 362.9 moveto -12 f0 -(1098) show -379.4 362.9 moveto -12 f0 -( ) show -18.1 336.4 moveto -3.3 3.3 c fill -31.5 328.3 moveto -12 f1 -(Tit Wrench United) show -128.8 328.3 moveto -12 f0 -( ) show -31.5 315 moveto -12 f2 -(1993:) show -59.4 315 moveto -12 f0 -( Full Employment ) show -18.1 302.3 moveto -3.3 3.3 c fill -31.5 294.2 moveto -12 f1 -(Tom Tom Club) show -110.8 294.2 moveto -12 f0 -( ) show -31.5 280.9 moveto -12 f2 -(1981:) show -59.4 280.9 moveto -12 f0 -( Tom Tom Club ) show -31.5 267.6 moveto -12 f2 -(1983:) show -59.4 267.6 moveto -12 f0 -( Close to the Bone ) show -298.1 294.7 moveto -12 f2 -(UBL Card: ) show -355.4 294.7 moveto -12 f0 -(1012) show -379.4 294.7 moveto -12 f0 -( ) show -18.1 254.9 moveto -3.3 3.3 c fill -31.5 246.8 moveto -12 f1 -(Tones on Tail) show -101.5 246.8 moveto -12 f0 -( ) show -31.5 233.5 moveto -12 f2 -(1982:) show -59.4 233.5 moveto -12 f0 -( Tones on Tail ) show -31.5 220.2 moveto -12 f2 -(1984:) show -59.4 220.2 moveto -12 f0 -( Pop ) show -31.5 206.9 moveto -12 f2 -(1984:) show -59.4 206.9 moveto -12 f0 -( Performance / Shakes ) show -170 206.9 moveto -12 f2 -(\(single\)) show -206.6 206.9 moveto -12 f0 -( ) show -31.5 193.6 moveto -12 f2 -(1982-1984:) show -87.4 193.6 moveto -12 f0 -( Night Music ) show -153.7 193.6 moveto -12 f2 -(\(comp\)) show -187.6 193.6 moveto -12 f0 -( ) show -298.1 247.3 moveto -12 f2 -(UBL Card: ) show -355.4 247.3 moveto -12 f0 -(1235) show -379.4 247.3 moveto -12 f0 -( ) show -298.1 234 moveto -12 f2 -(See also: ) show -344.7 234 moveto -12 f0 -(gothic.acs.csulb.edu) show -441.6 234 moveto -12 f0 -( ) show -298.1 220.7 moveto -12 f2 -(See also: ) show -344.7 220.7 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 220.7 moveto -12 f0 -( ) show -18.1 180.9 moveto -3.3 3.3 c fill -31.5 172.8 moveto -12 f1 -(Trance Mission) show -111.1 172.8 moveto -12 f0 -( ) show -31.5 159.5 moveto -12 f2 -(1993:) show -59.4 159.5 moveto -12 f0 -( Trance Mission ) show -18.1 146.8 moveto -3.3 3.3 c fill -31.5 138.7 moveto -12 f1 -(Trance to the Sun) show -123.1 138.7 moveto -12 f0 -( ) show -31.5 125.4 moveto -12 f2 -(1994:) show -59.4 125.4 moveto -12 f0 -( Ghost Forest ) show -31.5 112.1 moveto -12 f2 -(1995:) show -59.4 112.1 moveto -12 f0 -( Bloom, Flowers, Bloom! ) show -31.5 98.8 moveto -12 f2 -(1995:) show -59.4 98.8 moveto -12 f0 -( Venomous Eve ) show -18.1 86.1 moveto -3.3 3.3 c fill -31.5 78 moveto -12 f1 -(Transvision Vamp) show -126.5 78 moveto -12 f0 -( ) show -302.5 78.5 moveto -12 f2 -(UBL Card: ) show -359.8 78.5 moveto -12 f0 -(5305) show -383.8 78.5 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 28 28 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1991:) show -59.4 709.2 moveto -12 f0 -( Little Magnets versus the Bubble of Babble ) show -18.1 696.5 moveto -3.3 3.3 c fill -31.5 688.4 moveto -12 f1 -(Trio) show -54.1 688.4 moveto -12 f0 -( ) show -31.5 675.1 moveto -12 f2 -(1983:) show -59.4 675.1 moveto -12 f0 -( Trio and Error ) show -18.1 662.4 moveto -3.3 3.3 c fill -31.5 654.3 moveto -12 f1 -(Tubes, The) show -88.8 654.3 moveto -12 f0 -( ) show -31.5 641 moveto -12 f2 -(1981:) show -59.4 641 moveto -12 f0 -( Tubes Rarities And Smash Hits [T.R.A.S.H] ) show -18.1 628.3 moveto -3.3 3.3 c fill -31.5 620.2 moveto -12 f1 -(Tuxedomoon) show -98.8 620.2 moveto -12 f0 -( ) show -31.5 606.9 moveto -12 f2 -(1980:) show -59.4 606.9 moveto -12 f0 -( Half-Mute ) show -31.5 593.6 moveto -12 f2 -(1983:) show -59.4 593.6 moveto -12 f0 -( A Thousand Lives by Picture ) show -31.5 580.3 moveto -12 f2 -(1985:) show -59.4 580.3 moveto -12 f0 -( Holy Wars ) show -18.1 567.6 moveto -3.3 3.3 c fill -31.5 559.5 moveto -12 f1 -(Underflowers) show -101.4 559.5 moveto -12 f0 -( ) show -31.5 546.2 moveto -12 f2 -(1995:) show -59.4 546.2 moveto -12 f0 -( Underflowers ) show -18.1 533.5 moveto -3.3 3.3 c fill -31.5 525.4 moveto -12 f1 -(Urban Dance Squad) show -135.5 525.4 moveto -12 f0 -( ) show -31.5 512.1 moveto -12 f2 -(1991:) show -59.4 512.1 moveto -12 f0 -( Life'n Perspectives of a Genuine Crossover ) show -303.5 525.9 moveto -12 f2 -(UBL Card: ) show -360.8 525.9 moveto -12 f0 -(4626) show -384.8 525.9 moveto -12 f0 -( ) show -18.1 499.4 moveto -3.3 3.3 c fill -31.5 491.3 moveto -12 f1 -(Usherhouse) show -91.5 491.3 moveto -12 f0 -( ) show -31.5 478 moveto -12 f2 -(1993:) show -59.4 478 moveto -12 f0 -( Molting ) show -31.5 464.7 moveto -12 f2 -(1994:) show -59.4 464.7 moveto -12 f0 -( Flux ) show -18.1 452 moveto -3.3 3.3 c fill -31.5 443.9 moveto -12 f1 -(Ultravox) show -76.8 443.9 moveto -12 f0 -( ) show -31.5 430.6 moveto -12 f2 -(1978:) show -59.4 430.6 moveto -12 f0 -( Systems of Romance ) show -18.1 417.9 moveto -3.3 3.3 c fill -31.5 409.8 moveto -12 f1 -(Van Acker, Luc) show -113.1 409.8 moveto -12 f0 -( ) show -31.5 396.5 moveto -12 f2 -(1980:) show -59.4 396.5 moveto -12 f0 -( Taking Snapshots, Volume 1 ) show -300.1 410.3 moveto -12 f2 -(UBL Card: ) show -357.4 410.3 moveto -12 f0 -(1100) show -381.4 410.3 moveto -12 f0 -( ) show -18.1 383.8 moveto -3.3 3.3 c fill -31.5 375.7 moveto -12 f1 -(Vangelis) show -75.5 375.7 moveto -12 f0 -( ) show -31.5 362.4 moveto -12 f2 -(1994:) show -59.4 362.4 moveto -12 f0 -( Blade Runner ) show -131.7 362.4 moveto -12 f2 -(\(soundtrack\)) show -193 362.4 moveto -12 f0 -( ) show -298.1 376.2 moveto -12 f2 -(UBL Card: ) show -355.4 376.2 moveto -12 f0 -(1023) show -379.4 376.2 moveto -12 f0 -( ) show -298.1 362.9 moveto -12 f2 -(See also: ) show -344.7 362.9 moveto -12 f0 -(rt66.com) show -387.6 362.9 moveto -12 f0 -( ) show -18.1 349.7 moveto -3.3 3.3 c fill -31.5 341.6 moveto -12 f1 -(various) show -69.5 341.6 moveto -12 f0 -( ) show -31.5 328.3 moveto -12 f2 -(1980:) show -59.4 328.3 moveto -12 f0 -( URGH! A Music War ) show -171.7 328.3 moveto -12 f2 -(\(live comp\)) show -226 328.3 moveto -12 f0 -( ) show -31.5 315 moveto -12 f2 -(1981-1994:) show -87.4 315 moveto -12 f0 -( Wax Trax Black Box ) show -195.7 315 moveto -12 f2 -(\(comp\)) show -229.6 315 moveto -12 f0 -( ) show -31.5 301.7 moveto -12 f2 -(1982-198?:) show -87.4 301.7 moveto -12 f0 -( In Goth Daze \(Anagram version\) ) show -252 301.7 moveto -12 f2 -(\(comp\)) show -285.9 301.7 moveto -12 f0 -( ) show -31.5 288.4 moveto -12 f2 -(1982-1994:) show -87.4 288.4 moveto -12 f0 -( In Goth Daze \(Cleopatra version\) ) show -254 288.4 moveto -12 f2 -(\(comp\)) show -287.9 288.4 moveto -12 f0 -( ) show -31.5 275.1 moveto -12 f2 -(1982-1993:) show -87.4 275.1 moveto -12 f0 -( The Whip \(Cleopatra\) ) show -199.3 275.1 moveto -12 f2 -(\(comp\)) show -233.2 275.1 moveto -12 f0 -( ) show -31.5 261.8 moveto -12 f2 -(1984-1985:) show -87.4 261.8 moveto -12 f0 -( IQ6: Zang Tumb Tuum Sampled ) show -251.3 261.8 moveto -12 f2 -(\(comp\)) show -285.2 261.8 moveto -12 f0 -( ) show -31.5 248.5 moveto -12 f2 -(1984-1995:) show -87.4 248.5 moveto -12 f0 -( DEC ADE NCE \(Nettwerk\) ) show -227.7 248.5 moveto -12 f2 -(\(comp\)) show -261.6 248.5 moveto -12 f0 -( ) show -31.5 235.2 moveto -12 f2 -(1988:) show -59.4 235.2 moveto -12 f0 -( This is Electronic Body Music ) show -212 235.2 moveto -12 f2 -(\(comp\)) show -245.9 235.2 moveto -12 f0 -( ) show -31.5 221.9 moveto -12 f2 -(1990:) show -59.4 221.9 moveto -12 f0 -( From Across This Gray Land #2 \(Projekt\) ) show -267.3 221.9 moveto -12 f2 -(\(comp\)) show -301.2 221.9 moveto -12 f0 -( ) show -31.5 208.6 moveto -12 f2 -(1990:) show -59.4 208.6 moveto -12 f0 -( Doctor Death IV: The Marvels of Insect Life ) show -281 208.6 moveto -12 f2 -(\(double comp\)) show -350.6 208.6 moveto -12 f0 -( ) show -31.5 195.3 moveto -12 f2 -(1990:) show -59.4 195.3 moveto -12 f0 -( Red Hot + Blue ) show -141.1 195.3 moveto -12 f2 -(\(comp\)) show -175 195.3 moveto -12 f0 -( ) show -31.5 182 moveto -12 f2 -(1991:) show -59.4 182 moveto -12 f0 -( Bouquet of Dreams ) show -159.3 182 moveto -12 f2 -(\(comp\)) show -193.2 182 moveto -12 f0 -( ) show -31.5 168.7 moveto -12 f2 -(1980-1992:) show -87.4 168.7 moveto -12 f0 -( Gothic Rock ) show -154.3 168.7 moveto -12 f2 -(\(comp\)) show -188.2 168.7 moveto -12 f0 -( ) show -31.5 155.4 moveto -12 f2 -(1992:) show -59.4 155.4 moveto -12 f0 -( Mindfield \(Third Mind\) ) show -180 155.4 moveto -12 f2 -(\(comp\)) show -213.9 155.4 moveto -12 f0 -( ) show -31.5 142.1 moveto -12 f2 -(1992:) show -59.4 142.1 moveto -12 f0 -( From Across This Gray Land #3 \(Projekt\) ) show -267.3 142.1 moveto -12 f2 -(\(comp\)) show -301.2 142.1 moveto -12 f0 -( ) show -31.5 128.8 moveto -12 f2 -(1992:) show -59.4 128.8 moveto -12 f0 -( The Cyberflesh Conspiracy ) show -197.3 128.8 moveto -12 f2 -(\(comp\)) show -231.2 128.8 moveto -12 f0 -( ) show -31.5 115.5 moveto -12 f2 -(1992:) show -59.4 115.5 moveto -12 f0 -( G\341rgula Mec\342nica: World Electrostatic Assembly ) show -304.6 115.5 moveto -12 f2 -(\(comp\)) show -338.5 115.5 moveto -12 f0 -( ) show -31.5 102.2 moveto -12 f2 -(1992:) show -59.4 102.2 moveto -12 f0 -( CCCC: California Cyber Crash Compilation \(Cop\) ) show -309.7 102.2 moveto -12 f2 -(\(comp\)) show -343.6 102.2 moveto -12 f0 -( ) show -31.5 88.9 moveto -12 f2 -(1993:) show -59.4 88.9 moveto -12 f0 -( Shut Up Kitty ) show -132.7 88.9 moveto -12 f2 -(\(comp\)) show -166.6 88.9 moveto -12 f0 -( ) show -31.5 75.6 moveto -12 f2 -(1988-1993:) show -87.4 75.6 moveto -12 f0 -( Can You See It Yet? \(Invisible\) ) show -245.7 75.6 moveto -12 f2 -(\(comp\)) show -279.6 75.6 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 29 29 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1994:) show -59.4 709.2 moveto -12 f0 -( Mysterious Encounters \(Cleopatra\) ) show -234 709.2 moveto -12 f2 -(\(comp\)) show -267.9 709.2 moveto -12 f0 -( ) show -31.5 695.9 moveto -12 f2 -(1994:) show -59.4 695.9 moveto -12 f0 -( The Crow ) show -113.7 695.9 moveto -12 f2 -(\(comp\)) show -147.6 695.9 moveto -12 f0 -( ) show -31.5 682.6 moveto -12 f2 -(1994:) show -59.4 682.6 moveto -12 f0 -( Totentanz: The Best of Zoth Ommog ) show -243.7 682.6 moveto -12 f2 -(\(double comp\)) show -313.3 682.6 moveto -12 f0 -( ) show -31.5 669.3 moveto -12 f2 -(1992:) show -59.4 669.3 moveto -12 f0 -( Hy! \(Hyperium Compilation volume 1\) ) show -254.7 669.3 moveto -12 f2 -(\(comp\)) show -288.6 669.3 moveto -12 f0 -( ) show -31.5 656 moveto -12 f2 -(1993:) show -59.4 656 moveto -12 f0 -( World Domination Sampler ) show -199.3 656 moveto -12 f2 -(\(comp\)) show -233.2 656 moveto -12 f0 -( ) show -31.5 642.7 moveto -12 f2 -(1993:) show -59.4 642.7 moveto -12 f0 -( Rivet Head Culture ) show -158.7 642.7 moveto -12 f2 -(\(comp\)) show -192.6 642.7 moveto -12 f0 -( ) show -31.5 629.4 moveto -12 f2 -(1993:) show -59.4 629.4 moveto -12 f0 -( Artificial Intelligence \(Warp\) ) show -206.6 629.4 moveto -12 f2 -(\(comp\)) show -240.5 629.4 moveto -12 f0 -( ) show -31.5 616.1 moveto -12 f2 -(1994:) show -59.4 616.1 moveto -12 f0 -( Artificial Intelligence II \(Warp\) ) show -217.6 616.1 moveto -12 f2 -(\(comp\)) show -251.5 616.1 moveto -12 f0 -( ) show -31.5 602.8 moveto -12 f2 -(1994:) show -59.4 602.8 moveto -12 f0 -( Big Hard Disk #2 \(Smash\) ) show -193.3 602.8 moveto -12 f2 -(\(comp\)) show -227.2 602.8 moveto -12 f0 -( ) show -31.5 589.5 moveto -12 f2 -(1994:) show -59.4 589.5 moveto -12 f0 -( Kindred Spirits \(Bedazzled\) ) show -200 589.5 moveto -12 f2 -(\(comp\)) show -233.9 589.5 moveto -12 f0 -( ) show -31.5 576.2 moveto -12 f2 -(1994:) show -59.4 576.2 moveto -12 f0 -( Plug In + Turn On \(Instinct\) ) show -201.1 576.2 moveto -12 f2 -(\(comp\)) show -235 576.2 moveto -12 f0 -( ) show -31.5 562.9 moveto -12 f2 -(1994:) show -59.4 562.9 moveto -12 f0 -( The Disease of Lady Madeline \(Anubis\) ) show -259 562.9 moveto -12 f2 -(\(comp\)) show -292.9 562.9 moveto -12 f0 -( ) show -31.5 549.6 moveto -12 f2 -(1994:) show -59.4 549.6 moveto -12 f0 -( Natural Born Killers ) show -164 549.6 moveto -12 f2 -(\(soundtrack comp\)) show -254.3 549.6 moveto -12 f0 -( ) show -31.5 536.3 moveto -12 f2 -(1994:) show -59.4 536.3 moveto -12 f0 -( Afterburn \(Wax Trax\) ) show -172 536.3 moveto -12 f2 -(\(comp\)) show -205.9 536.3 moveto -12 f0 -( ) show -31.5 523 moveto -12 f2 -(1994:) show -59.4 523 moveto -12 f0 -( Chaos Compilation \(Cop\) ) show -189.4 523 moveto -12 f2 -(\(comp\)) show -223.3 523 moveto -12 f0 -( ) show -31.5 509.7 moveto -12 f2 -(1994:) show -59.4 509.7 moveto -12 f0 -( Electrocity Vol. 5 ) show -151 509.7 moveto -12 f2 -(\(comp\)) show -184.9 509.7 moveto -12 f0 -( ) show -31.5 496.4 moveto -12 f2 -(1995:) show -59.4 496.4 moveto -12 f0 -( Gothik \(Cleopatra\) ) show -156.3 496.4 moveto -12 f2 -(\(double comp\)) show -225.9 496.4 moveto -12 f0 -( ) show -31.5 483.1 moveto -12 f2 -(1995:) show -59.4 483.1 moveto -12 f0 -( Godfathers of German Gothic ) show -209 483.1 moveto -12 f2 -(\(comp\)) show -242.9 483.1 moveto -12 f0 -( ) show -31.5 469.8 moveto -12 f2 -(1995:) show -59.4 469.8 moveto -12 f0 -( Heavenly Voices III \(Hyperium\) ) show -222.3 469.8 moveto -12 f2 -(\(comp\)) show -256.2 469.8 moveto -12 f0 -( ) show -31.5 456.5 moveto -12 f2 -(1995:) show -59.4 456.5 moveto -12 f0 -( Mortal Kombat ) show -139.7 456.5 moveto -12 f2 -(\(soundtrack comp\)) show -230 456.5 moveto -12 f0 -( ) show -31.5 443.2 moveto -12 f2 -(1995:) show -59.4 443.2 moveto -12 f0 -( The Tyranny Off the Beat \(Off Beat/Cleopatra\) ) show -292.6 443.2 moveto -12 f2 -(\(comp\)) show -326.5 443.2 moveto -12 f0 -( ) show -31.5 429.9 moveto -12 f2 -(1995:) show -59.4 429.9 moveto -12 f0 -( Forced Cranial Removal \(Fifth Colvmn\) ) show -259.3 429.9 moveto -12 f2 -(\(comp\)) show -293.2 429.9 moveto -12 f0 -( ) show -31.5 416.6 moveto -12 f2 -(1995:) show -59.4 416.6 moveto -12 f0 -( Dreams in the Witch House \(Grave News\) ) show -269.3 416.6 moveto -12 f2 -(\(comp\)) show -303.2 416.6 moveto -12 f0 -( ) show -18.1 403.9 moveto -3.3 3.3 c fill -31.5 395.8 moveto -12 f1 -(Vega, Suzanne) show -106.8 395.8 moveto -12 f0 -( ) show -31.5 382.5 moveto -12 f2 -(1992:) show -59.4 382.5 moveto -12 f0 -( 99.9F ) show -298.1 396.3 moveto -12 f2 -(UBL Card: ) show -355.4 396.3 moveto -12 f0 -(2088) show -379.4 396.3 moveto -12 f0 -( ) show -18.1 369.8 moveto -3.3 3.3 c fill -31.5 361.7 moveto -12 f1 -(Vinyl Devotion) show -108.5 361.7 moveto -12 f0 -( ) show -31.5 348.4 moveto -12 f2 -(1994:) show -59.4 348.4 moveto -12 f0 -( If They Know You're Trying ) show -18.1 335.7 moveto -3.3 3.3 c fill -31.5 327.6 moveto -12 f1 -(Volume Magazine) show -124.4 327.6 moveto -12 f0 -( ) show -31.5 314.3 moveto -12 f2 -(1991:) show -59.4 314.3 moveto -12 f0 -( Volume: 1 ) show -116.4 314.3 moveto -12 f2 -(\(comp\)) show -150.3 314.3 moveto -12 f0 -( ) show -31.5 301 moveto -12 f2 -(1991:) show -59.4 301 moveto -12 f0 -( Volume: 2 ) show -116.4 301 moveto -12 f2 -(\(comp\)) show -150.3 301 moveto -12 f0 -( ) show -31.5 287.7 moveto -12 f2 -(1992:) show -59.4 287.7 moveto -12 f0 -( Volume: 3 ) show -116.4 287.7 moveto -12 f2 -(\(comp\)) show -150.3 287.7 moveto -12 f0 -( ) show -31.5 274.4 moveto -12 f2 -(1992:) show -59.4 274.4 moveto -12 f0 -( Volume: 4 ) show -116.4 274.4 moveto -12 f2 -(\(comp\)) show -150.3 274.4 moveto -12 f0 -( ) show -31.5 261.1 moveto -12 f2 -(1995:) show -59.4 261.1 moveto -12 f0 -( Wasted: The Best of Volume ) show -205.3 261.1 moveto -12 f2 -(\(double comp\)) show -274.9 261.1 moveto -12 f0 -( ) show -18.1 248.4 moveto -3.3 3.3 c fill -31.5 240.3 moveto -12 f1 -(Waitresses, The) show -112.8 240.3 moveto -12 f0 -( ) show -31.5 227 moveto -12 f2 -(1981:) show -59.4 227 moveto -12 f0 -( Wasn't Tomorrow Wonderful? ) show -31.5 213.7 moveto -12 f2 -(1982:) show -59.4 213.7 moveto -12 f0 -( Bruiseology ) show -31.5 200.4 moveto -12 f2 -(1978-1981:) show -87.4 200.4 moveto -12 f0 -( Best Of ) show -130.3 200.4 moveto -12 f2 -(\(comp\)) show -164.2 200.4 moveto -12 f0 -( ) show -18.1 187.7 moveto -3.3 3.3 c fill -31.5 179.6 moveto -12 f1 -(Wake, The) show -87.5 179.6 moveto -12 f0 -( ) show -31.5 166.3 moveto -12 f2 -(1993:) show -59.4 166.3 moveto -12 f0 -( Masked ) show -18.1 153.6 moveto -3.3 3.3 c fill -31.5 145.5 moveto -12 f1 -(Wall of Voodoo) show -111.5 145.5 moveto -12 f0 -( ) show -31.5 132.2 moveto -12 f2 -(1980:) show -59.4 132.2 moveto -12 f0 -( fpfpfpfpfpfp ) show -31.5 118.9 moveto -12 f2 -(1981:) show -59.4 118.9 moveto -12 f0 -( Dark Continent ) show -31.5 105.6 moveto -12 f2 -(1982:) show -59.4 105.6 moveto -12 f0 -( Call of the West ) show -31.5 92.3 moveto -12 f2 -(1986:) show -59.4 92.3 moveto -12 f0 -( Seven Days in Sammystown ) show -31.5 79 moveto -12 f2 -(1987:) show -59.4 79 moveto -12 f0 -( Happy Planet ) show -pagelevel restore -showpage -%%Page: 30 30 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -18.1 714.3 moveto -3.3 3.3 c fill -31.5 706.2 moveto -12 f1 -(Wang Chung) show -99.8 706.2 moveto -12 f0 -( ) show -31.5 692.9 moveto -12 f2 -(1983:) show -59.4 692.9 moveto -12 f0 -( Points On the Curve ) show -31.5 679.6 moveto -12 f2 -(1985:) show -59.4 679.6 moveto -12 f0 -( To Live and Die in L.A. ) show -181.7 679.6 moveto -12 f2 -(\(soundtrack\)) show -243 679.6 moveto -12 f0 -( ) show -304.1 706.7 moveto -12 f2 -(UBL Card: ) show -361.4 706.7 moveto -12 f0 -(2245) show -385.4 706.7 moveto -12 f0 -( ) show -18.1 666.9 moveto -3.3 3.3 c fill -31.5 658.8 moveto -12 f1 -(Westworld) show -87.4 658.8 moveto -12 f0 -( ) show -31.5 645.5 moveto -12 f2 -(1987:) show -59.4 645.5 moveto -12 f0 -( Rockulator ) show -31.5 632.2 moveto -12 f2 -(1991:) show -59.4 632.2 moveto -12 f0 -( Movers and Shakers ) show -31.5 618.9 moveto -12 f2 -(1991:) show -59.4 618.9 moveto -12 f0 -( Do No Wrong ) show -134 618.9 moveto -12 f2 -(\(single\)) show -170.6 618.9 moveto -12 f0 -( ) show -18.1 606.2 moveto -3.3 3.3 c fill -31.5 598.1 moveto -12 f1 -(Whale) show -64.8 598.1 moveto -12 f0 -( ) show -31.5 584.8 moveto -12 f2 -(1994:) show -59.4 584.8 moveto -12 f0 -( Hobo Humpin Slobo Babe / Eye 842 ) show -242 584.8 moveto -12 f2 -(\(single\)) show -278.6 584.8 moveto -12 f0 -( ) show -31.5 571.5 moveto -12 f2 -(1994:) show -59.4 571.5 moveto -12 f0 -( Hobo Humpin Slobo Babe / Lips / Eye 842) show -31.5 558.2 moveto -12 f2 -(\(single\)) show -68.1 558.2 moveto -12 f0 -( ) show -31.5 544.9 moveto -12 f2 -(1994:) show -59.4 544.9 moveto -12 f0 -( Pay for Me ) show -119.3 544.9 moveto -12 f2 -(\(EP\)) show -141.9 544.9 moveto -12 f0 -( ) show -31.5 531.6 moveto -12 f2 -(1995:) show -59.4 531.6 moveto -12 f0 -( We Care ) show -31.5 518.3 moveto -12 f2 -(1995:) show -59.4 518.3 moveto -12 f0 -( I'll Do Ya ) show -114.7 518.3 moveto -12 f2 -(\(EP\)) show -137.3 518.3 moveto -12 f0 -( ) show -31.5 505 moveto -12 f2 -(1995:) show -59.4 505 moveto -12 f0 -( Hobo Humpin Slobo Babe \(3 mixes\) ) show -241.7 505 moveto -12 f2 -(\(single\)) show -278.3 505 moveto -12 f0 -( ) show -31.5 491.7 moveto -12 f2 -(1995:) show -59.4 491.7 moveto -12 f0 -( Hobo Humpin Slobo Babe / You and Your) show -31.5 478.4 moveto -12 f0 -(Sister / Singer Star ) show -124.8 478.4 moveto -12 f2 -(\(single\)) show -161.4 478.4 moveto -12 f0 -( ) show -298.1 598.6 moveto -12 f2 -(UBL Card: ) show -355.4 598.6 moveto -12 f0 -(3790) show -379.4 598.6 moveto -12 f0 -( ) show -298.1 585.3 moveto -12 f2 -(See also: ) show -344.7 585.3 moveto -12 f0 -(www.vmg.co.uk) show -424.4 585.3 moveto -12 f0 -( ) show -18.1 465.7 moveto -3.3 3.3 c fill -31.5 457.6 moveto -12 f1 -(White Zombie) show -105.1 457.6 moveto -12 f0 -( ) show -31.5 444.3 moveto -12 f2 -(1992:) show -59.4 444.3 moveto -12 f0 -( Nightcrawlers: the KMFDM Remixes ) show -247.7 444.3 moveto -12 f2 -(\(EP\)) show -270.3 444.3 moveto -12 f0 -( ) show -18.1 431.6 moveto -3.3 3.3 c fill -31.5 423.5 moveto -12 f1 -(Wilde, Kim) show -90.8 423.5 moveto -12 f0 -( ) show -31.5 410.2 moveto -12 f2 -(1981:) show -59.4 410.2 moveto -12 f0 -( Kim Wilde ) show -31.5 396.9 moveto -12 f2 -(1984:) show -59.4 396.9 moveto -12 f0 -( Teases & Dares ) show -31.5 383.6 moveto -12 f2 -(1981-1993:) show -87.4 383.6 moveto -12 f0 -( The Singles Collection ) show -203.4 383.6 moveto -12 f2 -(\(comp\)) show -237.3 383.6 moveto -12 f0 -( ) show -18.1 370.9 moveto -3.3 3.3 c fill -31.5 362.8 moveto -12 f1 -(X) show -40.1 362.8 moveto -12 f0 -( ) show -31.5 349.5 moveto -12 f2 -(1988:) show -59.4 349.5 moveto -12 f0 -( Live at the Whiskey-a-Go-Go ) show -209 349.5 moveto -12 f2 -(\(double live\)) show -269.9 349.5 moveto -12 f0 -( ) show -18.1 336.8 moveto -3.3 3.3 c fill -31.5 328.7 moveto -12 f1 -(X Marks the Pedwalk) show -143.1 328.7 moveto -12 f0 -( ) show -31.5 315.4 moveto -12 f2 -(1994:) show -59.4 315.4 moveto -12 f0 -( The Killing Had Begun ) show -18.1 302.7 moveto -3.3 3.3 c fill -31.5 294.6 moveto -12 f1 -(Xorcist) show -68.8 294.6 moveto -12 f0 -( ) show -31.5 281.3 moveto -12 f2 -(1991:) show -59.4 281.3 moveto -12 f0 -( Damned Souls ) show -31.5 268 moveto -12 f2 -(1993:) show -59.4 268 moveto -12 f0 -( Bitches ) show -101.4 268 moveto -12 f2 -(\(EP\)) show -124 268 moveto -12 f0 -( ) show -18.1 255.3 moveto -3.3 3.3 c fill -31.5 247.2 moveto -12 f1 -(XTC) show -56.8 247.2 moveto -12 f0 -( ) show -31.5 233.9 moveto -12 f2 -(1982:) show -59.4 233.9 moveto -12 f0 -( Waxworks ) show -31.5 220.6 moveto -12 f2 -(1983:) show -59.4 220.6 moveto -12 f0 -( Mummer ) show -31.5 207.3 moveto -12 f2 -(1984:) show -59.4 207.3 moveto -12 f0 -( The Big Express ) show -31.5 194 moveto -12 f2 -(1985:) show -59.4 194 moveto -12 f0 -( 25 O'Clock ) show -300.2 247.7 moveto -12 f2 -(UBL Card: ) show -357.5 247.7 moveto -12 f0 -(1044) show -381.5 247.7 moveto -12 f0 -( ) show -18.1 181.3 moveto -3.3 3.3 c fill -31.5 173.2 moveto -12 f1 -(Xymox) show -68.1 173.2 moveto -12 f0 -( ) show -31.5 159.9 moveto -12 f2 -(1985:) show -59.4 159.9 moveto -12 f0 -( Clan of Xymox ) show -298.1 173.7 moveto -12 f2 -(UBL Card: ) show -355.4 173.7 moveto -12 f0 -(1295) show -379.4 173.7 moveto -12 f0 -( ) show -298.1 160.4 moveto -12 f2 -(See also: ) show -344.7 160.4 moveto -12 f0 -(isvpc146.isv.uit.no) show -435.7 160.4 moveto -12 f0 -( ) show -18.1 147.2 moveto -3.3 3.3 c fill -31.5 139.1 moveto -12 f1 -(Yamashirogumi, Geinoh) show -157.5 139.1 moveto -12 f0 -( ) show -31.5 125.8 moveto -12 f2 -(1990:) show -59.4 125.8 moveto -12 f0 -( Akira ) show -92.7 125.8 moveto -12 f2 -(\(soundtrack\)) show -154 125.8 moveto -12 f0 -( ) show -18.1 113.1 moveto -3.3 3.3 c fill -31.5 105 moveto -12 f1 -(Yazoo) show -63.4 105 moveto -12 f0 -( ) show -31.5 91.7 moveto -12 f2 -(1982:) show -59.4 91.7 moveto -12 f0 -( Upstairs at Eric's ) show -31.5 78.4 moveto -12 f2 -(1982:) show -59.4 78.4 moveto -12 f0 -( The Other Side of Love ) show -179.3 78.4 moveto -12 f2 -(\(single\)) show -215.9 78.4 moveto -12 f0 -( ) show -298.1 105.5 moveto -12 f2 -(UBL Card: ) show -355.4 105.5 moveto -12 f0 -(4309) show -379.4 105.5 moveto -12 f0 -( ) show -298.1 92.2 moveto -12 f2 -(See also: ) show -344.7 92.2 moveto -12 f0 -(rt66.com) show -387.6 92.2 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%Page: 31 31 -%%BeginPageSetup -/pagelevel save def -54 0 translate -%%EndPageSetup -newpath 0 72 moveto 504 0 rlineto 0 648 rlineto -504 0 rlineto closepath clip newpath -31.5 709.2 moveto -12 f2 -(1983:) show -59.4 709.2 moveto -12 f0 -( You and Me Both ) show -31.5 695.9 moveto -12 f2 -(1983:) show -59.4 695.9 moveto -12 f0 -( Nobody's Diary / State Farm ) show -204.7 695.9 moveto -12 f2 -(\(single\)) show -241.3 695.9 moveto -12 f0 -( ) show -31.5 682.6 moveto -12 f2 -(1983:) show -59.4 682.6 moveto -12 f0 -( Situation ) show -108.7 682.6 moveto -12 f2 -(\(EP\)) show -131.3 682.6 moveto -12 f0 -( ) show -18.1 669.9 moveto -3.3 3.3 c fill -31.5 661.8 moveto -12 f1 -(Yello) show -58.1 661.8 moveto -12 f0 -( ) show -31.5 648.5 moveto -12 f2 -(1980:) show -59.4 648.5 moveto -12 f0 -( Solid Pleasure ) show -31.5 635.2 moveto -12 f2 -(1981:) show -59.4 635.2 moveto -12 f0 -( Stella ) show -31.5 621.9 moveto -12 f2 -(1983:) show -59.4 621.9 moveto -12 f0 -( You Gotta Say Yes to Another Excess ) show -31.5 608.6 moveto -12 f2 -(1987:) show -59.4 608.6 moveto -12 f0 -( One Second ) show -31.5 595.3 moveto -12 f2 -(1988:) show -59.4 595.3 moveto -12 f0 -( Flag ) show -298.1 662.3 moveto -12 f2 -(UBL Card: ) show -355.4 662.3 moveto -12 f0 -(1506) show -379.4 662.3 moveto -12 f0 -( ) show -298.1 649 moveto -12 f2 -(See also: ) show -344.7 649 moveto -12 f0 -(newton.space.net) show -427.3 649 moveto -12 f0 -( ) show -298.1 635.7 moveto -12 f2 -(See also: ) show -344.7 635.7 moveto -12 f0 -(rt66.com) show -387.6 635.7 moveto -12 f0 -( ) show -18.1 582.6 moveto -3.3 3.3 c fill -31.5 574.5 moveto -12 f1 -(Yes) show -50.1 574.5 moveto -12 f0 -( ) show -31.5 561.2 moveto -12 f2 -(1972:) show -59.4 561.2 moveto -12 f0 -( Fragile ) show -31.5 547.9 moveto -12 f2 -(1975:) show -59.4 547.9 moveto -12 f0 -( Classic Yes ) show -31.5 534.6 moveto -12 f2 -(1980:) show -59.4 534.6 moveto -12 f0 -( Drama ) show -31.5 521.3 moveto -12 f2 -(1983:) show -59.4 521.3 moveto -12 f0 -( 90125 ) show -298.1 575 moveto -12 f2 -(UBL Card: ) show -355.4 575 moveto -12 f0 -(1038) show -379.4 575 moveto -12 f0 -( ) show -pagelevel restore -showpage -%%EOF - ---------------167E2781446B-- - ---------------outer-- - -eof. diff --git a/tests/ui-tests/test-multipart-mixed.msg b/tests/ui-tests/test-multipart-mixed.msg deleted file mode 100644 index 5216c6d6b6..0000000000 --- a/tests/ui-tests/test-multipart-mixed.msg +++ /dev/null @@ -1,377 +0,0 @@ -Return-Path: -Received: from thumper.bellcore.com by greenbush.bellcore.com (4.1/4.7) - id for nsb; Fri, 28 Aug 92 15:13:14 EDT -Received: from flash.bellcore.com by thumper.bellcore.com (4.1/4.7) - id for nsb@greenbush; Fri, 28 Aug 92 15:13:12 EDT -Received: from COSMOS.VLSI.CS.CMU.EDU by flash.bellcore.com (5.65/1.34) - id AA24840; Fri, 28 Aug 92 15:13:07 -0400 -Message-Id: <9208281913.AA24840@flash.bellcore.com> -Mime-Version: 1.0 -To: nsb@flash.bellcore.com -Subject: mew-law encoding? -Content-Type: multipart/mixed; - boundary="PART.BOUNDARY.2418.16114.COSMOS.VLSI.CS.CMU.EDU.715029153.2" -Date: Fri, 28 Aug 92 15:12:35 EDT -From: beatty@COSMOS.VLSI.CS.CMU.EDU -Sender: beatty@COSMOS.VLSI.CS.CMU.EDU - -> THIS IS A MESSAGE IN 'MIME' FORMAT. Your mail reader does not support MIME. -> Some parts of this will be readable as plain text. -> To see the rest, you will need to upgrade your mail reader. - ---PART.BOUNDARY.2418.16114.COSMOS.VLSI.CS.CMU.EDU.715029153.2 -Content-type: text/richtext -Content-Transfer-Encoding: quoted-printable - -I recently got hold of a filter that davecb@nexus.yorku.ca wrote, and whi= -le -it's not perfect, at least I've been able to take the "No NeXTmail!" slog= -an -out of my .signature. And now that I just thought of such a terrible pun= -, -as is in the Subject: above, I couldn't resist inflicting it on someone, -and you seem to be the most appropriate victim. Anyhow, I guess this is = -a -"fan letter:" thanks for MIME. - - - ---PART.BOUNDARY.2418.16114.COSMOS.VLSI.CS.CMU.EDU.715029153.2 -Content-type: message/rfc822 - -26-Aug-92 22:15:02-LCL,22076;000000000000 -Received: from po3.andrew.cmu.edu by COSMOS.VLSI.CS.CMU.EDU id aa13358; - 26 Aug 92 22:14:26 EDT -Received: from sqhilton.pc.cs.cmu.edu by po3.andrew.cmu.edu (5.54/3.15) id for beatty@cosmos.vlsi.cs.cmu.edu; Wed, 26 Aug 92 22:14:07 EDT -Received: by sqhilton.pc.cs.cmu.edu (NeXT-1.0 (From Sendmail 5.52)/NeXT-2.0) - id AA21178; Wed, 26 Aug 92 22:13:24 EDT -Date: Wed, 26 Aug 92 22:13:24 EDT -From: beatty@sqhilton.pc.cs.cmu.edu (Derek Beatty) -Message-Id: <9208270213.AA21178@sqhilton.pc.cs.cmu.edu> -Received: by NeXT Mailer (1.63) -To: dragel@sqhilton.pc.cs.cmu.edu, beatty@sqhilton.pc.cs.cmu.edu -Subject: mail from Wacky -X-Next-Attachment: .tar.192.mail_from_Wacky.attach, 23976, 1/1, 33000, 0 -MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary=n2m-MIME-boundary---------- - -The following is NeXT mail translated to -MIME format with n2m. This always starts -with a file called index.rtf, which is -the actual mail message in Microsoft's -proprietary rtf, containing references -of the form "\attachment " -referring to the other components. - ---n2m-MIME-boundary---------- -Content-Type: text/plain; type=microsoft-rtf; name=index.rtf -Content-Transfer-Encoding: 7bit - -{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} -\margl120 -\margr120 -{{\attachment0 VoiceMail_beatty0.vox -} -} - ---n2m-MIME-boundary---------- -Content-Type: audio/basic; name=VoiceMail_beatty0.vox -Content-Transfer-Encoding: base64 - -LnNuZAAAAJgAADsAAAAAAQAAH0wAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+cW9ze/Lg09XT -09/d7W/56e30+HH29/vybf/x5eP6dm11b2FeW1dXV1xjZXR5b23+dmBaXmRoa2psb/9wcXLy -6OTZ3ev+WFNYW3zk3dPNzs7N2uj0aWxqXmNjWlxfcOrk2tjW0djqfWFUTkpKSktOV2NgW198 -/Pfp4Nfb3+Hz+2piYFpt/Pbr9f1uZ3P23tTY09HT2PF0bGJmbXLv4Nza3+j8b2pfW1po+vDk -82plY15ZXFxeXFpoaGRsXVVXXGFibO7f1NTc7Gx4fGrw39rX3dnd83dtcv/m3t7h9vrn72ln -YWFdXW57cmhpY2VkaftybW9lbnBoYldYYWf67f9nX19lfHJ89fD6cG59++Xe4d7b2tvc5OPi -3+Ht5OPo7Pzx9PnzeG5xa2FhW1haXV9YWllYXV9tfXJraGllZWFt9+XZ19bb2d/veGRfWltl -c+ji6/b9b2hoaP3c19fY4Pj15+Pd09HU0tjlbF9ZS0lJS1VhZmZhY2RdX2ReZV9ibG3+d2df -XWVte/r983z7eWZmX2d+7tvV087O0c/P0trj/3ZtaXNx6+z68Pv6d3b28e/m7HphU05LTE5R -XGd0697W1+Hn7/ZsXFZST0xOUVZcc+3k29fX2Njd4up8bv3s4t/d3tnZ3Nvg4vn8+WpxfmJc -VlVYWWlv69zb2+NsXF1eX1RRWltfWVhdVlFTWGrs3tbW3N7i5u18/Hb/7Oze2d3j4O94eHR6 -++vv8erv5+ni5e/s7//w3uXv/2deWVhYWVVYYWRiZWNr+nFxY15jVVlfW11kX1/939na39rT -0NLX2+TpfmNud/vxd/Tq2s/S1tnjemlgV1FQU1pjbHJ18vDq6v50ZFxVVVdQUFBNU1lXYXXk -2NjZ2t77YF1iaW9w+ODe2dTR0dzh7fx79urm3d/r5fL09m/0/XdybGxqYl1nbfTp5t3c3eV5 -XVdNS0xLUldcb3j5/+7n7HlkaWddX2xyem53/3NzduPW0M7P2+t3fv1tfvzs39rZ2d3v7vdv -Z11ganL4+3JlW1tfX1tebG5sZ1xQSk1QV2br3NrZ1tTj7u9oX19j++rh4fv07Ore2tva2tve -aVlZVVdcavnp2tLO1eh7YlhVVVZaXF5eYm/89Hx1en7s4t7n6PNpYl5XVFxu/PXi3ur1/Xxv -ZGVmXV1lbu3a1trY0dHV2dnf9vbu83FlYVtlfHL07uvnfXNkVVBMTU9SYWlxbWZqZl1XUFBb -Z+ve9Oze3dXZ4eXj3NPW3uh9/2x37u3h4ufp6+z2dWxgbHhpb373+fHve3FpZWxscfbvfW9f -Uk1NUVNbbmtpfHh+7eng63vv8Xt7a2Ztbe/h4N3e2t3f3N7o6vbq6vz07e3yeP3qdm/57/T3 -/n309nZtZlhWWFdYXGRjW1ZbXlhSUFRdeefh2tTU197d2uXufW9tZF1YXmd99nfw8ebf7e/s -6ejr8vH9+urp5N3W1+Dt83dsXVlfXl5hXFZVTk9QU2VvbnJy/ezr6Ojl5ffv7/Dq+OXl3tri -6O7x7+rm3dLT5X5lX15cbXZ3/v7s7HJfWFZVX37r5vrv3ud5aGFjX15dWFdWU1NRVlpbYWFs -/e7l7vdybXBqaf3n29LS0c3O1t/Z1dbZ2NjY229mZmBpZGNdX2tiYmNbW1xgaGVqZGFgX2Jt -fWttaGl0eW1pZ2jq39nceGRZVVhbY3zx5N7b2Nzi7eXe2dLP0tfe4/X79XH6/Ovi5OLl43dc -V1lYTUpLT1FPUlBTXWVqbnbt5O14cWtmX1NUXvjb0s/OzdDW5/94ZGBlcvZ2dHl57OTf3+je -5Ozs9fZ89H1tal9lZ3Dx/25nbHt4evxybGtqbmNfXVlZXF5fY1tTXHrr6Orf3uXn6ur3aXN7 -/d7d1s/RzdLV1+Dk5uHl9v/9bmVfW1ZTV1VTVVJQWFRPWGJ95t/h4eXu+v31/v96cG5jXl5o -Z2p19ev8cmplZmhsdfTr5Nvc2dbU0dve4+no8/j2+Ozk3N/vbmdlW2JfVlZWVFRUUlZcY299 -bHrudW5iXGNeX2NvbXrk29HR0tbb5ubk693Z19Xj6OL4e2tfWFZbXWZ5bGZjXV9ocfTr4dbe -49/5a19j+ent7n3s/V5ZTUtMSk5UXmJhdO7g4ejf6ezg5t3Z4ud8/+3n4u/p593c6eLm4Oh4 -dl9rfHrweXBsY19scmxtXFhZVVVOTVFTX23y4d3e7fTr4t/f5/jy7vZrWl1u9NnV0dDZ3fho -XmV6d3RjdOl7dGtkX1xnfuzWz9HV3+XzamJcW2FXVVtcZmlmaGBibfHp9HhiXV5ZVFNZZ23h -1NPP0Nj0Z11kePTq3tna3u93bXN77Onq5efubWFiaWxpamdvemtlXF1eYGBhYlxoaWRsa3j9 -fW937Ojm7+7l5+v07+7/ff979vju7H5vanv9dfLi3+X77+De4fbt4er/efr/fPjk4eDe3up5 -YFFLR0ZISkxPVmP96+jn3dzd5u36cP78fPvud29+9vHt4+ne19rlbFpQVVlbaXfq7unV0tzh -9XTx+vdyXl9XWGBeWl9zdPbm5OpybnppbGlnY2d3fOrj5ezz+HtlX2Zpam997+zl3NbV3OXv -eG5tb+/s6dva19fV3PL/eG5iU01LSEhIT1pqevjc1NfW1dvqeGJsaF5gXFpcX2FgXV1p69fS -z9fn9Wty/P3u7N7X3ePq8HhpbmlhZ25++HFhV09NT1VaX2d0ePvq3+Dk6ufo6ubf3+95cWZZ -VFVXWlxYW2Fo89vV2NTPztXg7vbl5O/q39ve5Obp63z97f95//11bmJaVlBYYmZ78fHm4fNj -WVhcX19eW1tbV1RUV1haZWv04eDm+/jq5ePj29jQzMvN0d7u6ndfW1xic/1uZ3F2aGpva/Pt -5N3l7mNbVFNeXWRsfd/j82NXVFBOUVVZWlx1ePvw/ejo29DMzM7R2d7vcl9bZvfh3OD1dGl0 -ZV5jYn7z7eXt5+Pr4uf7+XhtY19kYGFbXWtwdPj9fvrx82NSTExLTVpefeLh3tzZ3NbP2t/e -625nb3d6fvv16+Hf4ux1aGZjZ2pzc3Pq7Pf7dnD9+XxwZGNhVVRUUFVaX2Rrb25rbW5oZWV5 -7N/Y2dzl5efc19zi7OTs+nj68fDv6OLn7u/1fu37bGJUXmds7u/l5np+8fp5/P7792tcX11W -T05UWFtncnVxbG13/3vq5+/s7+zxdG58/Hv/9e3r4d7Y2dvX3+rtfmtsbHXt3t3f3+Df7Hpn -X2FbWVVPV09OVVNUWl1jXVNXV11oX2Vlb93U0M/OzdDNz9PX3eZ5dm9kXFtZXWhraGVy+uzf -3+Xk6OTu9nx0/Wxufu33ePT073t093txZ19dWVlYXmBZXWBrfv/+/Xr+831++nX+7PD7fOvf -2dPY3ub16tzb3eLn5nppaGBlW1xdVVhUT1JPUVlbYmh9/m95a2xrfOvg2tvj5+n9/3Jo+319 -+Pzu/Xj/efj+aHHu6ert3t3f3dzb3uTs7OXi3+ri3+fr/mdfXVtdXWFeXFxdX2BeXFZRUFRX -UVZdYWhv8ebh397d1dDY2Nbe5/dtaW3t4t/d4+Dg8/T15+vf2flkXltYWVxfX2dob+7p421Y -V1FTUlRbYG1v//T+bGVoZWht8+Pr9v9pXmRofOjf1NLb3N7zev57fPHu6eTp5ezp397l4ebq -5OLi4Nzna15YVVxaWF5lY1hYWVBRV1lcbPLp5uLf6PHv5enq93ZgV1ZVWF5gft7b1tfc4N/l -8+jo4dXV1dTU2On2+2dfXFpXV1dPTlFbX1laYHB0c3dtZ1tdZGJk9e/46eLj7HpqZmZibe/k -297t9XR99/7p4dnRz9Lf6+13ZGR373FfYV9eanF97u/b0tTb7+7+X1hTU1peY37/9GpdXVdX -WFtkdX53ZGFcWFxhanH139nU1dvW1tzY0s/U1tLT19zo/3tdUltaXWJkdX11ZFpaWltdW11l -YV5aWV9aW19p+nj/7/t0eO75anRvefFoZnVmaGdr+fLp5+TWz87P09TT1ePr93lmXWRdXmx3 -79/d3+fz8356fmddXWNdWFlXXmFdXVpZWVpjc/Xo8fLw9+Pe19DQ0dvsbV1gYV5cXW/t7Ovg -3epzdfvm3+vs7v59fWRfZXb/9/NvdP13bGNcWFZYYGhsa2dhX19ZVllbXlxpenH97+fd2dTU -3e3/5Nzt9vj44tjV1tna3uXtaWjz83doZ19ZVlNXZXNoaHbr3ehybG1u/ejyfHhqXFdcW1tq -cujd5uzv7/X8a2NjX2VrZG91b+3j2M/Nzs/P3ev1amJz+//u9HR5dWxrZltYVltibfVyYmNe -VlRUW3VsX2JZU1hUU1dbeeng3eLc297h4tnY0s7R1Nvne19fXVtq//Pt7OPj5uPv7+n9//dz -e3dvbWVgZGV47OXf6u52X2BhXlxbWlxfZFxaWFleZ3p5/unu/HhlYmp149rW2N3Uz9XZ3Xxv -fe7h4enzdfnp7+7r393l7HZWU01JSkdKTk5RW2N1/f3u7u7n5Ofq6PNvbGpjaXD74t7d2NDS -2ufue2ZwaV9eXGRuYmb66Orn393e2tzg5ern821iXWNnaGNqbXP9bntzX1tVVVhXXW567eLb -2ujzamVvZHHz/vfs5t/g93VsbOrn7/VoYmz23dvb2dzb3Nvb2NvtcmRcVU9NTExPWmdrYFdV -U1xeW2Vrcmxq9XRlY2P88+vZzsvKy87Q1OF3ZFtVVFNYYm70397p6PN98fTv5une2+Hp7/j4 -9GxdaGNhblhRUk9OT1ZfaGv67uro7uzh5O7x9+/t6u5+fv729n3p5ufr6u58ZVxXU2Pu593Q -ysbIz9Tf5exrc2hlXlNRT1ZcYV5XV1xfW11fXV9aWGJjau34bPt7b3doX1hYXGfx7uTY19vn -9uzm8/rt69na2drk3dva1tznfWlfYVhWW1xgWV1zamt17eHi4+n89vRuYmN3Z19nZWxfXGhg -W11ibnl7dnf1+fbi2tDQzczSz87S2Oh5al9eXWRtcHBpamNfXGJfXG3+/29kZV1aWFRUWWBp -bXN0eHz+em1dV1lYXGp2b/T+/Ofk3djUzs/U2d/5//NveGpibnvy7eLX1tfa6vd7/f1vemNc -YlhYWFpcXWBkbmNlZFlgaXJqWl1XVldVXHjl18zGxMXH0e59altWVFVcaHL15dza2dfX1tLa -3dzv/2NcXV5z6t7q6u96clxXVllXU1dVU1RRT05PUl1cXHL87n59eX3x/vXr39rY3Obt/nty -bnrk2tfc3Nnt6tzd3tvb2tvkdF1VT1RXVl1cWltbZG1lZW1+6eHb19ra2uHmb1lST1NWVlJV -WXHm5dzX1dTX1tnf5X1yZ19gW1tv7NvV0M/T2Nnfffx+aGReV1RPWGBaW1xneHd6eGxsZ2Nm -XVpaXWNubGRaVVZYavHe1tLR1t3e3O365t7c4fHs6uzw7/J2dGtufGxtcW1xdHNpX11gYnLn -5PRvZV9cWFhm/+Ti5fFweW9sZWlkX2JqdW747vDd3d3T2+vs4NjX3uXub3Vlb/N88O94cv9y -bPj8+Hhsc37p/19bW1pgXFpZVVpYX29m++ji3eLj4fRtXVZRU11ZX296fvrn6N/c3Nne6u3p -6PHx6N7c3eLo5+7i2+Lj83Ryb2Nea2RhXF1eVE5PVFhga3JsbGVrbV5pb2lubG729Px78d7e -6Onf3tjT0Nvo5e7t+ntvaPr05eDs7u7i4+31fPtxYmhcXF1ZWVteaXn+/Xz8bWFbU1BSWVxg -aXjv+21rdnF0c//+5trf29na3eba2Nne7/R2/WVeY1xcY3rs5+Hc3uv6dmZgX19pbmRteG9o -Z2djbHhwYV1cWVlTV1team156dzi39/i2+Dv7urh39XX3d7e3Nzh7vL092xobnv/eurl4t3h -5uxxa2NaWFZaWFhZV1pfXlxXWWVw7urreGRrffv88+v8/WZkamRkYG748ere3d/p5PdldVxk -a151eXT97t3W1dDS09DY5WtlZGVqZF9hamhobG1pXFdcV1NZXmZiYmJfWl1qb3n94NvV1tnY -393z8eLs4d3b3/Hf6O/1ZGZ3bfzu9uLk/GhcX15p7Ovl73NtYV1gZGJufHF89X399fPlbV9p -cndfZFZQVVBba354YV5gYWn86d7Sy8rLztze6nZlZXdsdff4fX11bfbn5/D7dmRZVE5MTktM -V2f593pkZG17/nTu3NPO22xdbO7o7N3Pzc7X1dTa7Whu/+19aW1cWmdeWFNRYmlk/fTf1t3m -6+Pe5Hrm3uTkam5nWllQTE1NTmdrYmlu5etzaGFjZ2Nq7m/x52/s9ffc0srL1d7f/HV2bvJ7 -9ebe3+Lrb/5hXFlaaFJOWVlaW01XcltmX2DseG/t5ej7Z/fb5d/v7t5xeenn5+j95t996295 -c1Zlef3/+OvT1eHeam/vaHTv5eHpdOPvYnJd+/Jd9e/5bF9cWFVQaXDq3XnscGNnXltjWk9h -XmplTllYX3lv6M7MzMbP0tTm1dfa09vse2tbXk9PVk1bY2zs93T193Xva2piWWpwYV1eW2xl -YO324d/s2+ns61xOVU9PWlj24+/Ry8rKzc/N2vR8XWdmWmZqZmds+eJ+/e3t5HdmYmJeXVxf -b1xx6+jg5dnX321na2x+WV9tamhRUFlbWVtd/OJ05vJ2dV9kcuHV0trR1e7Z3dbc+frv3vP7 -bX1eVFtYal9cafXd7uv++F5TW1RcVE9cbn1lZmpyV1t0b9zf29HQ2vTm93leaPz82+Lc6HBp -Vltq/mbr3O3Z3tjT2N3u3+znbnV5aHVTXW9sYllsYWJcZm5o6WRk+m9yanZcU1BUW1v8+ezm -49zt2Oj06vvb6t3gdP1x7ufb2tnb39vs6XJXV1lgZHFpbfh0+11mYVZkZf1pffxtZlNVT15l -XX545vLvfHJ5ZeP14Odl697Y6un3ce5z8Xju39/b29Ti3t/p6fbg9u5vWl1ZXU5SW2dvXfr2 -fHJfW2BgWG7v6W5q7WFnYllt9+D/7edxW1p9+uTm4dPKyNna5fxta3JfbGR14NTP5+f2enhv -7Ork4fdyYllNTExMS1d7YXduWldRTElf83n34dff4eTt/nh+bdra/HZod15jbF9ndN7ZzcbO -0tTT6O7b7uTf3+975l5OU1pZYuH1fvH7YFFeUFlmaW9k7GFXV1RYUmdcYOfs91xuYFp1b31r -29TWzNDU5djZ3tHa2OzZ319uaPV27OHy2el9X2BuW19dWlpZYFVST05SXm9fa3n7aV9pZnJh -Xm357OnudfDvb3Tw4dzd393m4O5gdW136dfLztTf2djV1e78Zl9TTFlZV1lZbunf6X5vam9u -9n5bYWFfaWVmVVJVWFtd+m9ka2l8/+Xd2tXa2eTm3eLl6N/2/uPe2ebq/nXe4PNsZn1u893h -eWzyZmR5ZVlbW1ZUXlZNTlFYUVxpW2dqZ3bq2vDz3dvd6t7xbXhncejY3+ni9+bs6Ofs3/b+ -6eHj49/m6ubr9O3feF5jaWRmbG5eXl5UYHF6Zl1eXGV3c19fZldfbH5+eftsavbm93n5c2v6 -4dnc5nV66+v493pr6t/b1tXY4vTs397Uz915bnBdW19VU1VUW1tnXlFWVl5obW9eZGZdXFlg -WVJYYurj4+Hj1dXTzs/L1+Dd4N/r7uxuaG7u59/f825kYF1kbGhaUVJYW2dnYGx+6/7v2ufs -9XJ+ZHBfVVdXXVvr1+jk39zxdup1aGNzZGff5v3w3N3o29Hd9PVqa/3sfmVvem923djee3dz -dvVqV09XXVpodmhbWWVqaXBoVFReXlxbbnxfYP3te/n7W2fu6+/XyMrOz8zQ1c/c6Ozs8nPb -23NdXGVXU2FfTk9UUlpjZllRX2ll79nZ4N7d3/jt/Vdd8+lwZnZrYWViXF/5cmBj/uV49OZu -af/t9uPP1uLi0MzXz8vV7Pd0XX3id15h/2FYanNdVFlaWGRtXFFNV1JQanx0Yl9vY/n6W1dd -5e1y3uFwfN/Z3tbT2+rr3+vp39vm/u/0fN/Z6nt+9l5Zef9dWWVlbOnyfX11b2dq+PNdWGZm -Xm/+Zl1cYFtm/WVVV3NgauHc3+7f2dzb2dv7at/e49nk+Pnx9e3l2tfscndcW3Roa2Vo5tfe -4+RvXGlrY/NqXV9MSElLVVROTFhfYevv+unt3dXf3tve7+bZ3NLX7G9h8eHm4t/ucf5pWm1u -ZXho++J49+94bP35dt/h7HpaX2VicmheXGZqX+zm+HFXXGZfZ21dWmpnZ+ff4/9p9eze3uL4 -59bf6dvX5vjx5Nba2tnm397vYmhvXV5UWF9ZVlxZV2psaeLsd/9cXW5kXWFSTVJPTV9taHl2 -6dzd5djW6dnU39TW5v9faur+au7s9+jh9N3fdvZmY/DufOzj6e/yYnjuX2xWVW9qanJra2Vi -W334XV5WVGNmWltdY27r8d3Z79/rcefe9+ff293b3dnX9OfwX/bq7OPs8WX+9nF6XP7tVnzc -bGpobV9dZW75X2ZfSk1RSU9aZ2v42dXW693fW2zfbnHx6f128P31aWn8XXzT4Ord2+Xm09LO -29nO6PzlWU1OUE5KVV/3eHHoWVnrY1pud29eY19eXFdkWF3Ny9nR0eJ0+n3v/2n0a1/Y21tk -bGNccOHb2tTL3Xva4F//3Oxpeuf5/29yV0ZSZVRab3ds6Nfe6vjyWEdXZE5RX1RPWmV5++/Y -1uPVyt7p1uVra/n/e/Pq6WBj1uX70dji5t3e7vxwYU5W9V9UbnhqePPq3+jo4mtZcFNET05O -UllfZH3s5WBb5uZm4Nnm493V0NXRz+T22NZu+21dYGZya/n68G1d5etZ5+B0+3Zvd+Pe331W -ae5bdvBgXVxbVltVWlhQcfJo3dPu9vX99uzu7GpX+uVp+upmXF1h7dfc3Opq39R689746NjT -1NTf4nZXZWtOUlxPUVlSTVVRUlFNb+5n7tPa4t3j8+3z4uB63tlxd9t+ZvL/b+7w6vxYZvdZ -Ydvd2tDP2Nvf4vldat92etTd7Ox3XWNfZmRQUlxTUmtaU11jZPvo5eVoXnFfVuvqcPbxbn3/ -ZV5XY+PffNPY8fP55t7Y2Nro9tbUeuTpZGJaW2BoX1xVUV12W3fsXm348/9samthXXjfaWjn -b3b2dfbt9nddV27hXlb0/e3j4eDf2tvpbnPf6fPT5vXd4OXf4drl/O7t/GTpemNr/3N4d11X -TVBcU09naGNmc3r17GZmWVRfbmD37m1seG1o7G/959zQz9ve3+t5evt33+Lj6X3/cVZWYGd3 -/PTv3P5eVk5NUVlh5NzS1d777OxfWE9QXHH02d7b2Ptj8+Zzcv1wbv1teWdrdmZq39LU1NTa -8/xt/2peZVlY/9jmevX3bPDq5ubu5fJreN7vX15ZUVZYTU5XZGhYZ9rd/H1rVlZpbGNy5t7v -69jb6t3X4PXZ0+7q2uJqW/niamNrZFdu8l9eeXZPU2f8emvo8Wbj1Hd43u9XTFn0aVljcWNs -3Hxe99/scOvZ3ujm9WFm4WxZ7tjrdOXW1+fg6FtPbu1l79rnc+jb1+Px625n5uVbWV9XTFBd -ZmRicVxSXX5jaOfoamtreOn09Whn7tba4dTY6fz8fevvZVxYV2JmZu3q/nrh1dDP1N7/Y2Zq -WFdXVlp29t7b7WtXUU1TW2z2fnt4X1/x9XNpfO7j2NjS3Ph3b3Lk3vlveOji6O53ZWFeXWTl -z9fua19XW2Fo7t7d3+fUzd9dT1BQX3zv3uPvb1FPY1pMTmFvb9vd3tvs+l9c/fldWGlfV2n0 -6ufXysrNxb/M3uHxW11nXFpfZ11XdedgVVVZT01cVFJaXlNLVvPq6+DU1drW3+Z7YmBRXNva -e19mYVltb2L83dXU0snH2fr+bFpkcGv8/O1tX3ni72ru43ru2uLq6/ViWXbc52tZUVNPXWtm -cW5hVlZw83BiYHp0c3loaX78aWjj0d3q593T0MzN09TY5mxo5vBeU1VZTE1SVl1s6/z32Nbe -ZGZlT01NTE5QWV5h6N7e5ObU2t7W19/o7GlVUmJcTk1bZ17z0tPX1Njd3trQ1ejl3t/s4995 -ev3u39vT1O9kX1NQW15RT11cV1pbW09LUVNPXuXf3tfY4Xt09nBYXWtlceXh6t7a2dTS1dHV -2dLW7OrZ7fDqcGFZVVlVUFVYWFxvZlZTU1FefeTlZFpWU1Rn+vXk3trd4t7Y521fXFhp/Ftd -YWN0c//o4eTb0Nba0+rv7/na1tHLyszS2+1eZ15XWFBaX15faGJYU1hXYuDh72hvXk1LTk1M -TFRdadrb1dva09TR1dLS2uLn7drc4fNj8ufv+e7n5m5tZ11pXlxVU1pgbW7/9WlfYWby7nRq -bu/e33F3bV1OTE9RY1xaX11ucmRrbvX9Z+zc09Dh39vOytLY3dTN49zT3Nh7WVdPXGBaan7k -blpxa/36dfhiZ3dgXVpdUk1YX219Z15fddvZ7mx+/FtbZmro5fvf2tTP2d3b2Od4aF5eXVZe -7NzN0ePd1tjkfndqbGBPUFBf+2dne3j7bWh4ZnxiTU5LTVVTXnPs53Fvbnf6YWTy4t7ydvbk -2NbUzszN1tXP1NHW6O1sWVRRV1575nr67vtrWV5gZWxpaml1/WVaZlxUV1FVXnj/Xmvm29ns -7npzeWddWV9gXF12593a3dXW083b59jS3XV2/HF3YWbj3dfX7+vk5vtlevr/aVFSTk1TTUpN -VVVLTVlr5eHc4/Xm7mdv8uxdT2Fw6t/+/3P63d/n3dDP4uLc4NnsZWxu8OP3/e3j73Ll4dnS -73Z3YWVQS1RYXVxea2/r5Pp5aWZkWVZZXmJi/erc1d/n5eXk9W1ye3L5d2R36+tya/5v7eXW -ysrM0tfe3vNqYWB4cW5la19YVUxMS0xIR0tXaW57evV5fXJfWVlaZOno2+d9e+jY3NPO1dHV -9Pr1bv5jbOTg3eTP0+Te3/BrZXxnWnv4fW5kZ1xdZF9hc3D0al979+hmWF1ZWFpSW+7h33f6 -3+fobmZrfu33bXPvfmFXbN3PztLPzs3L1ODi7PlZTllYZ3Fr8Xls//r363xkVE9YYWBZX1tc -ZFtkbWFcVFFid/D6YWhoZFleanL9/drd1tDRzM7R29/zbXrs7Pbv/+TtbnZqeunvev/+6ejo -9OrcfXBcXVtOUlhtb25gWllZX2RlZ3ZqaWVvbnL2bPbo5urt/XHu5fLo2trS0s7P5NjW3e9w -7nBdY2Zz+mZiYVpnXlVMSFhiZ/Pn4+94bGRcXmVuZWR5bmRoaV7+cHz7fd3f3G905Pf0/GJf -9m5lXmbe29LV1dHSzNba2Nng/llSXFpcVF5la+rv7Ozj+2pWUltaV05WWWNsdHHr2up7XGP1 -allQW3Vpde3r2NDOzM/My9Pna2deV1NNTvXUztHY0tXV8G5sZmpdWV72c1xSWPbm71xlb2FX -T0xIUUxITljy7ODq3c3R2vNl99vs+3X64utwX/3f2s/OzM3T/ldMTlhgZHPcz8/X5Pve3Gxd -UlhcWE9IT1NYXWJv39ffenrc1tnxXWjzeV9SVODX6vls3+T4bE9WbGlkY/PKyNDS2crJ1elZ -b/V0W0tMXf1ZU1/j0M/W6d3fZU0+P01RS05a69bY5mjy83dfXPvl8F5RWPTZ1ujqy8jR53Lu -5/1WUFv02tfZ3NLT9Wtabtr8XVhdbmZeU05q9mZfZPDfelpNT2p5/W5w2NTdcltv5edZVGXs -23xZW/71bW51zsPGyc/Oy9f+Wk1cd1xcW2bk3OPu2tLf9VVRb2tdVU9QXGNkaW7b2uX2WWtp -VVBGR1RobWlf8t96Z1nu23ttXmTt1M/T1czHz99v5dLT3F9VbHjvaV5fYnpvYH3V2HhbWXfo -a1xPWmxnZmZs+mlUTEtf69nkeeTV1OxjXejxb2lPcdPO2fve2tnsZGXq71ZRT2nU0dt4dODY -5Xxr5djn/Vln4udwVVhga2tsb+fcYUxERlNoY1FWZeff+m753nRhWl3fzs/zXG/j5OXu3M/X -2e372M/SbVpk69HY9evedVdLR1N832RQVmzpZFdQYXZbUlH5zcvbZ2H37PxlXe3kdlhMV+vf -Z1Nc38zL1dvNydVuU1rj1ulPSllu/mRt69bXfmFf0sjTfVntzthvXWvZ5k5DQ1d5YU1HVfrl -bV9lfPtNQkRZ3dvsa+bMzNLe2c7L41hZd87N3Wxz6vZmVVlp6vVXVF7bztxtW+rZ3fBtZmdc -RkBEWd3jd2Bq4NHY2NHUz+1cYmXp6mBXT1/oe3Hr3tniZl1aY+ttXF1cZWNr6NzR0N3m4M7J -zdfk/Ojkfm9iX2BYTUpOUlNTTk9PWWVo8dra5Xpz+eHS1tzta3tuY3FiW2VqX2Vn+dfX1dvp -3eTo3ubr9GpkV1hxe3RoWGX9593saFxiWlJPWPz6a1lUZ+3h3eXx3u39bm/k3e1gWGrb1+R4 -XGv8Z2Vq7dXRz9vkzszO32VrdGJbWGHb2eHrZWx7cV9WW3L6/15QXmNVTUlP6dHW6Hd9aFpN -UmLv2+1zaXH3aFdXYvXa5fTk2tHc5/bq29bf7+/h1eH2fW5vY1xmev10ZVxWXWzw9WRtbGpm -Wl5aVFRUVmB37+Hx5+f79nBuef766uXV0d3e73XtcPXd3NLb6fNdbuvz63v+fWhdWV1eZ3Lz -19LMys/V6GxbTEtOTU5NSk1TV19oa3B0+ur4+Pfx72hcXGh+29bb1tbb6Off19HT3PD58N7g -+GtpY1ZNTFVUWVtVVVRde+v47NvY2uTm5ejk/1lcXGnu8Orr7N/tbmpbXmZbW19i8+Tk4t3m -8Wxr6trO2GhaWlple2Z05NrQ1tXQ0tt+WFNabvb+693b6l5PS01UU01JT118/FxXWWJmVlr9 -2NDW6/zs7Ozr8trMycze6tza4WRXXmzs29jj4/NeUUxPXXZtXFxn7ODkem/m3+J7av7792JW -V1dnc3X7/nljXlhVX292X1ZWZfHu5d7Xz9DY5+ff1tr9bHDs7ndsdujf3vP629LR4GNdXWFm -ZmRtd35xV1FYWllNS05TYGBdcOLV1uZ67t3c5vZsYfjf3N3o3dPY5X15dPP4W1RVYGhteW74 -6ud89+bl4vhoa3X4//vuePxrYmNbX21zYV9mZfzvenfv5P1dUk5YeGxsenJ+eHFtcH7u29nk -4tvW2eDa29ze39/i5/N9ZFxbZvfm3OHi33JcUkpKTFFVV1dbYFpZWmD05dvZ1NHc6W1fXF1f -au/c08/b5eT48eTh19ne6/v2b2ZfXWNp/+Xf6X1vYFhYWW3x8Ojg5fhyYGFfWlZQVlRUXV1j -bGxqbGpu/nVrYmFlZGZgZ+vc087PztHW09rj7unr6+76evvu9f9u+Ojm7nd2fXvt5+316u/x -eV1dW1pWTUpISVBWX2VrfW1sc/De3dne4u3t5//0fP/17vR649vQ0dzf7fLu6un87v5tbGhj -YGT5eV5eX2luYldWWFtgXl5namJXTk5Xc+nj2tnf4OTc0dXZ4u5vXFxZWWBkaWt46tnPzszQ -3ODn/vDi+W5gW2FiY3zj5OV4aWdf+nT9emj9Y1dXWmt4bGZrb3V2Zl9eYWFiYmVw7+t2aVxZ -X+/h4dXN0M7NzM3S1ON2aWd18XpsamhkXVVSX3Rsb21kYV5eYl1dY15bXm703+Dtbl1fWl1s -Yl5ibfVzdfJ6fHl27uve3eLj4t7r8vD16eHo7Pz47Ovf4efl4NvRz8/P0Nn1W09JSEtPUFFY -W1tbWlxrdG1dW15haHJ98ez9fe7u6NTS1+5qZFxu/e/e2tfY2dbc29nsbFpYY2BmX11sa37i -3NbZ2upqXFhYVFRRTUxNUltu/vXl9nJrdd7d6uz7fnpdXGj14NnZ4ujydejh7dve7/h6fnNq -dm535ujf2NXc3+v9aVpbV1pfaG5sbXBnbnzzfnnn7nBlXVtWTUtMV2ppa//t6nRhdPj07fLv -6t3Szs/Oz9fe4dzf6Oj4+X1jXV9ibfz/93Zud2lkX2dvZl1gbW7x+W17b15WUFFVWF9oV1RZ -WV5fd+Te293j3tnf397Wzs7P1NnucW1gXllcZXjr3d/k7Wpqanvn6eTZ3+328nBgXVZWV1pW -W1tbaWVhV1Nda29tZ15YVldq6uff3NfS2NjY3t/qffro2drh5vF8YmhsbuTd2N7e3+7sbG1r -bu7p7G9cWV9dWVFLTFBQUldZWVdbYmX73tLS1tzl3eHc2t/o6uvz6vRvaVtVVVxtfuTn7OF8 -a2pfbOXW09ba6PP07u50bmlma3ZnU09OTU5VY3zj2M/O2t/vcnP+5+t+bnL+cWdnbXdnZmth -Z11eaGJx9uTa19TV09XX2u54bHjs6/h3bmRkZF1jYl5hXVdWW1ldXV1eWmV97+fh4/dmVlNP -V3r74t7f3ePi5t7e3tra0dTa3ObifGxsaOvo393v9V5VU01NTVFUWWlvbXj69vprb2hq+eXT -0NnffXnu7vPz/2tnXlxcXF5aYWpu7O/o4d3Y1trf3+jq7+/u+H1rcvt67drZ3OHx+W5582ld -ZGJbXlxbYGFrb15ZUU5XWlZXWE5NUFv23NXNyc7X3uz18uv9aV1TUGDn3NTS09bk5t/f3d/v -Z11daXBz6+Xh2t7q731udGJZVk5NUF1rc3dyeG1mZmxtfO7tb19fbXZx9/91Z11kcPzv9Pn1 -9unn6eTe18/Nz9PV1tnmfGlfZWx74uDv4eh5ZlhWT01NSkpMUllgZVxfbv7n6OXme25oZFpb -aXjv29XS09bb5+/zbl9kePPn39/u+vD/8eT18u3r7nX5+W9kXV9od/Ts6/jt9XprWldUU19m -Y2dxdmdoXl9iZWtmeOzs3drg4/Z7d3Xo4t/rdG9obWp95OTb1NPW4eHX2dvpeWlZW1hYXlZn -+X3t8PV1dmVZVk1JSUtSXGhx/+745ut7fGRreWn/8vHm7+Ln7OTv3dPTz8zN0NLe+2pdYmVh -+/n77v7yZV5hWVZPU1dYU1NaXP3s5dvb2dTd6vpnWlNRWGNieHdy8nr15uPc3+Z6ZXNkX2Nm -ffbm1c3P19/k3+To3d7g7XL373f9c25wWltVT1dfb2xmXlhbZnj+4fNsbVZYUUtUWGhvYnRo -b3313tfQ19TO2uJ8Y25v8OLk2tPS2N3ubGVaXmdmZltdbX19bO/rdndoZG9lYn7i4N/hbWVf -W1pWWVNOSkxZXG/l7u3o39rm39nd09Xa2d/l/3N5cnN479/d1s/P1NrY2u99/mxmYFtVT1ZZ -XndsbXx3cnpkWVROTkpKSklRXWnz4evc19zZ5eLj9+Ph3tnc0tPY2Off5+/9Z2ldW19jbvnz -fHp1bmRfcur7d3tmYFVRWGD79OTc3eL7ZlxeWVBVW11jYWZna3Xt2Nvm7ujc5vDy++jm4N3m -3dnc2+Hi4/T+cGt1e3rzfO7f5d/b4vtnWVlZXFlbZWvybF1dU01MTE5PUlVWV1xreO3f39fQ -y8nP2OL7dXzu5+715NzS0NTX1tz9bmFaUU1PT1RTT1NbcuLZ19rg9Hl5ZWRjYF9ibWhdW19b -W2NebHhvfe3g3eZ8/fzr4uXk4tnY3uTy+uvi1M7Pz8/S1+dvbWZWVFZka19fWl9lZmz98fxl -VU9UU0xQVmBobfl+bXX4+O/n4X15+Ph4ae3v69TQzM/g43BaTUZJSE5j+9DP1dbn5+Le3t/f -3t7e4nxlX1xjbG5nZF9dX1xZTk5NS1ZgdPji2Nna2dXT1dnq5PtjXE5LSE1hcurU0M3JyMvU -2vlud2dvdXB0Xmjc2d7l29joe/ZsUlBSS0xMTlVNWGD89O/c6Xd25ebq8/ns9PxqdGxjcm18 -/Pvj8+x9Yfp96d3j3u/s//7f6PNsaG1+7/R2d2RgbWFYXWFgXnjb4elzamhZXlZVYWz/ZGz9 -bnl5durd1NPT1Nvl+v/+/vL99+Xl7uvxdHhmW2N0amnp3Nzd1tfd3t7deGRhU05OSkhHSk9X -W3jm4+Xs6+5mZ2dfbX3k3NvW2NXX3+H+bGNcZmVmW1lqZGjz+O/2/N/X0NPd2tfY2vRvaFxY -YGppcH70b11ZU0xHSE1XX1lYZ/zs39/q8era1tfe2dno/XJjXV9dbt/Z2eT86NfN0NXd8ubs -9fVydv72fm1lXVJQUU9YW2JjXGpjZGdx73f59Pbp6d3pfXJmcnBkYF5q9ufg631cV1tcZ2/x -3dTR09PY2uHk3tvd6vJnYlxUWFNZW2F8ampiXl9ZY2Rr/mx2+X1uZ2tqdPB4fuv4e2NaV1Vf -euvo6ens6ejx6+ns2NXSz9XZ3+Pb2Nzg5u/7+fJ+b2FVTUpMTE5ZZHTu6ubd3+Xc2+l3aWNm -XlhRTE1TX3Tl19vd4/VzZWRsc3X0/216em9z39fSztHY5/R1amFgXV9mYGh+/u349+3n4/dz -aV9lX1diZWJueX5xbV9XVlVVWVtndfvf4d3a9HZ2+PJ54dnY197h6mpqaf/p4N7e3+bpenvv -5Nzb29/9YlxcXV1eaGtsfOvqc213ZFxXUlZcXm3z7un8cG1candpYmnv7vj/Z2JeaHlw5t3a -09PV2eTvffl99+Td2Nvn9/9iWltWW3P5c2ZbWllQWFpUWF5laHN0Y21yamdhZ21+4t7b2uLv -+Pn0597Z2t3e4Nze4ebn3t3Z2uV7aVxeX15dXWNqbGdkZF5cWl5x8fl+9+/t7u/v83z86vxq -YmBeWlVSUE5adera1t3a29/c5ejk393mfm1qbXr+5uPb29fT3epsXFJOTlFUWFlaXV5kdXp+ -6uTh6P3zalRMS09WVlxo9+Tl3dnd2dfc2Nzxfmlsc3f2eGxvePrl29bV1dPS0dLb7np3b2lj -WlRYWFhWV1xoen3n6OnrcXBfWlZZXl5nYmBsdmRfZWr86ePf7Ovl6uXo7nJreHb49n11eevs -6Ob06unl3ejk3Nfb7N/k8vZpX1lVVVRWWVpcWVNXXmJaWFxca2Znc2767+Pe4eHh3d/p8/p7 -b29qZ29xcufd1s7Q2uf7/Ht79Hf7e2dyc2tyc3fr5+vn7Pb59ff/Z19gXV1cYl9gamZeXGBk -b/v/b2pnaWdy+vny9+rh4dra3Nvb2Nvd8H54ffJ4bmNs+vN9/urs9v94bWxhWVxbVVJPTU1P -UlpbYPnp5ebw4t/t8ezo7P1uYF9z6uTg3dnc3u/6c2FjYXD6+O3j4+/u7OPj6ejp4tzb3u18 -eGpuZGny+vn9aVxUTUpKUF1z7OPj8u/ybm9laf1t+vhoalhSVFZldt3Py8rLys/g9f57aXXt -+uh+aWteaO/c1+De2t3feWRaVlJMS0xPV11ibmZfXV1cZvjo5+vwd2ZaWFlj/uzr9vPn5+zq -3dva2t3f4+nr5evj3Nnb5e53Yl1fXVldX2/yYFxt/fHv9Ozq7+/9amZdWFNPVV1jfOnt9fn7 -bnzo5uXj5uPf3+To93JxbWxr8urf19/r+nRmY2R23t3c3+zu/nhqZm5yaGBeVE1MTExOVlte -Z2xtcWtvcWJoZWl19un+897l+f91++Pe1s/S0dXZ297lbmt2aH56bf3v49/h3N7m6O3p4uD0 -aF1XXF5mcWxwbl9TTk1OTVFXXWtmXVdaX11gZ/7d19XQ09bb4eLs4tva1tXV1t3pbWhjYGFl -+vH4fXFsfOjs8e94fPR4bmNZV05NT1ZeW2n75Nje7XxmXFdXWVJPVVpcX2j36+zq4t7d3NvZ -1NbZ1trd3+rx//97d+rf6vp9dnx4/Ph77+no9nFiW1tTTk5TVlZi7d/h42xfZ3h8+PP+6uPx -a2VcXvnu7dzS0Nnh7G9paVli+//p6fHu7en9Z238//rq7eTc5+fi6XRleOzp/mVfXFFOTktH -SExPVF1iYGFhbO/l5d3V1tbT2eDo8e3t39ze2eLp6Px7cG1fXmNp9fbg3NnV2dne3+9ybF5Z -UE1QTlFYV2x98N/f4e1vYFtnePnp7f1mX2RdXF1da/ng3d7m7OP1ZXv++uTu7Ovn3+7x49PN -zMrP09Tie2BWUExNTktNUlZbWl9hXGJ76tzh6+v7dmVYUFBSXXF2/u3n6ez2+Pd989/X2N/u -7t3a3Ovv5eHd6nFkXltbYv/l29vr5t/me1tXXFxbWFlgXWL98/x19O77dGRhYGFdW15fZf3h -4Off39/c3ud3Z2hga2dw7+7j5tzZ0c/T1tba9P5mXF9cZmFZXWdYU1lXZ2dgdm1naVxYVFll -cvXu72lcXVteee7i2NzY2dvX4Ont6flvbmpvdPLt6dvf4uXo5/ZzZmtzbnH56vT5cmRpaGJt -cWZcXmNaYHRsaWxsYV5jfe3r4ux+9nlqZWpwbG92/fHo7e7s7+/69vXq3uTj4+nl4u3r3eHb -1t3ieWZeU01NU1tt9d/X2d/v/m5ZWVdYXWNlX1xbV1FUXGh38u7q9l9VUFJcaHbj1s7Oz9Pb -2t/f2dvk9/rr5e7i5Pj39fT7+/tuY2JiX1lZXVpkbXPv+nFrZWVcUlNUUFZea/rj2NbW2Njc -7mhdV1li/+Pd2Njb1dHPz9bd8fv4dmdiXVZQT1pmb+vi3N3v+fh+8fh9eGptaGBdXFxaW19f -ZmRfaGRrbGltcv3x8X3/9u/f1dvg8n74dm1sa2RdX2p98Ozp39ze4u34eXby6vh07O9+/2lk -aGFZVVRST05PUldXZnzk1c7O1dTZ3t7m4+bc3t7a5+jm82Zhal5aXGZtb25q/ebb197k6Orf -4t7a4+f2ZWBcV1RQVFheZGdfXVtYX2lnXlpgX2FqZW5zae3s8Ot6bm3x7/ry8+vp5tjX2Nfa -3d/q593d5ezycnn0/nlta29dVllaWVRTVVZbX2JeXWptbG1cWl5s4tbX087S2Nzf3ufu9X1v -Yl9dWVlice3i29LU2t7f4vd2d3RpX2htem9y7d7W1dje6flxYFZPS0VESExPWGn9++ne4O9y -X19qaV9j/uHl3dzs7Pft7O/g4t7c2tjj73x0dvjv3trk6W9hYlxmb2pv++//d3RzXlRNSE5W -XGNp6uf1/mxw8OXf3dXS3OL4aGNaWVRTYHvv7W9kbW5t8N7V0tXW1dfY193c19nd3NzoeGBV -UlRWWVdTWGJeWV9rdnJsbV9hZl5aW19jd+3m5Ofs7/Xu8W9fYWRdWV5rcevh4OPg6N3Y2tze -2tfhfPnvfWplcPjq5/l7Yl1dW2lhW11aW2lsbG9sbGx1bmReXWBueXd8fXP+8u3q8+vf2dPU -1tru/HZ28HlybnBzYV9jdP7+3Nfc4Ojo+mpkZXP89/pzfuvp3+l5bmlrZGdfVlFTVFhfcfbx -6+x8bWdeWFhbYnz36uvr297Z09jZ7HF5Z3J5bnl8dvt4bGtud/La1dzl6/9mV1JYXF5pc3fx -/nJeVFRPU19hcu7g2t/ecmN9fvHa0dHR09rrZ1xbWV/45t7V3O30fXRjZ37v3NbX2OdqW1hX -TlJSaGhobWloYlpZW19t++fc5flzZ2x0ZHN3e+7d397f5+5qYl9dYl1j/OXc19vj5Onb29jR -1d/zYWNgWltYYV9dYGVdW19dZWR68XRwbWdkYmRpeOni3e79dGJXU1Zn++Prfu/u6Ol4fO35 -6+Hd1dPY3N7c2+Tw6u7s6+nkd2NYT09RWWd489/d5PpvX1hdXmF393luZ1xRWVtTWl1kXmV5 -6+bu+P/z5+jg3trT2t3la2VfYmpo79/c19fSz9bueG1iYl5bWVlo7OHj9mhkbW98eHNiWFta -T0pFRUpOXmx+49bPz9LX7ff++uvl2Nre3+Df/2549OTf3eT0cF9l/+Lc2tTR19zral1YWFZO -T1FXZm1raW92bGZnXVJUXHv2cG974tvc2tzk8P7ydGBbXnD67uf//O357O32+PH+++rb2tnP -2Njb7vxnX1pSUU9RUU9QWWJq5dzY2PVoW1BOTk9UV2Jy9N3d3t/p29rX1t/d3+/6Z1tjePDk -5+Xj4Of6cWhtX2x4/HX2/2966edybmRyefvf5trZ3uF+aV9VXGVrXVdbVl5hXWJcWV9pc3rq -3uXd3tja73b3493d29zh3N/i82x17evz9GtfW2FfYGprYF1fXFxeXmRfW1xcW1ZVXl9q9nvj -4e7i6vPq5+12am1xeHvp5+zy7Nzb3dfY393zZg== - ---n2m-MIME-boundary---------- - ---PART.BOUNDARY.2418.16114.COSMOS.VLSI.CS.CMU.EDU.715029153.2 -Content-type: text/richtext -Content-Transfer-Encoding: quoted-printable - - -Derek_Beatty@cmu.edu ABD Comp Sci, CMU, 5000 Forbes, Pgh, = -PA 15213 USA -= - ---PART.BOUNDARY.2418.16114.COSMOS.VLSI.CS.CMU.EDU.715029153.2-- - diff --git a/widgets/.cvsignore b/widgets/.cvsignore deleted file mode 100644 index d5b3a2ad62..0000000000 --- a/widgets/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -minicard-test -minicard-label-test -reflow-test diff --git a/widgets/LICENSE b/widgets/LICENSE deleted file mode 100644 index b1f6ae08a4..0000000000 --- a/widgets/LICENSE +++ /dev/null @@ -1 +0,0 @@ -This code is released under the terms of the GNU GPL. diff --git a/widgets/Makefile.am b/widgets/Makefile.am deleted file mode 100644 index 5d052b11a0..0000000000 --- a/widgets/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ - -SUBDIRS = \ - e-text e-minicard meeting-time-sel shortcut-bar e-table diff --git a/widgets/e-minicard/.cvsignore b/widgets/e-minicard/.cvsignore deleted file mode 100644 index 4af6725b43..0000000000 --- a/widgets/e-minicard/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -minicard-label-test -minicard-test -reflow-test \ No newline at end of file diff --git a/widgets/e-minicard/Makefile.am b/widgets/e-minicard/Makefile.am deleted file mode 100644 index 0790577ad1..0000000000 --- a/widgets/e-minicard/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/e-util \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = \ - libeminicard.a - -libeminicard_a_SOURCES = \ - e-minicard.c \ - e-minicard.h \ - e-minicard-label.c \ - e-minicard-label.h \ - e-reflow.c \ - e-reflow.h - -noinst_PROGRAMS = \ - minicard-label-test \ - minicard-test \ - reflow-test - -minicard_label_test_SOURCES = \ - test-minicard-label.c - -minicard_label_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a - -minicard_test_SOURCES = \ - test-minicard.c - -minicard_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a - -reflow_test_SOURCES = \ - test-reflow.c - -reflow_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.a diff --git a/widgets/e-minicard/e-minicard-label.c b/widgets/e-minicard/e-minicard-label.c deleted file mode 100644 index 5b528d6190..0000000000 --- a/widgets/e-minicard/e-minicard-label.c +++ /dev/null @@ -1,462 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-label.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-minicard-label.h" -#include "e-text.h" -#include "e-canvas.h" -#include "e-util.h" -static void e_minicard_label_init (EMinicardLabel *card); -static void e_minicard_label_class_init (EMinicardLabelClass *klass); -static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_label_realize (GnomeCanvasItem *item); -static void e_minicard_label_unrealize (GnomeCanvasItem *item); - -static void update_label( EMinicardLabel *minicard_label ); -static void resize( GtkObject *object, gpointer data ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_MINICARD_LABEL_RESIZE, - E_MINICARD_LABEL_LAST_SIGNAL -}; - -static guint e_minicard_label_signals[E_MINICARD_LABEL_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_FIELD, - ARG_FIELDNAME -}; - -GtkType -e_minicard_label_get_type (void) -{ - static GtkType minicard_label_type = 0; - - if (!minicard_label_type) - { - static const GtkTypeInfo minicard_label_info = - { - "EMinicardLabel", - sizeof (EMinicardLabel), - sizeof (EMinicardLabelClass), - (GtkClassInitFunc) e_minicard_label_class_init, - (GtkObjectInitFunc) e_minicard_label_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_label_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_label_info); - } - - return minicard_label_type; -} - -static void -e_minicard_label_class_init (EMinicardLabelClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_minicard_label_signals[E_MINICARD_LABEL_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMinicardLabelClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_minicard_label_signals, E_MINICARD_LABEL_LAST_SIGNAL); - - gtk_object_add_arg_type ("EMinicardLabel::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELD); - gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELDNAME); - - klass->resize = NULL; - - object_class->set_arg = e_minicard_label_set_arg; - object_class->get_arg = e_minicard_label_get_arg; - /* object_class->destroy = e_minicard_label_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_label_realize; - item_class->unrealize = e_minicard_label_unrealize; - item_class->event = e_minicard_label_event; -} - -static void -e_minicard_label_init (EMinicardLabel *minicard_label) -{ - minicard_label->width = 10; - minicard_label->height = 10; - minicard_label->rect = NULL; - minicard_label->fieldname = NULL; - minicard_label->field = NULL; - minicard_label->fieldname_text = NULL; - minicard_label->field_text = NULL; -} - -static void -e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicardLabel *e_minicard_label; - - item = GNOME_CANVAS_ITEM (o); - e_minicard_label = E_MINICARD_LABEL (o); - - switch (arg_id){ - case ARG_WIDTH: - e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - update_label( e_minicard_label ); - gnome_canvas_item_request_update (item); - break; - case ARG_HAS_FOCUS: - if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) - e_canvas_item_grab_focus(e_minicard_label->field); - break; - case ARG_FIELD: - if ( e_minicard_label->field ) - gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->field_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; - case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->fieldname_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; - } -} - -static void -e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardLabel *e_minicard_label; - char *temp; - - e_minicard_label = E_MINICARD_LABEL (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_FIELD: - if ( e_minicard_label->field ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); - break; - case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_label_realize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - GnomeCanvasGroup *group; - static GdkFont *font = NULL; - - if ( font == NULL ) { - font = gdk_font_load("lucidasans-10"); - } - - e_minicard_label = E_MINICARD_LABEL (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - - e_minicard_label->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - "outline_color", NULL, - NULL ); - e_minicard_label->fieldname = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) 2, - "y", (double) 1, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - "clip_height", (double) 1, - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - NULL ); - if ( e_minicard_label->fieldname_text ) - { - gnome_canvas_item_set( e_minicard_label->fieldname, - "text", e_minicard_label->fieldname_text, - NULL ); - g_free( e_minicard_label->fieldname_text ); - } - gtk_signal_connect(GTK_OBJECT(e_minicard_label->fieldname), - "resize", - GTK_SIGNAL_FUNC(resize), - (gpointer) e_minicard_label); - - e_minicard_label->field = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) ( e_minicard_label->width / 2 + 2 ), - "y", (double) 1, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - "clip_height", (double) 1, - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - "editable", TRUE, - NULL ); - if ( e_minicard_label->field_text ) - { - gnome_canvas_item_set( e_minicard_label->field, - "text", e_minicard_label->field_text, - NULL ); - g_free( e_minicard_label->field_text ); - } - - gtk_signal_connect(GTK_OBJECT(e_minicard_label->field), - "resize", - GTK_SIGNAL_FUNC(resize), - (gpointer) e_minicard_label); - - update_label (e_minicard_label); - - if (!item->canvas->aa) - { - } - -} - -static void -e_minicard_label_unrealize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item); -} - -static gboolean -e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", "grey50", - "fill_color", "grey90", - NULL ); - e_minicard_label->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", NULL, - "fill_color", NULL, - NULL ); - e_minicard_label->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_MOTION_NOTIFY: - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: { - GnomeCanvasItem *field; - ArtPoint p; - double inv[6], affine[6]; - gboolean return_val; - - field = e_minicard_label->field; - art_affine_identity (affine); - - if (field->xform != NULL) { - if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) { - art_affine_multiply (affine, affine, field->xform); - } else { - affine[4] += field->xform[0]; - affine[5] += field->xform[1]; - } - } - - art_affine_invert (inv, affine); - switch(event->type) { - case GDK_MOTION_NOTIFY: - p.x = event->motion.x; - p.y = event->motion.y; - art_affine_point (&p, &p, inv); - event->motion.x = p.x; - event->motion.y = p.y; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - p.x = event->button.x; - p.y = event->button.y; - art_affine_point (&p, &p, inv); - event->button.x = p.x; - event->button.y = p.y; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - p.x = event->crossing.x; - p.y = event->crossing.y; - art_affine_point (&p, &p, inv); - event->crossing.x = p.x; - event->crossing.y = p.y; - break; - default: - break; - } - - gtk_signal_emit_by_name(GTK_OBJECT(e_minicard_label->field), "event", event, &return_val); - return return_val; - break; - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -update_label( EMinicardLabel *e_minicard_label ) -{ - if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) - { - gint old_height; - gdouble text_height; - old_height = e_minicard_label->height; - - gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), - "text_height", &text_height, - NULL); - gnome_canvas_item_set(e_minicard_label->fieldname, - "clip_height", (double) text_height, - NULL); - - e_minicard_label->height = text_height; - - - gtk_object_get(GTK_OBJECT(e_minicard_label->field), - "text_height", &text_height, - NULL); - gnome_canvas_item_set(e_minicard_label->field, - "clip_height", (double) text_height, - NULL); - - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; - - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "x", (double) ( e_minicard_label->width / 2 + 2 ), - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - NULL ); - - if (old_height != e_minicard_label->height) - gtk_signal_emit_by_name (GTK_OBJECT (e_minicard_label), "resize"); - - } -} - - - -static void -resize( GtkObject *object, gpointer data ) -{ - update_label(E_MINICARD_LABEL(data)); -} diff --git a/widgets/e-minicard/e-minicard-label.h b/widgets/e-minicard/e-minicard-label.h deleted file mode 100644 index ddbe7ab191..0000000000 --- a/widgets/e-minicard/e-minicard-label.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-label.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_MINICARD_LABEL_H__ -#define __E_MINICARD_LABEL_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardLabel - A label doing focus with non-marching ants. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the label - * height double R height of the label - * field string RW text in the field label - * fieldname string RW text in the fieldname label - */ - -#define E_MINICARD_LABEL_TYPE (e_minicard_label_get_type ()) -#define E_MINICARD_LABEL(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_LABEL_TYPE, EMinicardLabel)) -#define E_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_LABEL_TYPE, EMiniCardLabelClass)) -#define E_IS_MINICARD_LABEL(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_LABEL_TYPE)) -#define E_IS_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_LABEL_TYPE)) - - -typedef struct _EMinicardLabel EMinicardLabel; -typedef struct _EMinicardLabelClass EMinicardLabelClass; - -struct _EMinicardLabel -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - double width; - double height; - GnomeCanvasItem *fieldname; - GnomeCanvasItem *field; - GnomeCanvasItem *rect; - char *fieldname_text; - char *field_text; - - gboolean has_focus; -}; - -struct _EMinicardLabelClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicardLabel *text); -}; - - -GtkType e_minicard_label_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_LABEL_H__ */ diff --git a/widgets/e-minicard/e-minicard.c b/widgets/e-minicard/e-minicard.c deleted file mode 100644 index 805c4e78ff..0000000000 --- a/widgets/e-minicard/e-minicard.c +++ /dev/null @@ -1,471 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-minicard.h" -#include "e-minicard-label.h" -#include "e-text.h" -#include "e-canvas.h" -#include "e-util.h" -static void e_minicard_init (EMinicard *card); -static void e_minicard_class_init (EMinicardClass *klass); -static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_realize (GnomeCanvasItem *item); -static void e_minicard_unrealize (GnomeCanvasItem *item); - -static void _update_card ( EMinicard *minicard ); -static void _resize( GtkObject *object, gpointer data ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_MINICARD_RESIZE, - E_MINICARD_LAST_SIGNAL -}; - -static guint e_minicard_signals[E_MINICARD_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_CARD -}; - -GtkType -e_minicard_get_type (void) -{ - static GtkType minicard_type = 0; - - if (!minicard_type) - { - static const GtkTypeInfo minicard_info = - { - "EMinicard", - sizeof (EMinicard), - sizeof (EMinicardClass), - (GtkClassInitFunc) e_minicard_class_init, - (GtkObjectInitFunc) e_minicard_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info); - } - - return minicard_type; -} - -static void -e_minicard_class_init (EMinicardClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_minicard_signals[E_MINICARD_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMinicardClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_minicard_signals, E_MINICARD_LAST_SIGNAL); - - gtk_object_add_arg_type ("EMinicard::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - - object_class->set_arg = e_minicard_set_arg; - object_class->get_arg = e_minicard_get_arg; - /* object_class->destroy = e_minicard_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_realize; - item_class->unrealize = e_minicard_unrealize; - item_class->event = e_minicard_event; -} - -static void -e_minicard_init (EMinicard *minicard) -{ - /* minicard->card = NULL;*/ - minicard->rect = NULL; - minicard->fields = NULL; - minicard->width = 10; - minicard->height = 10; - minicard->has_focus = FALSE; -} - -static void -e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicard *e_minicard; - - item = GNOME_CANVAS_ITEM (o); - e_minicard = E_MINICARD (o); - - switch (arg_id){ - case ARG_WIDTH: - if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { - e_minicard->width = GTK_VALUE_DOUBLE (*arg); - _update_card(e_minicard); - gnome_canvas_item_request_update (item); - } - break; - case ARG_HAS_FOCUS: - if (e_minicard->fields) { - if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START || - GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(e_minicard->fields->data), - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(g_list_last(e_minicard->fields)->data), - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } - } - else - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(e_minicard)); - break; - case ARG_CARD: - /* e_minicard->card = GTK_VALUE_POINTER (*arg); - _update_card(e_minicard); - gnome_canvas_item_request_update (item);*/ - break; - } -} - -static void -e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_CARD: - /* GTK_VALUE_POINTER (*arg) = e_minicard->card; */ - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_realize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - GnomeCanvasGroup *group; - GnomeCanvasItem *new_item; - - e_minicard = E_MINICARD (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_minicard->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard->width - 1, - "y2", (double) e_minicard->height - 1, - "outline_color", NULL, - NULL ); - - e_minicard->header_rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 2, - "y1", (double) 2, - "x2", (double) e_minicard->width - 3, - "y2", (double) e_minicard->height - 3, - "fill_color", "grey70", - NULL ); - - e_minicard->header_text = - gnome_canvas_item_new( group, - e_text_get_type(), - "x", (double) 6, - "y", (double) 6, - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard->width - 12 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font", "lucidasans-bold-10", - "fill_color", "black", - "text", "Chris Lahey", - NULL ); - - gtk_signal_connect(GTK_OBJECT(e_minicard->header_text), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - if ( rand() % 2 ) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4, - "fieldname", "Address:", - "field", "100 Main St\nHome town, USA", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "x", (double) 2, - "y", e_minicard->height, - "width", e_minicard->width - 4.0, - "fieldname", "Email:", - "field", "clahey@address.com", - NULL ); - e_minicard->fields = g_list_append( e_minicard->fields, new_item); - - gtk_signal_connect(GTK_OBJECT(new_item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_minicard); - } - _update_card( e_minicard ); - - if (!item->canvas->aa) { - } -} - -static void -e_minicard_unrealize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gboolean -e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard->rect, - "outline_color", "grey50", - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color", "darkblue", - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color", "white", - NULL ); - e_minicard->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard->rect, - "outline_color", NULL, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color", "grey70", - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color", "black", - NULL ); - e_minicard->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - e_canvas_item_grab_focus(item); - } - break; - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_minicard->fields; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus != E_FOCUS_NONE) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM (list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -static void -_update_card( EMinicard *e_minicard ) -{ - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) { - GList *list; - gdouble text_height; - gint old_height; - - old_height = e_minicard->height; - - gtk_object_get( GTK_OBJECT( e_minicard->header_text ), - "text_height", &text_height, - NULL ); - - e_minicard->height = text_height + 10.0; - - gnome_canvas_item_set( e_minicard->header_rect, - "y2", text_height + 9.0, - NULL ); - - gnome_canvas_item_set( e_minicard->header_text, - "clip_height", (double)text_height, - NULL ); - - for(list = e_minicard->fields; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &text_height, - NULL); - gnome_canvas_item_set(GNOME_CANVAS_ITEM(list->data), - "y", (double) e_minicard->height, - NULL); - e_minicard->height += text_height; - } - e_minicard->height += 2; - - gnome_canvas_item_set( e_minicard->rect, - "y2", (double) e_minicard->height - 1, - NULL ); - - gnome_canvas_item_set( e_minicard->rect, - "x2", (double) e_minicard->width - 1.0, - "y2", (double) e_minicard->height - 1.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "x2", (double) e_minicard->width - 3.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "clip_width", (double) e_minicard->width - 12, - NULL ); - for ( list = e_minicard->fields; list; list = g_list_next( list ) ) { - gnome_canvas_item_set( GNOME_CANVAS_ITEM( list->data ), - "width", (double) e_minicard->width - 4.0, - NULL ); - - if (old_height != e_minicard->height) - gtk_signal_emit_by_name (GTK_OBJECT (e_minicard), "resize"); - } - } -} - -static void -_resize( GtkObject *object, gpointer data ) -{ - _update_card(E_MINICARD(data)); -} diff --git a/widgets/e-minicard/e-minicard.h b/widgets/e-minicard/e-minicard.h deleted file mode 100644 index 3be80c1586..0000000000 --- a/widgets/e-minicard/e-minicard.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_MINICARD_H__ -#define __E_MINICARD_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicard - A small card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the card - * height double R height of the card - * card ECard* RW Pointer to the ECard - */ - -#define E_MINICARD_TYPE (e_minicard_get_type ()) -#define E_MINICARD(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_TYPE, EMinicard)) -#define E_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_TYPE, EMinicardClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_TYPE)) - - -typedef struct _EMinicard EMinicard; -typedef struct _EMinicardClass EMinicardClass; -typedef enum _EMinicardFocusType EMinicardFocusType; - -enum _EMinicardFocusType { - E_MINICARD_FOCUS_TYPE_START, - E_MINICARD_FOCUS_TYPE_END -}; - -struct _EMinicard -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - /* ECard *card; */ - - GnomeCanvasItem *rect; - GnomeCanvasItem *header_rect; - GnomeCanvasItem *header_text; - GList *fields; /* Of type GnomeCanvasItem. */ - - gboolean has_focus; - - double width; - double height; -}; - -struct _EMinicardClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicard *minicard); -}; - - -GtkType e_minicard_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_H__ */ diff --git a/widgets/e-minicard/e-reflow.c b/widgets/e-minicard/e-reflow.c deleted file mode 100644 index 984e972f0c..0000000000 --- a/widgets/e-minicard/e-reflow.c +++ /dev/null @@ -1,787 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include "e-reflow.h" -#include "e-canvas-utils.h" -#include "e-util.h" -static void e_reflow_init (EReflow *card); -static void e_reflow_class_init (EReflowClass *klass); -static void e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_reflow_realize (GnomeCanvasItem *item); -static void e_reflow_unrealize (GnomeCanvasItem *item); -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags); -static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item); - -static void _update_reflow ( EReflow *reflow ); -static void _resize( GtkObject *object, gpointer data ); -static void _queue_reflow(EReflow *e_reflow); - -#define E_REFLOW_DIVIDER_WIDTH 2 -#define E_REFLOW_BORDER_WIDTH 7 -#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_REFLOW_RESIZE, - E_REFLOW_LAST_SIGNAL -}; - -static guint e_reflow_signals[E_REFLOW_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_MINIMUM_WIDTH, - ARG_WIDTH, - ARG_HEIGHT -}; - -GtkType -e_reflow_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EReflow", - sizeof (EReflow), - sizeof (EReflowClass), - (GtkClassInitFunc) e_reflow_class_init, - (GtkObjectInitFunc) e_reflow_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (gnome_canvas_group_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_reflow_class_init (EReflowClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_reflow_signals[E_REFLOW_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EReflowClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_reflow_signals, E_REFLOW_LAST_SIGNAL); - - gtk_object_add_arg_type ("EReflow::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("EReflow::width", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_WIDTH); - gtk_object_add_arg_type ("EReflow::height", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_HEIGHT); - - object_class->set_arg = e_reflow_set_arg; - object_class->get_arg = e_reflow_get_arg; - /* object_class->destroy = e_reflow_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->event = e_reflow_event; - item_class->realize = e_reflow_realize; - item_class->unrealize = e_reflow_unrealize; - item_class->draw = e_reflow_draw; - item_class->update = e_reflow_update; - item_class->point = e_reflow_point; -} - -static void -e_reflow_init (EReflow *reflow) -{ - /* reflow->card = NULL;*/ - reflow->items = NULL; - reflow->columns = NULL; - reflow->column_width = 150; - - reflow->minimum_width = 10; - reflow->width = 10; - reflow->height = 10; - reflow->idle = 0; - - reflow->column_drag = FALSE; - - reflow->need_height_update = FALSE; - reflow->need_column_resize = FALSE; - - reflow->default_cursor_shown = TRUE; - reflow->arrow_cursor = NULL; - reflow->default_cursor = NULL; -} - -static void -e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EReflow *e_reflow; - - item = GNOME_CANVAS_ITEM (o); - e_reflow = E_REFLOW (o); - - switch (arg_id){ - case ARG_HEIGHT: - e_reflow->height = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - case ARG_MINIMUM_WIDTH: - e_reflow->minimum_width = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - } -} - -static void -e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (object); - - switch (arg_id) { - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width; - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_reflow->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_reflow_realize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - GnomeCanvasGroup *group; - GList *list; - GtkAdjustment *adjustment; - - e_reflow = E_REFLOW (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); - e_reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); - - for(list = e_reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM(list->data); - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - } - - _queue_reflow( e_reflow ); - - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - - if (!item->canvas->aa) { - } -} - -static void -e_reflow_unrealize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - if (!item->canvas->aa) - { - } - - gdk_cursor_destroy (e_reflow->arrow_cursor); - gdk_cursor_destroy (e_reflow->default_cursor); - - g_list_free (e_reflow->items); - g_list_free (e_reflow->columns); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gint -e_reflow_pick_line (EReflow *e_reflow, double x) -{ - x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER; - return x; -} - -static gboolean -e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - switch( event->type ) - { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_reflow->items; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - break; - case GDK_BUTTON_PRESS: - switch(event->button.button) - { - case 1: - { - GdkEventButton *button = (GdkEventButton *) event; - double n_x; - n_x = button->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x); - e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; - e_reflow->temp_column_width = e_reflow->column_width; - e_reflow->column_drag = TRUE; - - gnome_canvas_item_grab (item, - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - e_reflow->arrow_cursor, - button->time); - - e_reflow->previous_temp_column_width = -1; - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - return TRUE; - } - } - break; - case 4: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value -= adjustment->step_increment; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - case 5: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value += adjustment->step_increment; - if ( new_value > adjustment->upper - adjustment->page_size ) - new_value = adjustment->upper - adjustment->page_size; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - } - break; - case GDK_BUTTON_RELEASE: - if (e_reflow->column_drag) { - gdouble old_width = e_reflow->column_width; - GdkEventButton *button = (GdkEventButton *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if ( e_reflow->temp_column_width < 50 ) - e_reflow->temp_column_width = 50; - e_reflow->column_drag = FALSE; - if ( old_width != e_reflow->temp_column_width ) { - gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width)); - e_reflow->column_width = e_reflow->temp_column_width; - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - _queue_reflow(e_reflow); - } else { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - gnome_canvas_item_ungrab (item, button->time); - return TRUE; - } - break; - case GDK_MOTION_NOTIFY: - if (e_reflow->column_drag) { - double old_width = e_reflow->temp_column_width; - GdkEventMotion *motion = (GdkEventMotion *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (motion->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if (e_reflow->temp_column_width < 50) - e_reflow->temp_column_width = 50; - if (old_width != e_reflow->temp_column_width) { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - return TRUE; - } else { - GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x; - n_x = motion->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } else - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - - } - break; - case GDK_ENTER_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } - } - break; - case GDK_LEAVE_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) { - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - } - } - break; - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -void -e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item) -{ - e_reflow->items = g_list_append(e_reflow->items, item); - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - _queue_reflow(e_reflow); - } - -} - -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - int x_rect, y_rect, width_rect, height_rect; - gdouble running_width; - EReflow *e_reflow = E_REFLOW(item); - int i; - double column_width; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw) - GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height); - column_width = e_reflow->column_width; - running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i = x; - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - NULL, - GTK_WIDGET(item->canvas), - "reflow", - x_rect - x, - y_rect - y, - width_rect, - height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - if (e_reflow->column_drag) { - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - i += start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gdk_draw_rectangle(drawable, - GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL], - TRUE, - x_rect - x, - y_rect - y, - width_rect - 1, - height_rect - 1); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ - EReflow *e_reflow; - double x0, x1, y0, y1; - - e_reflow = E_REFLOW (item); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) - GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags); - - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x1 < x0 + e_reflow->width ) - x1 = x0 + e_reflow->width; - if ( y1 < y0 + e_reflow->height ) - y1 = y0 + e_reflow->height; - item->x2 = x1; - item->y2 = y1; - - if (e_reflow->need_height_update) { - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x0 > 0 ) - x0 = 0; - if ( y0 > 0 ) - y0 = 0; - if ( x1 < E_REFLOW(item)->width ) - x1 = E_REFLOW(item)->width; - if ( x1 < E_REFLOW(item)->height ) - x1 = E_REFLOW(item)->height; - - gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1); - e_reflow->need_height_update = FALSE; - } else if (e_reflow->need_column_resize) { - int x_rect, y_rect, width_rect, height_rect; - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - gdouble running_width; - int i; - double column_width; - - if ( e_reflow->previous_temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->previous_temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - if ( e_reflow->temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - e_reflow->previous_temp_column_width = e_reflow->temp_column_width; - e_reflow->need_column_resize = FALSE; - } -} - -static double -e_reflow_point (GnomeCanvasItem *item, - double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - double distance = 1; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point) - distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item); - if (*actual_item) - return 0; - - *actual_item = item; - return 0; -#if 0 - if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) { - float n_x; - n_x = x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if (n_x < E_REFLOW_FULL_GUTTER) { - *actual_item = item; - return 0; - } - } - return distance; -#endif -} - -static void -_reflow( EReflow *e_reflow ) -{ - gdouble running_height; - GList *list; - double item_height; - - if (e_reflow->columns) { - g_list_free (e_reflow->columns); - e_reflow->columns = NULL; - } - - e_reflow->column_count = 0; - - if (e_reflow->items == NULL) { - e_reflow->columns = NULL; - e_reflow->column_count = 1; - return; - } - - list = e_reflow->items; - - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count = 1; - - list = g_list_next(list); - - for ( ; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) { - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count ++; - } else { - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -_update_reflow( EReflow *e_reflow ) -{ - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - - gdouble old_width; - gdouble running_width; - - _reflow (e_reflow); - - old_width = e_reflow->width; - - running_width = E_REFLOW_BORDER_WIDTH; - - if (e_reflow->items == NULL) { - } else { - GList *list; - GList *next_column; - gdouble item_height; - gdouble running_height; - - running_height = E_REFLOW_BORDER_WIDTH; - - list = e_reflow->items; - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - running_height += item_height + E_REFLOW_BORDER_WIDTH; - next_column = g_list_next(e_reflow->columns); - list = g_list_next(list); - - for( ; list; list = g_list_next(list)) { - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - - if (next_column && (next_column->data == list)) { - next_column = g_list_next (next_column); - running_height = E_REFLOW_BORDER_WIDTH; - running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH; - } - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - - } - e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH; - if ( e_reflow->width < e_reflow->minimum_width ) - e_reflow->width = e_reflow->minimum_width; - if (old_width != e_reflow->width) - gtk_signal_emit_by_name (GTK_OBJECT (e_reflow), "resize"); - } -} - - -static gboolean -_idle_reflow(gpointer data) -{ - EReflow *e_reflow = E_REFLOW(data); - _update_reflow(e_reflow); - e_reflow->need_height_update = TRUE; - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(e_reflow)); - e_reflow->idle = 0; - return FALSE; -} - -static void -_queue_reflow(EReflow *e_reflow) -{ - if (e_reflow->idle == 0) - e_reflow->idle = g_idle_add(_idle_reflow, e_reflow); -} - -static void -_resize( GtkObject *object, gpointer data ) -{ - _queue_reflow(E_REFLOW(data)); -} diff --git a/widgets/e-minicard/e-reflow.h b/widgets/e-minicard/e-reflow.h deleted file mode 100644 index 3a731474cb..0000000000 --- a/widgets/e-minicard/e-reflow.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-reflow.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_REFLOW_H__ -#define __E_REFLOW_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EReflow - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * minimum_width double RW minimum width of the reflow. width >= minimum_width - * width double R width of the reflow - * height double RW height of the reflow - */ - -#define E_REFLOW_TYPE (e_reflow_get_type ()) -#define E_REFLOW(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_TYPE, EReflow)) -#define E_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass)) -#define E_IS_REFLOW(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_TYPE)) -#define E_IS_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE)) - - -typedef struct _EReflow EReflow; -typedef struct _EReflowClass EReflowClass; - -struct _EReflow -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - /* EBook *book; */ - - GList *items; /* Of type GnomeCanvasItem */ - GList *columns; /* Of type GList pointing to type GnomeCanvasItem (points into items) */ - gint column_count; /* Number of columnns */ - - double minimum_width; - double width; - double height; - - double column_width; - - int idle; - - /* These are all for when the column is being dragged. */ - gboolean column_drag; - gdouble start_x; - gint which_column_dragged; - double temp_column_width; - double previous_temp_column_width; - - guint need_height_update : 1; - guint need_column_resize : 1; - - guint default_cursor_shown : 1; - GdkCursor *arrow_cursor; - GdkCursor *default_cursor; -}; - -struct _EReflowClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EReflow *reflow); -}; - -/* To be added to a reflow, an item must have the arguments "x", "y", - and "width" as Read/Write arguments and "height" as a Read Only - argument. It must also have a "resize" signal. */ -void e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item); -GtkType e_reflow_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_REFLOW_H__ */ diff --git a/widgets/e-minicard/test-minicard-label.c b/widgets/e-minicard/test-minicard-label.c deleted file mode 100644 index 8da34e6f22..0000000000 --- a/widgets/e-minicard/test-minicard-label.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard-label.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-minicard-label.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *label; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( label, - "width", (double) allocation->width, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Label Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard label canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void button_press_callback( GtkWidget *widget, gpointer data ) -{ - gnome_canvas_item_grab_focus( label ); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Label Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Label Test", NULL); - - canvas = gnome_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - label = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_label_get_type(), - "x", (double) 0, - "y", (double) 0, - "width", (double) 100, - "height", (double) 100, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "button_press_event", - GTK_SIGNAL_FUNC( button_press_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/widgets/e-minicard/test-minicard.c b/widgets/e-minicard/test-minicard.c deleted file mode 100644 index 1ad066b3fe..0000000000 --- a/widgets/e-minicard/test-minicard.c +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *card; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( card, - "width", (double) allocation->width, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Minicard Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Test", NULL); - - canvas = gnome_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - for ( i = 0; i < 1; i++ ) - { - card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_get_type(), - "x", (double) 0, - "y", (double) 0, - "width", (double) 100, - NULL ); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/widgets/e-minicard/test-reflow.c b/widgets/e-minicard/test-reflow.c deleted file mode 100644 index 319a3f5626..0000000000 --- a/widgets/e-minicard/test-reflow.c +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.c - * - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * 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. - */ - - - -#include "config.h" - -#include -#include "e-canvas.h" -#include "e-reflow.h" -#include "e-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvasItem *item, gpointer data) -{ - double width; - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(item->canvas , 0, 0, width, last_alloc.height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollbar; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Reflow Test", VERSION, argc, argv); - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_reflow_get_type(), - "x", (double) 0, - "y", (double) 0, - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_signal_connect( GTK_OBJECT( reflow ), "resize", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) app); - for ( i = 0; i < 200; i++ ) - { - GnomeCanvasItem *item; - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow), - e_minicard_get_type(), - NULL); - e_reflow_add_item(E_REFLOW(reflow), item); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas))); - - gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); - - gnome_app_set_contents( GNOME_APP( app ), vbox ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/widgets/e-reflow/e-reflow.c b/widgets/e-reflow/e-reflow.c deleted file mode 100644 index 984e972f0c..0000000000 --- a/widgets/e-reflow/e-reflow.c +++ /dev/null @@ -1,787 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include "e-reflow.h" -#include "e-canvas-utils.h" -#include "e-util.h" -static void e_reflow_init (EReflow *card); -static void e_reflow_class_init (EReflowClass *klass); -static void e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_reflow_realize (GnomeCanvasItem *item); -static void e_reflow_unrealize (GnomeCanvasItem *item); -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags); -static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item); - -static void _update_reflow ( EReflow *reflow ); -static void _resize( GtkObject *object, gpointer data ); -static void _queue_reflow(EReflow *e_reflow); - -#define E_REFLOW_DIVIDER_WIDTH 2 -#define E_REFLOW_BORDER_WIDTH 7 -#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_REFLOW_RESIZE, - E_REFLOW_LAST_SIGNAL -}; - -static guint e_reflow_signals[E_REFLOW_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_MINIMUM_WIDTH, - ARG_WIDTH, - ARG_HEIGHT -}; - -GtkType -e_reflow_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EReflow", - sizeof (EReflow), - sizeof (EReflowClass), - (GtkClassInitFunc) e_reflow_class_init, - (GtkObjectInitFunc) e_reflow_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (gnome_canvas_group_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_reflow_class_init (EReflowClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_reflow_signals[E_REFLOW_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EReflowClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_reflow_signals, E_REFLOW_LAST_SIGNAL); - - gtk_object_add_arg_type ("EReflow::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("EReflow::width", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_WIDTH); - gtk_object_add_arg_type ("EReflow::height", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_HEIGHT); - - object_class->set_arg = e_reflow_set_arg; - object_class->get_arg = e_reflow_get_arg; - /* object_class->destroy = e_reflow_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->event = e_reflow_event; - item_class->realize = e_reflow_realize; - item_class->unrealize = e_reflow_unrealize; - item_class->draw = e_reflow_draw; - item_class->update = e_reflow_update; - item_class->point = e_reflow_point; -} - -static void -e_reflow_init (EReflow *reflow) -{ - /* reflow->card = NULL;*/ - reflow->items = NULL; - reflow->columns = NULL; - reflow->column_width = 150; - - reflow->minimum_width = 10; - reflow->width = 10; - reflow->height = 10; - reflow->idle = 0; - - reflow->column_drag = FALSE; - - reflow->need_height_update = FALSE; - reflow->need_column_resize = FALSE; - - reflow->default_cursor_shown = TRUE; - reflow->arrow_cursor = NULL; - reflow->default_cursor = NULL; -} - -static void -e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EReflow *e_reflow; - - item = GNOME_CANVAS_ITEM (o); - e_reflow = E_REFLOW (o); - - switch (arg_id){ - case ARG_HEIGHT: - e_reflow->height = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - case ARG_MINIMUM_WIDTH: - e_reflow->minimum_width = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - } -} - -static void -e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (object); - - switch (arg_id) { - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width; - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_reflow->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_reflow_realize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - GnomeCanvasGroup *group; - GList *list; - GtkAdjustment *adjustment; - - e_reflow = E_REFLOW (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); - e_reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); - - for(list = e_reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM(list->data); - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - } - - _queue_reflow( e_reflow ); - - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - - if (!item->canvas->aa) { - } -} - -static void -e_reflow_unrealize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - if (!item->canvas->aa) - { - } - - gdk_cursor_destroy (e_reflow->arrow_cursor); - gdk_cursor_destroy (e_reflow->default_cursor); - - g_list_free (e_reflow->items); - g_list_free (e_reflow->columns); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gint -e_reflow_pick_line (EReflow *e_reflow, double x) -{ - x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER; - return x; -} - -static gboolean -e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - switch( event->type ) - { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_reflow->items; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - break; - case GDK_BUTTON_PRESS: - switch(event->button.button) - { - case 1: - { - GdkEventButton *button = (GdkEventButton *) event; - double n_x; - n_x = button->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x); - e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; - e_reflow->temp_column_width = e_reflow->column_width; - e_reflow->column_drag = TRUE; - - gnome_canvas_item_grab (item, - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - e_reflow->arrow_cursor, - button->time); - - e_reflow->previous_temp_column_width = -1; - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - return TRUE; - } - } - break; - case 4: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value -= adjustment->step_increment; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - case 5: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value += adjustment->step_increment; - if ( new_value > adjustment->upper - adjustment->page_size ) - new_value = adjustment->upper - adjustment->page_size; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - } - break; - case GDK_BUTTON_RELEASE: - if (e_reflow->column_drag) { - gdouble old_width = e_reflow->column_width; - GdkEventButton *button = (GdkEventButton *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if ( e_reflow->temp_column_width < 50 ) - e_reflow->temp_column_width = 50; - e_reflow->column_drag = FALSE; - if ( old_width != e_reflow->temp_column_width ) { - gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width)); - e_reflow->column_width = e_reflow->temp_column_width; - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - _queue_reflow(e_reflow); - } else { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - gnome_canvas_item_ungrab (item, button->time); - return TRUE; - } - break; - case GDK_MOTION_NOTIFY: - if (e_reflow->column_drag) { - double old_width = e_reflow->temp_column_width; - GdkEventMotion *motion = (GdkEventMotion *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (motion->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if (e_reflow->temp_column_width < 50) - e_reflow->temp_column_width = 50; - if (old_width != e_reflow->temp_column_width) { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - return TRUE; - } else { - GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x; - n_x = motion->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } else - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - - } - break; - case GDK_ENTER_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } - } - break; - case GDK_LEAVE_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) { - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - } - } - break; - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -void -e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item) -{ - e_reflow->items = g_list_append(e_reflow->items, item); - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - _queue_reflow(e_reflow); - } - -} - -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - int x_rect, y_rect, width_rect, height_rect; - gdouble running_width; - EReflow *e_reflow = E_REFLOW(item); - int i; - double column_width; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw) - GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height); - column_width = e_reflow->column_width; - running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i = x; - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - NULL, - GTK_WIDGET(item->canvas), - "reflow", - x_rect - x, - y_rect - y, - width_rect, - height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - if (e_reflow->column_drag) { - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - i += start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gdk_draw_rectangle(drawable, - GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL], - TRUE, - x_rect - x, - y_rect - y, - width_rect - 1, - height_rect - 1); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ - EReflow *e_reflow; - double x0, x1, y0, y1; - - e_reflow = E_REFLOW (item); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) - GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags); - - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x1 < x0 + e_reflow->width ) - x1 = x0 + e_reflow->width; - if ( y1 < y0 + e_reflow->height ) - y1 = y0 + e_reflow->height; - item->x2 = x1; - item->y2 = y1; - - if (e_reflow->need_height_update) { - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x0 > 0 ) - x0 = 0; - if ( y0 > 0 ) - y0 = 0; - if ( x1 < E_REFLOW(item)->width ) - x1 = E_REFLOW(item)->width; - if ( x1 < E_REFLOW(item)->height ) - x1 = E_REFLOW(item)->height; - - gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1); - e_reflow->need_height_update = FALSE; - } else if (e_reflow->need_column_resize) { - int x_rect, y_rect, width_rect, height_rect; - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - gdouble running_width; - int i; - double column_width; - - if ( e_reflow->previous_temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->previous_temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - if ( e_reflow->temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - e_reflow->previous_temp_column_width = e_reflow->temp_column_width; - e_reflow->need_column_resize = FALSE; - } -} - -static double -e_reflow_point (GnomeCanvasItem *item, - double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - double distance = 1; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point) - distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item); - if (*actual_item) - return 0; - - *actual_item = item; - return 0; -#if 0 - if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) { - float n_x; - n_x = x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if (n_x < E_REFLOW_FULL_GUTTER) { - *actual_item = item; - return 0; - } - } - return distance; -#endif -} - -static void -_reflow( EReflow *e_reflow ) -{ - gdouble running_height; - GList *list; - double item_height; - - if (e_reflow->columns) { - g_list_free (e_reflow->columns); - e_reflow->columns = NULL; - } - - e_reflow->column_count = 0; - - if (e_reflow->items == NULL) { - e_reflow->columns = NULL; - e_reflow->column_count = 1; - return; - } - - list = e_reflow->items; - - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count = 1; - - list = g_list_next(list); - - for ( ; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) { - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count ++; - } else { - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -_update_reflow( EReflow *e_reflow ) -{ - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - - gdouble old_width; - gdouble running_width; - - _reflow (e_reflow); - - old_width = e_reflow->width; - - running_width = E_REFLOW_BORDER_WIDTH; - - if (e_reflow->items == NULL) { - } else { - GList *list; - GList *next_column; - gdouble item_height; - gdouble running_height; - - running_height = E_REFLOW_BORDER_WIDTH; - - list = e_reflow->items; - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - running_height += item_height + E_REFLOW_BORDER_WIDTH; - next_column = g_list_next(e_reflow->columns); - list = g_list_next(list); - - for( ; list; list = g_list_next(list)) { - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - - if (next_column && (next_column->data == list)) { - next_column = g_list_next (next_column); - running_height = E_REFLOW_BORDER_WIDTH; - running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH; - } - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - - } - e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH; - if ( e_reflow->width < e_reflow->minimum_width ) - e_reflow->width = e_reflow->minimum_width; - if (old_width != e_reflow->width) - gtk_signal_emit_by_name (GTK_OBJECT (e_reflow), "resize"); - } -} - - -static gboolean -_idle_reflow(gpointer data) -{ - EReflow *e_reflow = E_REFLOW(data); - _update_reflow(e_reflow); - e_reflow->need_height_update = TRUE; - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(e_reflow)); - e_reflow->idle = 0; - return FALSE; -} - -static void -_queue_reflow(EReflow *e_reflow) -{ - if (e_reflow->idle == 0) - e_reflow->idle = g_idle_add(_idle_reflow, e_reflow); -} - -static void -_resize( GtkObject *object, gpointer data ) -{ - _queue_reflow(E_REFLOW(data)); -} diff --git a/widgets/e-reflow/e-reflow.h b/widgets/e-reflow/e-reflow.h deleted file mode 100644 index 3a731474cb..0000000000 --- a/widgets/e-reflow/e-reflow.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-reflow.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_REFLOW_H__ -#define __E_REFLOW_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EReflow - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * minimum_width double RW minimum width of the reflow. width >= minimum_width - * width double R width of the reflow - * height double RW height of the reflow - */ - -#define E_REFLOW_TYPE (e_reflow_get_type ()) -#define E_REFLOW(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_TYPE, EReflow)) -#define E_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass)) -#define E_IS_REFLOW(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_TYPE)) -#define E_IS_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE)) - - -typedef struct _EReflow EReflow; -typedef struct _EReflowClass EReflowClass; - -struct _EReflow -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - /* EBook *book; */ - - GList *items; /* Of type GnomeCanvasItem */ - GList *columns; /* Of type GList pointing to type GnomeCanvasItem (points into items) */ - gint column_count; /* Number of columnns */ - - double minimum_width; - double width; - double height; - - double column_width; - - int idle; - - /* These are all for when the column is being dragged. */ - gboolean column_drag; - gdouble start_x; - gint which_column_dragged; - double temp_column_width; - double previous_temp_column_width; - - guint need_height_update : 1; - guint need_column_resize : 1; - - guint default_cursor_shown : 1; - GdkCursor *arrow_cursor; - GdkCursor *default_cursor; -}; - -struct _EReflowClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EReflow *reflow); -}; - -/* To be added to a reflow, an item must have the arguments "x", "y", - and "width" as Read/Write arguments and "height" as a Read Only - argument. It must also have a "resize" signal. */ -void e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item); -GtkType e_reflow_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_REFLOW_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 0c9ee610db..0000000000 --- a/widgets/e-table/ChangeLog +++ /dev/null @@ -1,830 +0,0 @@ -2000-02-25 Christopher James Lahey - - * e-table-item.c: Made the E table item redraw properly. - - * e-table-group-container.c: Added handling to distinguish between - n items and 1 item. Got rid of a crash due to an abandoned timeout - callback. - -2000-02-24 Christopher James Lahey - - * e-cell-text.c: Made carriage return stop editting instead of - inserting a carriage return. - -2000-02-24 Christopher James Lahey - - * test-table.c: Added duplicate_value and add_value. Use the new - compare functions. Made it so we only create one model to better - test model view stuff. Changed the test to not have as many - extra, useless, columns. - - * test-cols.c, test-check.c: Added duplicate_value and add_value. - Use the new compare functions. - - * e-table.c, e-table.h: Use all the new features of e-table-groups - (sorting and grouping). Handle on the fly reorganization of - groups in an idle loop. Compare functions now are to return -1 if - the first item is greater, 0 if they are equal, or 1 if the second - item is greater. - - * e-table-subset.c, e-table-subset.h: Made e-table-subset - disconnect properly from its signals when it dies. - - * e-table-subset-variable.c, e-table-subset-variable.h: - Virtualized the add and remove commands so that - e_table_sorted_variable could override the add command to do - sorting. - - * e-table-sorted.c: Fixed this to inherit properly from - ETableSubset. - - * e-table-simple.h, e-table-simple.c: Added handling of - duplicate_value and free_value; - - * e-table-model.c, e-table-model.h: Added duplicate_value and - free_value for memory allocation of table elements outside the - table. - - * e-table-item.c: Fixed a crashing bug. - - * e-table-group.c: Added sorting. Fixed destruction to delete the - right things. - - * e-table-group-leaf.c, e-table-group-leaf.h: Pass column and sort - order information into the e_table_sorted_variable. Properly - destroy things when deleted. - - * e-table-group-container.c, e-table-group-container.h: Properly - handle the list of subgroups. Handle proper sorting and grouping - of subgroups. - - * e-table-sorted-variable.c, e-table-sorted-variable.h: Files to - do a sorted model that stays sorted as you add and remove rows. - - * Makefile.am: Added e-table-sorted-variable.c and - e-table-sorted-variable.h. - -2000-02-24 Christopher James Lahey - - * e-table-item.c: Made keyboard focus navigation work across - groups. - - * e-table-header.c: Made e_table_header_col_diff not crash if you - give it a column less than 0 (it truncates negative column values - to 0.) - - * e-table-group.c, e-table-group.h: Added e_table_group_get_header - to get the ETableHeader for this ETableGroup. - - * e-table-group-container.c: Made shift tab work. - -2000-02-24 Christopher James Lahey - - * e-table-item.c: Made changing focus work. - -2000-02-24 Christopher James Lahey - - * e-table-subset-variable.c, e-table-subset-variable.h: A new - model which is a subset, but you can add and remove rows. - - * test-table.c: Added a thaw method for use with the - e-table-subset (emits model_changed.) Adapted to the changes to - e_table_item. Properly parse headers. Adapted to the changes to - e_table, including creating example xml spec data. - - * test-cols.c, test-check.c: Added a thaw method for use with the - e-table-subset (emits model_changed.) Adapted to the changes to - e_table_item. - - * e-table.c, e-table.h: Reworked e-table to use the ETable - grouping system. The only difference for the interface is that - instead of passing in a column_spec and a grouping_spec, you pass - in a single string that is an xml format that includes both pieces - of information. - - * e-table-subset.h: Added rules for emacs to do correct - indentation. - - * e-table-subset.c: Implemented freezing. No signals are emitted - while frozen and "model_changed" is emitted when thawed. - - * e-table-sorted.h: ETableSortedClass has ETableSubset as its - parent object instead of ETableSubsetClass. Fixed this. - - * e-table-simple.c, e-table-simple.h: Implemented the thaw method. - Use of simple now requires an extra argument (the thaw method.) - - * e-table-model.h, e-table-model.c: Added e_table_model_freeze and - e_table_model_thaw. - - * e-table-item.h, e-table-item.c: Reworked this a bit to make it - provide some things the new group system needed and to make - inter-item keyboard focus work. Changed the external interface - only in the list of arguments it recognizes and signals it emits. - Instead of "x" and "y", you have to use - e_canvas_item_move_absolute and instead of emitting a - "height_changed" signal, it emits a "resize" signal. There's new - "has_focus", "width", and "height" arguments and a function to get - the currently focused column. - - * e-table-header-item.c: Got rid of some warnings here. Changed - the - - * e-table-group-leaf.h, e-table-group-leaf.c, - e-table-group-container.h, e-table-group-container.c: New types to - make e_table_group work properly. - - * e-table-group.h, e-table-group.c: Completely reworked e-table - grouping. e-table-group now uses a hierarchical structure. - - * e-cell.h: Added e_cell_print. This doesn't work yet. - - * e-cell.c: Made e_cell_realize exist. (It was improperly named - e_cell_view_realize in the .c.) - - * e-cell-text.c: Made the blinking cursor disappear properly. - - * check-filled.xpm, check-empty.xpm: Made these const char *[] - instead of char *[] to avoid compiler warnings. - - * Makefile.am: Added e-table-group-container.c, - e-table-group-container.h, e-table-group-leaf.c, - e-table-group-leaf.h, e-table-subset-variable.c, - e-table-subset-variable.h. - -2000-02-18 Miguel de Icaza - - * e-table-header.c: Include - - * Makefile.am (INCLUDES): Add EXTRA_GNOME_CFLAGS to INCLUDES> - -2000-02-12 Iain Holmes - - * e-table-header-item.c (ethi_drag_motion): Check the ethi is actually - the one being dragged. Prevents crashes when trying to drag headeritems - and there are multiple headeritems on the same canvas. - (ethi_drag_end): Same. - (ethi_drag_drop): Same. - (ethi_drag_leave): Same. - -2000-02-11 Christopher James Lahey - - * test-check.c: Added test of sort arrows. - - * e-table-col.h, e-table-col.c: Added sort arrows for column - headers (It doesn't actually sort. It just displays the arrows.) - - * e-table-header-item.c: Added display of arrows. - -2000-02-11 Christopher James Lahey - - * clip.png: Test column header image. - - * test-check.c: Test pixbuf column headers. - - * e-table-col.h, e-table-col.c: Added pixbufs for column headers. - - * e-table-header-item.c (draw_button): Draw pixbuf column headers properly. - -2000-02-11 Christopher James Lahey - - * e-cell-text.h, e-cell-text.c: Add an editable argument to - e_cell_text_new. - - * test-table.c, test-cols.c, test-check.c: Set the editable - argument to e_cell_text_new. - -2000-02-11 Christopher James Lahey - - * e-table-header-item.h, e-table-header-item.c: Added reordering - of columns. - - * e-table-header.c: Fixed a couple of bugs in the move column and - remove column functions. - -2000-02-11 Christopher James Lahey - - * e-cell-text.c: Made space around text look right. Added a - blinking cursor. - -2000-02-11 Miguel de Icaza - - * e-table-item.c (eti_header_structure_changed): Add nice - assertion. - -2000-02-10 Christopher James Lahey - - * e-cell-text.c: Handle button releases properly. - - * e-table-header-item.c (ethi_start_drag): Added a drag icon. - -2000-02-09 Christopher James Lahey - - * e-cell-text.c: Tweaked e-cell-text. Added a white background - and tweaked the borders. - -2000-02-09 Christopher James Lahey - - * Makefile.am: Changes where e-text is included from. - -2000-02-07 Christopher James Lahey - - * e-table-item.c (eti_event): Fixed some motion event - bugs. (incorrect x and y.) - - * Makefile.am: Added includes for dependencies in - evolution/widgets/libevolutionwidgets.a - - * e-cell-text.h, e-cell-text.c: Completely revamped using code - from e-text.c and e-text.h. - -2000-02-07 Miguel de Icaza - - * e-table.c (e_table_setup_table): Setup the scroll region of the - table canvas on size allocation. - (e_table_canvas_realize): Do not set the scrollregion here. - (e_table_canvas_init): Move root initialization here. - -2000-01-30 Miguel de Icaza - - * e-table-simple.c (e_table_simple_new): Add data field back in. - -1999-12-30 Miguel de Icaza - - * e-table-item.c (eti_attach_cell_views): New routine, creates the - cell views. - (eti_detach_cell_views): Detaches the cell_views from the - ETableItem. - (eti_realize_cell_views, eti_unrealize_cell_views): Simplified to - just do realize/unrealize notification. - (eti_add_table_model): Only attach the cells when we have both the - table model and the header model. - - * e-cell.h (ECellClass): Added two new methods: new_view and - kill_view which drive the view process (instead of putting that on - realize/unrealize). - - * e-cell.c: Adapt the code to use the new scheme for view - instantiation. - - * e-cell-text.c, e-cell-toggle.c: Adapted to the new class - changes. - -1999-12-22 Miguel de Icaza - - * e-table-item.c (e_table_item_focus): grab focus here with the - canvas method. - -1999-12-20 Miguel de Icaza - - * e-table-group.c (etg_update): Change the dimensions only if the - child changes its own. - - * e-table-item.c (eti_table_model_changed): Emit new signal on - table height change. - (eti_class_init): Register new "height_change" signal. - -1999-12-19 Damon Chaplin - - * 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 - - * 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 - - * 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 - - * e-table.c: Massive fixage. - - * test-table.c: Updates to test the mega widget. - -1999-12-10 Miguel de Icaza - - * e-table.c: New file, implements the mega widget. - -1999-12-09 Miguel de Icaza - - * e-table-header.c (e_table_header_col_diff): fix this routine. - -1999-12-04 Miguel de Icaza - - * 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 - - * 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 - - * e-table-header.c (e_table_header_index): fixed api. - -1999-12-01 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * ROADMAP.e-table: small spelling/typo fixes. - -1999-11-25 Miguel de Icaza - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * e-table-header-item.c (is_pointer_on_division): Add resizing - capabilities. - - * e-table-sorted.c: Finish implementation. - -1999-11-13 Miguel de Icaza - - * e-table-sorted.c: Implement e-table-sorted object. - -1999-11-12 Miguel de Icaza - - * e-table-header-item.c: Make the thing configurable. - - * e-table-header-item.h: Add font field, location, height. - -1999-11-12 Ettore Perazzoli - - * 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 - - * 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 - - * 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 - (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 - - * 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 - - * 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 - - * 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 - - * 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 - - * widgets/e-table-column.c, e-table-column.h: New file, implements the - e-table-column object. - - * widget/e-table-model.h, e-table-model.c, e-table-simple.c, - e-table-simple.h: New files. Implements the column model and - a simple table wrapper. - diff --git a/widgets/e-table/LICENSE b/widgets/e-table/LICENSE deleted file mode 100644 index b1f6ae08a4..0000000000 --- a/widgets/e-table/LICENSE +++ /dev/null @@ -1 +0,0 @@ -This code is released under the terms of the GNU GPL. diff --git a/widgets/e-table/Makefile.am b/widgets/e-table/Makefile.am deleted file mode 100644 index c6fe615258..0000000000 --- a/widgets/e-table/Makefile.am +++ /dev/null @@ -1,71 +0,0 @@ -INCLUDES = \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_INCLUDEDIR) \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir) - -noinst_LIBRARIES = \ - libetable.a - -libetable_a_SOURCES = \ - e-cell.c \ - e-cell.h \ - e-cell-checkbox.c \ - e-cell-checkbox.h \ - e-cell-text.c \ - e-cell-text.h \ - e-cell-toggle.c \ - e-cell-toggle.h \ - e-table.c \ - e-table.h \ - e-table-col.c \ - e-table-col.h \ - e-table-group.c \ - e-table-group.h \ - e-table-group-container.c \ - e-table-group-container.h \ - e-table-group-leaf.c \ - e-table-group-leaf.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-sorted-variable.c \ - e-table-sorted-variable.h \ - e-table-subset.c \ - e-table-subset.h \ - e-table-subset-variable.c \ - e-table-subset-variable.h - -noinst_PROGRAMS = \ - table-test - -table_test_SOURCES = \ - test-table.c \ - test-check.c \ - test-cols.c \ - table-test.c - -table_test_LDADD = \ - libetable.a \ - $(EXTRA_GNOME_LIBS) \ - $(top_builddir)/e-util/libeutil.a \ - $(top_builddir)/widgets/e-text/libetext.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 746b20234e..0000000000 --- a/widgets/e-table/check-empty.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const 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 c0468fc25b..0000000000 --- a/widgets/e-table/check-filled.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * check_filled_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ............ ", -" . . ", -" . . . ", -" . .. . ", -" . ... . ", -" . . ... . ", -" . .. ... . ", -" . ..... . ", -" . ... . ", -" . . . ", -" . . ", -" ............ ", -" ", -" "}; diff --git a/widgets/e-table/clip.png b/widgets/e-table/clip.png deleted file mode 100644 index 27aa5f072f..0000000000 Binary files a/widgets/e-table/clip.png and /dev/null differ diff --git a/widgets/e-table/e-cell-checkbox.c b/widgets/e-table/e-cell-checkbox.c deleted file mode 100644 index 431c1663d1..0000000000 --- a/widgets/e-table/e-cell-checkbox.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * e-cell-checkbox.c: Checkbox cell renderer - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include -#include -#include -#include -#include "e-cell-checkbox.h" -#include "e-util/e-util.h" -#include "e-table-item.h" - -#include "check-empty.xpm" -#include "check-filled.xpm" - -#define PARENT_TYPE e_cell_toggle_get_type() - -static GdkPixbuf *checks [2]; - -static void -e_cell_checkbox_class_init (GtkObjectClass *object_class) -{ - checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm); - checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm); -} - -E_MAKE_TYPE(e_cell_checkbox, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE); - -ECell * -e_cell_checkbox_new (void) -{ - ECellCheckbox *eccb = gtk_type_new (e_cell_checkbox_get_type ()); - - e_cell_toggle_construct (E_CELL_TOGGLE (eccb), 2, 2, checks); - - return (ECell *) eccb; -} diff --git a/widgets/e-table/e-cell-checkbox.h b/widgets/e-table/e-cell-checkbox.h deleted file mode 100644 index 969e4a5edc..0000000000 --- a/widgets/e-table/e-cell-checkbox.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _E_CELL_CHECKBOX_H_ -#define _E_CELL_CHECKBOX_H_ - -#include "e-cell-toggle.h" - -#define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ()) -#define E_CELL_CHECKBOX(o) (GTK_CHECK_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox)) -#define E_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_CHECKBOX_TYPE, ECellCheckboxClass)) -#define E_IS_CELL_CHECKBOX(o) (GTK_CHECK_TYPE ((o), E_CELL_CHECKBOX_TYPE)) -#define E_IS_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_CHECKBOX_TYPE)) - -typedef struct { - ECellToggle parent; -} ECellCheckbox; - -typedef struct { - ECellToggleClass parent_class; -} ECellCheckboxClass; - -GtkType e_cell_checkbox_get_type (void); -ECell *e_cell_checkbox_new (void); - -#endif /* _E_CELL_CHECKBOX_H_ */ - diff --git a/widgets/e-table/e-cell-string.c b/widgets/e-table/e-cell-string.c deleted file mode 100644 index 992b1bd10e..0000000000 --- a/widgets/e-table/e-cell-string.c +++ /dev/null @@ -1,9 +0,0 @@ -ECell * -e_cell_string_new (void) -{ - ECell *ecell; - - ecell = gtk_type_new (ecell); - - return ecell; -} diff --git a/widgets/e-table/e-cell-text.c b/widgets/e-table/e-cell-text.c deleted file mode 100644 index 37213e3904..0000000000 --- a/widgets/e-table/e-cell-text.c +++ /dev/null @@ -1,1887 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-cell-text.c - Text cell renderer - * Copyright (C) 2000 Helix Code, Inc. - * - * Authors: Miguel de Icaza (miguel@kernel.org) - * Chris Lahey - * - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "e-cell-text.h" -#include "e-util/e-util.h" -#include "e-table-item.h" -#include "e-text-event-processor-emacs-like.h" - -#include /* for BlackPixel */ -#include -#include - - - -/* This defines a line of text */ -struct line { - char *text; /* Line's text, it is a pointer into the text->text string */ - int length; /* Line's length in characters */ - int width; /* Line's width in pixels */ - int ellipsis_length; /* Length before adding ellipsis */ -}; - - - -/* Object argument IDs */ -enum { - ARG_0, - ARG_TEXT, - ARG_X, - ARG_Y, - ARG_FONT, - ARG_FONTSET, - ARG_FONT_GDK, - ARG_ANCHOR, - ARG_JUSTIFICATION, - ARG_CLIP_WIDTH, - ARG_CLIP_HEIGHT, - ARG_CLIP, - ARG_X_OFFSET, - ARG_Y_OFFSET, - ARG_FILL_COLOR, - ARG_FILL_COLOR_GDK, - ARG_FILL_COLOR_RGBA, - ARG_FILL_STIPPLE, - ARG_TEXT_WIDTH, - ARG_TEXT_HEIGHT, - ARG_EDITABLE, - ARG_USE_ELLIPSIS, - ARG_ELLIPSIS -}; - - -enum { - E_SELECTION_PRIMARY, - E_SELECTION_CLIPBOARD -}; - -static GdkAtom clipboard_atom = GDK_NONE; - - - -#define PARENT_TYPE e_cell_get_type() - -#define TEXT_PAD 4 - -typedef struct { - gpointer lines; /* Text split into lines (private field) */ - int num_lines; /* Number of lines of text */ - int max_width; - int ref_count; -} ECellTextLineBreaks; - - -typedef struct _CellEdit CellEdit; - -typedef struct { - ECellView cell_view; - GdkGC *gc; - GdkFont *font; - GdkCursor *i_cursor; - GdkBitmap *stipple; /* Stipple for text */ - - GnomeCanvas *canvas; - - /* - * During editing. - */ - CellEdit *edit; - - - int xofs, yofs; /* This gets added to the x - and y for the cell text. */ - double ellipsis_width; /* The width of the ellipsis. */ - -} ECellTextView; - -typedef struct _CurrentCell{ - ECellTextView *text_view; - int width; - gchar *text; - int model_col, view_col, row; - ECellTextLineBreaks *breaks; -} CurrentCell; - -#define CURRENT_CELL(x) ((CurrentCell *)(x)) - -struct _CellEdit { - CurrentCell cell; - - char *old_text; - - /* - * Where the editing is taking place - */ - - int xofs_edit, yofs_edit; /* Offset because of editing. - This is negative compared - to the other offsets. */ - - /* This needs to be reworked a bit once we get line wrapping. */ - int selection_start; /* Start of selection */ - int selection_end; /* End of selection */ - gboolean select_by_word; /* Current selection is by word */ - - /* This section is for drag scrolling and blinking cursor. */ - /* Cursor handling. */ - gint timeout_id; /* Current timeout id for scrolling */ - GTimer *timer; /* Timer for blinking cursor and scrolling */ - - gint lastx, lasty; /* Last x and y motion events */ - gint last_state; /* Last state */ - gulong scroll_start; /* Starting time for scroll (microseconds) */ - - gint show_cursor; /* Is cursor currently shown */ - gboolean button_down; /* Is mouse button 1 down */ - - ETextEventProcessor *tep; /* Text Event Processor */ - - GtkWidget *invisible; /* For selection handling */ - gboolean has_selection; /* TRUE if we have the selection */ - gchar *primary_selection; /* Primary selection text */ - gint primary_length; /* Primary selection text length */ - gchar *clipboard_selection; /* Clipboard selection text */ - gint clipboard_length; /* Clipboard selection text length*/ - - guint pointer_in : 1; - guint default_cursor_shown : 1; -}; - -static void e_cell_text_view_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data); - -static void e_cell_text_view_get_selection(CellEdit *edit, GdkAtom selection, guint32 time); -static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, guchar *data, gint length); - -static GtkWidget *e_cell_text_view_get_invisible(CellEdit *edit); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit); -static void split_into_lines (CurrentCell *cell); -static void unref_lines(CurrentCell *cell); -static void calc_line_widths (CurrentCell *cell); -static int get_line_ypos (CurrentCell *cell, struct line *line); -static int get_line_xpos (CurrentCell *cell, struct line *line); -static void _get_tep(CellEdit *edit); - -static gint _get_position_from_xy (CurrentCell *cell, gint x, gint y); -static void _get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp); -static gboolean _blink_scroll_timeout (gpointer data); - -static void build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row); -static void calc_ellipsis (ECellTextView *text_view); - -static ECellClass *parent_class; - -static void -ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row) -{ - e_table_item_redraw_range ( - text_view->cell_view.e_table_item_view, - view_col, view_row, view_col, view_row); -} - -/* - * Accept the currently edited text - */ -static void -ect_accept_edits (ECellTextView *text_view) -{ - CurrentCell *cell = (CurrentCell *) text_view->edit; - - e_table_model_set_value_at (text_view->cell_view.e_table_model, cell->model_col, cell->row, cell->text); -} - -/* - * Shuts down the editing process - */ -static void -ect_stop_editing (ECellTextView *text_view) -{ - CellEdit *edit = text_view->edit; - int row, view_col; - - row = edit->cell.row; - view_col = edit->cell.view_col; - - g_free (edit->old_text); - edit->old_text = NULL; - g_free (edit->cell.text); - edit->cell.text = NULL; - if (edit->invisible) - gtk_widget_unref (edit->invisible); - if (edit->tep) - gtk_object_unref (GTK_OBJECT(edit->tep)); - if (edit->primary_selection) - g_free(edit->primary_selection); - if (edit->clipboard_selection) - g_free(edit->clipboard_selection); - if ( ! edit->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(text_view->canvas)->window, NULL); - edit->default_cursor_shown = TRUE; - } - if (edit->timeout_id) { - g_source_remove(edit->timeout_id); - edit->timeout_id = 0; - } - if (edit->timer) { - g_timer_stop(edit->timer); - g_timer_destroy(edit->timer); - edit->timer = NULL; - } - - g_free (edit); - - text_view->edit = NULL; - ect_queue_redraw (text_view, view_col, row); -} - -/* - * Cancels the edits - */ -static void -ect_cancel_edit (ECellTextView *text_view) -{ - ect_stop_editing (text_view); -} - -/* - * ECell::new_view method - */ -static ECellView * -ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellText *ect = E_CELL_TEXT (ecell); - ECellTextView *text_view = g_new0 (ECellTextView, 1); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas; - - text_view->cell_view.ecell = ecell; - text_view->cell_view.e_table_model = table_model; - text_view->cell_view.e_table_item_view = e_table_item_view; - - if (ect->font_name){ - GdkFont *f; - - f = gdk_fontset_load (ect->font_name); - text_view->font = f; - } - if (!text_view->font){ - text_view->font = GTK_WIDGET (canvas)->style->font; - - gdk_font_ref (text_view->font); - } - - text_view->canvas = canvas; - - text_view->xofs = 0.0; - text_view->yofs = 0.0; - - return (ECellView *)text_view; -} - -/* - * ECell::kill_view method - */ -static void -ect_kill_view (ECellView *ecv) -{ - ECellTextView *text_view = (ECellTextView *) ecv; - - g_free (text_view); -} - -/* - * ECell::realize method - */ -static void -ect_realize (ECellView *ecell_view) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - - text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window); - - text_view->i_cursor = gdk_cursor_new (GDK_XTERM); - - calc_ellipsis (text_view); - - if (parent_class->realize) - (* parent_class->realize) (ecell_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; - - if (text_view->font) - gdk_font_unref (text_view->font); - - if (text_view->stipple) - gdk_bitmap_unref (text_view->stipple); - - gdk_cursor_destroy (text_view->i_cursor); - - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); -} - -/* - * 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) -{ - /* New ECellText */ - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - ECellTextView *text_view = (ECellTextView *) ecell_view; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - GdkFont *font = text_view->font; - const int height = font->ascent + font->descent; - CellEdit *edit = text_view->edit; - gboolean edit_display = FALSE; - ECellTextLineBreaks *linebreaks; - - - if (edit){ - - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - fg_gc = canvas->style->fg_gc[edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - } else - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } else { - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } - - /* - * 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); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - gdk_gc_set_foreground (text_view->gc, &canvas->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, &canvas->style->text [GTK_STATE_NORMAL]); - - x1 += 4; - y1 += 1; - x2 -= 4; - y2 -= 1; - - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - if ( edit_display ) { - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - - cell->width = x2 - x1; - - split_into_lines(cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - ypos = get_line_ypos (cell, lines); - ypos += font->ascent; - ypos -= edit->yofs_edit; - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (cell, lines); - xpos -= edit->xofs_edit; - start_char = lines->text - cell->text; - end_char = start_char + lines->length; - sel_start = edit->selection_start; - sel_end = edit->selection_end; - if (sel_start > sel_end ) { - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if ( sel_start < start_char ) - sel_start = start_char; - if ( sel_end > end_char ) - sel_end = end_char; - if ( sel_start < sel_end ) { - sel_rect.x = xpos + x1 + gdk_text_width (font, - lines->text, - sel_start - start_char); - sel_rect.y = ypos + y1 - font->ascent; - sel_rect.width = gdk_text_width (font, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = height; - gtk_paint_flat_box(canvas->style, - drawable, - edit->has_selection ? - GTK_STATE_SELECTED : - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - canvas, - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - sel_start - start_char); - gdk_draw_text (drawable, - font, - fg_gc, - xpos + x1 + gdk_text_width (font, - lines->text, - sel_start - start_char), - ypos + y1, - lines->text + sel_start - start_char, - sel_end - sel_start); - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1 + gdk_text_width (font, - lines->text, - sel_end - start_char), - ypos + y1, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->length); - } - if (edit->selection_start == edit->selection_end && - edit->selection_start >= start_char && - edit->selection_start <= end_char && - edit->show_cursor) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - xpos + x1 + gdk_text_width (font, - lines->text, - sel_start - start_char), - ypos + y1 - font->ascent, - 1, - height); - } - } - unref_lines(cell); - } else { - - ECellTextLineBreaks *linebreaks; - CurrentCell cell; - build_current_cell ( &cell, text_view, model_col, view_col, row ); - - cell.width = x2 - x1; - - split_into_lines(&cell); - - linebreaks = cell.breaks; - lines = linebreaks->lines; - ypos = get_line_ypos(&cell, lines); - ypos += font->ascent; - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (&cell, lines); - if ( ect->use_ellipsis && lines->ellipsis_length < lines->length) { - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->ellipsis_length); - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1 + - lines->width - text_view->ellipsis_width, - ypos + y1, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); - } else { - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->length); - } - } - - ypos += height; - lines++; - unref_lines(&cell); - } - - gdk_gc_set_clip_rectangle (text_view->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); -#if 0 - /* Old ECellText */ - - int xoff; - gboolean edit_display = FALSE; - - /* - * Figure if this cell is being edited - */ - if (edit_display){ - CellEdit *edit = text_view->edit; - const char *text = gtk_entry_get_text (edit->entry); - GdkWChar *p, *text_wc = g_new (GdkWChar, strlen (text) + 1); - int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text)); - const int cursor_pos = GTK_EDITABLE (edit->entry)->current_pos; - const int left_len = gdk_text_width_wc (text_view->font, text_wc, cursor_pos); - - text_wc [text_wc_len] = 0; - /* - * Paint - */ - gdk_gc_set_foreground (text_view->gc, &w->style->base [GTK_STATE_NORMAL]); - gdk_draw_rectangle (drawable, text_view->gc, TRUE, - rect.x, rect.y, rect.width, rect.height); - gdk_gc_set_foreground (text_view->gc, &w->style->text [GTK_STATE_NORMAL]); - - { - GdkGC *gc = text_view->gc; - const int y = y2 - font->descent - ((y2-y1-height)/2); - int px, i; - - /* - * Border - */ - x1 += 2; - x2--; - - px = x1; - - /* - * If the cursor is outside the visible range - * - * FIXME: we really want a better behaviour. - */ - if ((px + left_len) > x2) - px -= left_len - (x2-x1); - - /* - * Draw - */ - for (i = 0, p = text_wc; *p; p++, i++){ - gdk_draw_text_wc ( - drawable, font, gc, px, y, p, 1); - - if (i == cursor_pos){ - gdk_draw_line ( - drawable, gc, - px, y - font->ascent, - px, y + font->descent - 1); - } - - px += gdk_text_width_wc (font, p, 1); - } - - if (i == cursor_pos){ - gdk_draw_line ( - drawable, gc, - px, y - font->ascent, - px, y + font->descent - 1); - } - } - g_free (text_wc); - } else { - /* - * Regular cell - */ - GdkColor *background, *foreground; - int width; - - /* - * Border - */ - x1++; - x2--; - - /* - * Compute draw mode - */ - switch (ect->justify){ - case GTK_JUSTIFY_LEFT: - xoff = 1; - break; - - case GTK_JUSTIFY_RIGHT: - width = 1 + gdk_text_width (font, str, strlen (str)); - xoff = (x2 - x1) - width; - break; - - case GTK_JUSTIFY_CENTER: - xoff = ((x2 - x1) - gdk_text_width (font, str, strlen (str))) / 2; - break; - default: - xoff = 0; - g_warning ("Can not handle GTK_JUSTIFY_FILL"); - break; - } - - - if (selected){ - background = &w->style->bg [GTK_STATE_SELECTED]; - foreground = &w->style->text [GTK_STATE_SELECTED]; - } else { - background = &w->style->base [GTK_STATE_NORMAL]; - foreground = &w->style->text [GTK_STATE_NORMAL]; - } - - gdk_gc_set_foreground (text_view->gc, background); - gdk_draw_rectangle (drawable, text_view->gc, TRUE, - rect.x, rect.y, rect.width, rect.height); - gdk_gc_set_foreground (text_view->gc, foreground); - - gdk_draw_string ( - drawable, font, text_view->gc, - x1 + xoff, - y2 - font->descent - ((y2-y1-height)/2), str); - } -#endif -} - -/* - * Selects the entire string - */ -static void -ect_edit_select_all (ECellTextView *text_view) -{ - g_assert (text_view->edit); - - text_view->edit->selection_start = 0; - text_view->edit->selection_end = strlen(text_view->edit->cell.text); -} - -/* - * 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; - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - ETextEventProcessorEvent e_tep_event; - gboolean edit_display = FALSE; - CellEdit *edit = text_view->edit; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - gint return_val = 0; - - CurrentCell cell, *cellptr; - build_current_cell ( &cell, text_view, model_col, view_col, row ); - - - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - cellptr = CURRENT_CELL(edit); - } else { - cellptr = &cell; - } - } else { - cellptr = &cell; - } - - e_tep_event.type = event->type; - switch (event->type) { - case GDK_FOCUS_CHANGE: - break; - case GDK_KEY_PRESS: /* Fall Through */ - case GDK_KEY_RELEASE: - if (event->key.keyval == GDK_Escape){ - ect_cancel_edit (text_view); - return TRUE; - } - - if ((!edit_display) && ect->editable) { - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - ect_edit_select_all (text_view); - edit = text_view->edit; - cellptr = CURRENT_CELL(edit); - edit_display = TRUE; - } - if (edit_display) { - GdkEventKey key = event->key; - if ( key.keyval == GDK_KP_Enter || key.keyval == GDK_Return ) { - e_table_item_leave_edit (text_view->cell_view.e_table_item_view); - } else { - e_tep_event.key.time = key.time; - e_tep_event.key.state = key.state; - e_tep_event.key.keyval = key.keyval; - e_tep_event.key.length = key.length; - e_tep_event.key.string = key.string; - _get_tep(edit); - return e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - } - } - - else - return 0; - break; - case GDK_BUTTON_PRESS: /* Fall Through */ - case GDK_BUTTON_RELEASE: - event->button.x -= 4; - event->button.y -= 1; - if ((!edit_display) - && ect->editable - && event->type == GDK_BUTTON_RELEASE - && event->button.button == 1) { - GdkEventButton button = event->button; - - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - edit = text_view->edit; - cellptr = CURRENT_CELL(edit); - edit_display = TRUE; - - e_tep_event.button.type = GDK_BUTTON_PRESS; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(cellptr, button.x, button.y); - _get_tep(edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - edit->button_down = TRUE; - else - edit->button_down = FALSE; - } - edit->lastx = button.x; - edit->lasty = button.y; - edit->last_state = button.state; - - e_tep_event.button.type = GDK_BUTTON_RELEASE; - } - if (edit_display) { - GdkEventButton button = event->button; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(cellptr, button.x, button.y); - _get_tep(edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - edit->button_down = TRUE; - else - edit->button_down = FALSE; - } - edit->lastx = button.x; - edit->lasty = button.y; - edit->last_state = button.state; - } - break; - case GDK_MOTION_NOTIFY: - event->motion.x -= 4; - event->motion.y -= 1; - if (edit_display) { - GdkEventMotion motion = event->motion; - e_tep_event.motion.time = motion.time; - e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy(cellptr, motion.x, motion.y); - _get_tep(edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - edit->lastx = motion.x; - edit->lasty = motion.y; - edit->last_state = motion.state; - } - break; - case GDK_ENTER_NOTIFY: -#if 0 - edit->pointer_in = TRUE; -#endif - if (edit_display) { - if ( edit->default_cursor_shown ) { - gdk_window_set_cursor(canvas->window, text_view->i_cursor); - edit->default_cursor_shown = FALSE; - } - } - break; - case GDK_LEAVE_NOTIFY: -#if 0 - text_view->pointer_in = FALSE; -#endif - if (edit_display) { - if ( ! edit->default_cursor_shown ) { - gdk_window_set_cursor(canvas->window, NULL); - edit->default_cursor_shown = TRUE; - } - } - break; - default: - break; - } - if (return_val) - return return_val; -#if 0 - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); -#endif - else - return 0; - -#if 0 - switch (event->type){ - case GDK_BUTTON_PRESS: - /* - * Adjust for the border we use - */ - event->button.x++; - - printf ("Button pressed at %g %g\n", event->button.x, event->button.y); - if (text_view->edit){ - printf ("FIXME: Should handle click here\n"); - } else - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - break; - - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Escape){ - ect_cancel_edit (text_view); - return TRUE; - } - - if (!text_view->edit){ - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - ect_edit_select_all (text_view); - } - - gtk_widget_event (GTK_WIDGET (text_view->edit->entry), event); - ect_queue_redraw (text_view, view_col, row); - break; -#endif -} - -/* - * ECell::height method - */ -static int -ect_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - CurrentCell cell; - int return_val; - - build_current_cell ( &cell, text_view, model_col, view_col, row ); - split_into_lines( &cell ); - - return_val = (text_view->font->ascent + text_view->font->descent) * cell.breaks->num_lines + TEXT_PAD; - - unref_lines( &cell ); - - return return_val; -} - -/* - * ECellView::enter_edit method - */ -static void * -ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row); - CellEdit *edit; - - edit = g_new (CellEdit, 1); - text_view->edit = edit; - - build_current_cell ( CURRENT_CELL(edit), text_view, model_col, view_col, row ); - - edit->xofs_edit = 0.0; - edit->yofs_edit = 0.0; - - edit->selection_start = 0; - edit->selection_end = 0; - edit->select_by_word = FALSE; - - edit->timeout_id = g_timeout_add(10, _blink_scroll_timeout, text_view); - edit->timer = g_timer_new(); - g_timer_elapsed(edit->timer, &(edit->scroll_start)); - g_timer_start(edit->timer); - - edit->lastx = 0; - edit->lasty = 0; - edit->last_state = 0; - - edit->scroll_start = 0; - edit->show_cursor = TRUE; - edit->button_down = FALSE; - - edit->tep = NULL; - - edit->has_selection = FALSE; - - edit->invisible = NULL; - edit->primary_selection = NULL; - edit->primary_length = 0; - edit->clipboard_selection = NULL; - edit->clipboard_length = 0; - - edit->pointer_in = FALSE; - edit->default_cursor_shown = TRUE; - - edit->old_text = g_strdup (str); - edit->cell.text = g_strdup (str); - -#if 0 - if ( edit->pointer_in ) { - if ( edit->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text_view->i_cursor); - edit->default_cursor_shown = FALSE; - } - } -#endif - - 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; - CellEdit *edit = text_view->edit; - - if (edit){ - ect_accept_edits (text_view); - ect_stop_editing (text_view); - } else { - /* - * We did invoke this leave edit internally - */ - } -} - -/* - * GtkObject::destroy method - */ -static void -ect_destroy (GtkObject *object) -{ - ECellText *ect = E_CELL_TEXT (object); - - g_free (ect->font_name); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -e_cell_text_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = ect_destroy; - - ecc->new_view = ect_new_view; - ecc->kill_view = ect_kill_view; - ecc->realize = ect_realize; - ecc->unrealize = ect_unrealize; - ecc->draw = ect_draw; - ecc->event = ect_event; - ecc->height = ect_height; - ecc->enter_edit = ect_enter_edit; - ecc->leave_edit = ect_leave_edit; - - parent_class = gtk_type_class (PARENT_TYPE); - - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); -} - -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, gboolean editable) -{ - ECellText *ect = gtk_type_new (e_cell_text_get_type ()); - - ect->ellipsis = NULL; - ect->use_ellipsis = TRUE; - - ect->editable = editable; - - ect->font_name = g_strdup (fontname); - ect->justify = justify; - - return (ECell *) ect; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (CurrentCell *cell, struct line *line) -{ - int x; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - - x = text_view->xofs + ect->x; - - switch (ect->justify) { - case GTK_JUSTIFY_RIGHT: - x += cell->width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (cell->width - line->width) / 2; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_ypos (CurrentCell *cell, struct line *line) -{ - int y; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - - struct line *lines = linebreaks->lines; - - y = text_view->yofs + ect->y; - y += (line - lines) * (text_view->font->ascent + text_view->font->descent); - - return y; -} - -static void -_get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp) -{ - if (xp || yp) { - struct line *lines; - int x, y; - int j; - ECellTextView *text_view = cell->text_view; - GdkFont *font = text_view->font; - ECellTextLineBreaks *linebreaks; - - split_into_lines(cell); - - linebreaks = cell->breaks; - lines = linebreaks->lines; - - x = get_line_xpos (cell, lines); - y = get_line_ypos (cell, lines); - for (j = 0, lines = linebreaks->lines; j < linebreaks->num_lines; lines++, j++) { - if (lines->text > cell->text + position) - break; - y += font->ascent + font->descent; - } - lines --; - y -= font->descent; - - x += gdk_text_width (font, - lines->text, - position - (lines->text - cell->text)); - if ( (CellEdit *) cell == cell->text_view->edit ) { - x -= ((CellEdit *)cell)->xofs_edit; - y -= ((CellEdit *)cell)->yofs_edit; - } - if (xp) - *xp = x; - if (yp) - *yp = y; - unref_lines(cell); - } -} - -static gint -_get_position_from_xy (CurrentCell *cell, gint x, gint y) -{ - int i, j; - int xpos, ypos; - struct line *lines; - int return_val; - - ECellTextView *text_view = cell->text_view; - GdkFont *font = text_view->font; - ECellTextLineBreaks *linebreaks; - - split_into_lines(cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - - if ( (CellEdit *) cell == cell->text_view->edit ) { - x += ((CellEdit *)cell)->xofs_edit; - y += ((CellEdit *)cell)->yofs_edit; - } - - ypos = get_line_ypos (cell, linebreaks->lines); - j = 0; - while (y > ypos) { - ypos += font->ascent + font->descent; - j ++; - } - j--; - if (j >= linebreaks->num_lines) - j = linebreaks->num_lines - 1; - if (j < 0) - j = 0; - i = 0; - - lines += j; - xpos = get_line_xpos (cell, lines); - for(i = 0; i < lines->length; i++) { - int charwidth = gdk_text_width(font, - lines->text + i, - 1); - xpos += charwidth / 2; - if (xpos > x) { - break; - } - xpos += (charwidth + 1) / 2; - } - - return_val = lines->text + i - cell->text; - - unref_lines(cell); - - return return_val; -} - -#define SCROLL_WAIT_TIME 30000 - -static gboolean -_blink_scroll_timeout (gpointer data) -{ - CurrentCell *cell = CURRENT_CELL(data); - ECellTextView *text_view = (ECellTextView *) data; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - CellEdit *edit = text_view->edit; - ECellTextLineBreaks *linebreaks = cell->breaks; - - gulong current_time; - gboolean scroll = FALSE; - gboolean redraw = FALSE; - - g_timer_elapsed(edit->timer, ¤t_time); - - if (edit->scroll_start + SCROLL_WAIT_TIME > 1000000) { - if (current_time > edit->scroll_start - (1000000 - SCROLL_WAIT_TIME) && - current_time < edit->scroll_start) - scroll = TRUE; - } else { - if (current_time > edit->scroll_start + SCROLL_WAIT_TIME || - current_time < edit->scroll_start) - scroll = TRUE; - } - if (scroll && edit->button_down) { - /* FIXME: Copy this for y. */ - if (edit->lastx - ect->x > cell->width && - edit->xofs_edit < linebreaks->max_width - cell->width) { - edit->xofs_edit += 4; - if (edit->xofs_edit > linebreaks->max_width - cell->width + 1) - edit->xofs_edit = linebreaks->max_width - cell->width + 1; - redraw = TRUE; - } - if (edit->lastx - ect->x < 0 && - edit->xofs_edit > 0) { - edit->xofs_edit -= 4; - if (edit->xofs_edit < 0) - edit->xofs_edit = 0; - redraw = TRUE; - } - if (redraw) { - ETextEventProcessorEvent e_tep_event; - e_tep_event.type = GDK_MOTION_NOTIFY; - e_tep_event.motion.state = edit->last_state; - e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy(cell, edit->lastx, edit->lasty); - _get_tep(edit); - e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - edit->scroll_start = current_time; - } - } - - if (!((current_time / 500000) % 2)) { - if (!edit->show_cursor) - redraw = TRUE; - edit->show_cursor = TRUE; - } else { - if (edit->show_cursor) - redraw = TRUE; - edit->show_cursor = FALSE; - } - if ( redraw ) { - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } - return TRUE; -} - -static int -_get_position(ECellTextView *text_view, ETextEventProcessorCommand *command) -{ - int i; - int length; - int x, y; - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - - switch (command->position) { - - case E_TEP_VALUE: - return command->value; - - case E_TEP_SELECTION: - return edit->selection_end; - - case E_TEP_START_OF_BUFFER: - return 0; - case E_TEP_END_OF_BUFFER: - return strlen(cell->text); - - case E_TEP_START_OF_LINE: - for (i = edit->selection_end - 2; i > 0; i--) - if (cell->text[i] == '\n') { - i++; - break; - } - return i; - case E_TEP_END_OF_LINE: - length = strlen(cell->text); - for (i = edit->selection_end + 1; i < length; i++) - if (cell->text[i] == '\n') { - break; - } - if (i > length) - i = length; - return i; - - case E_TEP_FORWARD_CHARACTER: - length = strlen(cell->text); - i = edit->selection_end + 1; - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_CHARACTER: - i = edit->selection_end - 1; - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_WORD: - length = strlen(cell->text); - for (i = edit->selection_end + 1; i < length; i++) - if (isspace(cell->text[i])) { - break; - } - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_WORD: - for (i = edit->selection_end - 2; i > 0; i--) - if (isspace(cell->text[i])) { - i++; - break; - } - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_LINE: - _get_xy_from_position(cell, edit->selection_end, &x, &y); - y += text_view->font->ascent + text_view->font->descent; - return _get_position_from_xy(cell, x, y); - case E_TEP_BACKWARD_LINE: - _get_xy_from_position(cell, edit->selection_end, &x, &y); - y -= text_view->font->ascent + text_view->font->descent; - return _get_position_from_xy(cell, x, y); - - case E_TEP_FORWARD_PARAGRAPH: - case E_TEP_BACKWARD_PARAGRAPH: - - case E_TEP_FORWARD_PAGE: - case E_TEP_BACKWARD_PAGE: - return edit->selection_end; - default: - return edit->selection_end; - } -} - -static void -_delete_selection(ECellTextView *text_view) -{ - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - gint length = strlen(cell->text); - if (edit->selection_end == edit->selection_start) - return; - if (edit->selection_end < edit->selection_start) { - edit->selection_end ^= edit->selection_start; - edit->selection_start ^= edit->selection_end; - edit->selection_end ^= edit->selection_start; - } - memmove( cell->text + edit->selection_start, - cell->text + edit->selection_end, - length - edit->selection_end + 1 ); - length -= edit->selection_end - edit->selection_start; - edit->selection_end = edit->selection_start; -} - -static void -_insert(ECellTextView *text_view, char *string, int value) -{ - if (value > 0) { - char *temp; - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - gint length = strlen(cell->text); - temp = g_new(gchar, length + value + 1); - strncpy(temp, cell->text, edit->selection_start); - strncpy(temp + edit->selection_start, string, value); - strcpy(temp + edit->selection_start + value, cell->text + edit->selection_start); - g_free(cell->text); - cell->text = temp; - edit->selection_start += value; - edit->selection_end = edit->selection_start; - } -} - -static void -e_cell_text_view_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) -{ - CellEdit *edit = (CellEdit *) data; - CurrentCell *cell = CURRENT_CELL(edit); - ECellTextView *text_view = cell->text_view; - - gboolean change = FALSE; - gboolean redraw = FALSE; - - int sel_start, sel_end; - switch (command->action) { - case E_TEP_MOVE: - edit->selection_start = _get_position(text_view, command); - edit->selection_end = edit->selection_start; - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - break; - case E_TEP_SELECT: - edit->selection_end = _get_position(text_view, command); - sel_start = MIN(edit->selection_start, edit->selection_end); - sel_end = MAX(edit->selection_start, edit->selection_end); - if (sel_start != sel_end) { - e_cell_text_view_supply_selection (edit, command->time, GDK_SELECTION_PRIMARY, cell->text + sel_start, sel_end - sel_start); - } else if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - break; - case E_TEP_DELETE: - if (edit->selection_end == edit->selection_start) { - edit->selection_end = _get_position(text_view, command); - } - _delete_selection(text_view); - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - - case E_TEP_INSERT: - if (edit->selection_end != edit->selection_start) { - _delete_selection(text_view); - } - _insert(text_view, command->string, command->value); - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - case E_TEP_COPY: - sel_start = MIN(edit->selection_start, edit->selection_end); - sel_end = MAX(edit->selection_start, edit->selection_end); - if (sel_start != sel_end) { - e_cell_text_view_supply_selection (edit, command->time, clipboard_atom, cell->text + sel_start, sel_end - sel_start); - } - if (edit->timer) { - g_timer_reset(edit->timer); - } - break; - case E_TEP_PASTE: - e_cell_text_view_get_selection (edit, clipboard_atom, command->time); - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - case E_TEP_GET_SELECTION: - e_cell_text_view_get_selection (edit, GDK_SELECTION_PRIMARY, command->time); - break; - case E_TEP_ACTIVATE: - e_table_item_leave_edit (text_view->cell_view.e_table_item_view); - break; - case E_TEP_SET_SELECT_BY_WORD: - edit->select_by_word = command->value; - break; - case E_TEP_GRAB: - case E_TEP_UNGRAB: -#if 0 - case E_TEP_GRAB: - gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - text_view->i_cursor, - command->time); - break; - gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time); - break; -#endif - case E_TEP_NOP: - break; - } - - if (!edit->button_down) { - int x; - int i; - struct line *lines; - ECellTextLineBreaks *linebreaks; - - split_into_lines(cell); - - linebreaks = cell->breaks; - - for (lines = linebreaks->lines, i = 0; i < linebreaks->num_lines ; i++, lines ++) { - if (lines->text - cell->text > edit->selection_end) { - break; - } - } - lines --; - x = gdk_text_width(text_view->font, - lines->text, - edit->selection_end - (lines->text - cell->text)); - - - if (x < edit->xofs_edit) { - edit->xofs_edit = x; - redraw = TRUE; - } - - if (2 + x - cell->width > edit->xofs_edit) { - edit->xofs_edit = 2 + x - cell->width; - redraw = TRUE; - } - unref_lines(cell); - } - - if ( redraw ) { - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif -} - -static void _invisible_destroy (GtkInvisible *invisible, - CellEdit *edit) -{ - edit->invisible = NULL; -} - -static GtkWidget *e_cell_text_view_get_invisible(CellEdit *edit) -{ - GtkWidget *invisible; - if (edit->invisible) { - invisible = edit->invisible; - } else { - invisible = gtk_invisible_new(); - edit->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - edit); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - edit); - } - return invisible; -} - -static void -_selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit) -{ - if (event->selection == GDK_SELECTION_PRIMARY) { - g_free (edit->primary_selection); - edit->primary_selection = NULL; - edit->primary_length = 0; - - edit->has_selection = FALSE; -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif - - } else if (event->selection == clipboard_atom) { - g_free (edit->clipboard_selection); - edit->clipboard_selection = NULL; - edit->clipboard_length = 0; - } -} - -static void -_selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit) -{ - switch (info) { - case E_SELECTION_PRIMARY: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, edit->primary_selection, edit->primary_length); - break; - case E_SELECTION_CLIPBOARD: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, edit->clipboard_selection, edit->clipboard_length); - break; - } -} - -static void -_selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit) -{ - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - return; - } else { - ETextEventProcessorCommand command; - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.string = selection_data->data; - command.value = selection_data->length; - command.time = time; - e_cell_text_view_command(edit->tep, &command, edit); - } -} - -static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, guchar *data, gint length) -{ - gboolean successful; - GtkWidget *invisible; - - invisible = e_cell_text_view_get_invisible(edit); - - if (selection == GDK_SELECTION_PRIMARY ) { - if (edit->primary_selection) { - g_free (edit->primary_selection); - } - edit->primary_selection = g_strndup(data, length); - edit->primary_length = length; - } else if (selection == clipboard_atom) { - if (edit->clipboard_selection) { - g_free (edit->clipboard_selection); - } - edit->clipboard_selection = g_strndup(data, length); - edit->clipboard_length = length; - } - - successful = gtk_selection_owner_set (invisible, - selection, - time); - - if (selection == GDK_SELECTION_PRIMARY) - edit->has_selection = successful; -} - -static void -e_cell_text_view_get_selection(CellEdit *edit, GdkAtom selection, guint32 time) -{ - GtkWidget *invisible; - invisible = e_cell_text_view_get_invisible(edit); - gtk_selection_convert(invisible, - selection, - GDK_SELECTION_TYPE_STRING, - time); -} - -static void -_get_tep(CellEdit *edit) -{ - if (!edit->tep) { - edit->tep = e_text_event_processor_emacs_like_new(); - gtk_object_ref (GTK_OBJECT (edit->tep)); - gtk_object_sink (GTK_OBJECT (edit->tep)); - gtk_signal_connect(GTK_OBJECT(edit->tep), - "command", - GTK_SIGNAL_FUNC(e_cell_text_view_command), - (gpointer) edit); - } -} - -/* Splits the text of the text item into lines */ -static void -split_into_lines (CurrentCell *cell) -{ - char *p; - struct line *lines; - int len; - - gchar *text = cell->text; - ECellTextLineBreaks *linebreaks = cell->breaks; - - if (! cell->breaks) { - cell->breaks = g_new(ECellTextLineBreaks, 1); - cell->breaks->ref_count = 1; - } else { - cell->breaks->ref_count ++; - return; - } - linebreaks = cell->breaks; - - /* Check if already split. */ - - linebreaks->lines = NULL; - linebreaks->num_lines = 0; - - if (!text) - return; - - /* First, count the number of lines */ - - for (p = text; *p; p++) - if (*p == '\n') - linebreaks->num_lines++; - - linebreaks->num_lines++; - - /* Allocate array of lines and calculate split positions */ - - linebreaks->lines = lines = g_new0 (struct line, linebreaks->num_lines); - len = 0; - - for (p = text; *p; p++) { - if (len == 0) - lines->text = p; - if (*p == '\n') { - lines->length = len; - lines++; - len = 0; - } else - len++; - } - - if (len == 0) - lines->text = p; - lines->length = len; - - calc_line_widths (cell); -} - -/* Free lines structure. */ -static void -unref_lines(CurrentCell *cell) -{ - if ( cell->breaks ) { - cell->breaks->ref_count --; - if ( cell->breaks->ref_count <= 0 ) { - g_free(cell->breaks->lines); - g_free(cell->breaks); - cell->breaks = NULL; - } - } -} - -static void -calc_ellipsis (ECellTextView *text_view) -{ - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - if (text_view->font) - text_view->ellipsis_width = - gdk_text_width (text_view->font, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); -} - -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (CurrentCell *cell) -{ - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - GdkFont *font = text_view->font; - ECellTextLineBreaks *linebreaks = cell->breaks; - struct line *lines; - int i; - int j; - - - - lines = linebreaks->lines; - linebreaks->max_width = 0; - - if (!lines) - return; - - for (i = 0; i < linebreaks->num_lines; i++) { - if (lines->length != 0) { - if (font) { - lines->width = gdk_text_width (font, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (ect->use_ellipsis && - (!(text_view->edit && - cell->row == text_view->edit->cell.row && - cell->view_col == text_view->edit->cell.view_col)) && - lines->width > cell->width) { - if (font) { - lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++ ) { - if (gdk_text_width (font, lines->text, j) + text_view->ellipsis_width <= cell->width) - lines->ellipsis_length = j; - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = gdk_text_width (font, lines->text, lines->ellipsis_length) + - text_view->ellipsis_width; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > linebreaks->max_width) - linebreaks->max_width = lines->width; - } else { - lines->width = 0; - lines->ellipsis_length = 0; - } - - lines++; - } -} - -static void -build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row) -{ - ECellView *ecell_view = (ECellView *) text_view; - cell->text_view = text_view; - cell->model_col = model_col; - cell->view_col = view_col; - cell->row = row; - cell->breaks = NULL; - cell->text = e_table_model_value_at (ecell_view->e_table_model, model_col, row); - cell->width = e_table_header_get_column(((ETableItem *)ecell_view->e_table_item_view)->header, view_col)->width - 8; -} diff --git a/widgets/e-table/e-cell-text.h b/widgets/e-table/e-cell-text.h deleted file mode 100644 index 80afdf46ac..0000000000 --- a/widgets/e-table/e-cell-text.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellText - Text item for e-table. - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * Drawing and event handling from: - * - * EText - Text item for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ -#ifndef _E_CELL_TEXT_H_ -#define _E_CELL_TEXT_H_ - -#include -#include "e-cell.h" -#include "e-text-event-processor.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; - - double x, y; /* Position at anchor */ - - gulong pixel; /* Fill color */ - - /* Clip handling */ - char *ellipsis; /* The ellipsis characters. NULL = "...". */ - - guint use_ellipsis : 1; /* Whether to use the ellipsis. */ - guint editable : 1; /* Item is editable */ -} 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, gboolean editable); - -#endif /* _E_CELL_TEXT_H_ */ - - diff --git a/widgets/e-table/e-cell-toggle.c b/widgets/e-table/e-cell-toggle.c deleted file mode 100644 index 679d04a0ca..0000000000 --- a/widgets/e-table/e-cell-toggle.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * e-cell-toggle.c: Multi-state image toggle cell object. - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include -#include -#include -#include -#include "e-cell-toggle.h" -#include "e-util/e-util.h" -#include "e-table-item.h" - -#define PARENT_TYPE e_cell_get_type() - -typedef struct { - ECellView cell_view; - GdkGC *gc; - GnomeCanvas *canvas; -} ECellToggleView; - -static ECellClass *parent_class; - -static void -etog_queue_redraw (ECellToggleView *text_view, int view_col, int view_row) -{ - e_table_item_redraw_range ( - text_view->cell_view.e_table_item_view, - view_col, view_row, view_col, view_row); -} - -/* - * ECell::realize method - */ -static ECellView * -etog_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1); - ETableItem *eti = E_TABLE_ITEM (e_table_item_view); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas; - - toggle_view->cell_view.ecell = ecell; - toggle_view->cell_view.e_table_model = table_model; - toggle_view->cell_view.e_table_item_view = e_table_item_view; - toggle_view->canvas = canvas; - - return (ECellView *) toggle_view; -} - -static void -etog_kill_view (ECellView *ecell_view) -{ - g_free (ecell_view); -} - -static void -etog_realize (ECellView *ecell_view) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - - toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window); -} - -/* - * ECell::unrealize method - */ -static void -etog_unrealize (ECellView *ecv) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecv; - - gdk_gc_unref (toggle_view->gc); - toggle_view->gc = NULL; -} - -/* - * ECell::draw method - */ -static void -etog_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, gboolean selected, - int x1, int y1, int x2, int y2) -{ - ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - GdkPixbuf *image; - ArtPixBuf *art; - int x, y, width, height; - const int value = GPOINTER_TO_INT ( - e_table_model_value_at (ecell_view->e_table_model, model_col, row)); - - if (value >= toggle->n_states){ - g_warning ("Value from the table model is %d, the states we support are [0..%d)\n", - value, toggle->n_states); - return; - } - - /* - * Paint the background - */ - gdk_draw_rectangle (drawable, GTK_WIDGET (toggle_view->canvas)->style->white_gc, TRUE, x1, y1, x2 - x1, y2 - y1); - - image = toggle->images [value]; - art = image->art_pixbuf; - - if ((x2 - x1) < art->width){ - x = x1; - width = x2 - x1; - } else { - x = x1 + ((x2 - x1) - art->width) / 2; - width = art->width; - } - - if ((y2 - y1) < art->height){ - y = y1; - height = y2 - y1; - } else { - y = y1 + ((y2 - y1) - art->height) / 2; - height = art->height; - } - - width = y2 - y1; - - if (image->art_pixbuf->has_alpha){ - GdkColor background; - guchar *buffer; - int alpha, ix, iy; - - buffer = g_malloc (art->rowstride * art->height * 3); - - background.red = 255; - background.green = 255; - background.blue = 255; - - for (iy = 0; iy < art->height; iy++){ - unsigned char *dest; - unsigned char *src; - - dest = buffer + (iy * art->rowstride); - src = art->pixels + (iy * art->rowstride); - - for (ix = 0; ix < art->width; ix++){ - alpha = src [3]; - if (alpha == 0){ - *dest++ = background.red; - *dest++ = background.green; - *dest++ = background.blue; - src += 3; - } else if (alpha == 255){ - *dest++ = *src++; - *dest++ = *src++; - *dest++ = *src++; - } else { - *dest++ = (background.red + ((*src++ - background.red) * alpha + 0x80)) >> 8; - *dest++ = (background.green + ((*src++ - background.green) * alpha + 0x80)) >> 8; - *dest++ = (background.blue + ((*src++ - background.blue) * alpha + 0x80)) >> 8; - } - src++; - } - } - - gdk_draw_rgb_image_dithalign ( - drawable, toggle_view->gc, x, y, width, height, - GDK_RGB_DITHER_NORMAL, buffer, art->rowstride, 0, 0); - - g_free (buffer); - } else - gdk_draw_rgb_image_dithalign ( - drawable, toggle_view->gc, x, y, width, height, - GDK_RGB_DITHER_NORMAL, art->pixels, art->rowstride, 0, 0); -} - -static void -etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int row, int value) -{ - ECell *ecell = toggle_view->cell_view.ecell; - ECellToggle *toggle = E_CELL_TOGGLE (ecell); - - if (value >= toggle->n_states) - value = 0; - - e_table_model_set_value_at (toggle_view->cell_view.e_table_model, - model_col, row, GINT_TO_POINTER (value)); - etog_queue_redraw (toggle_view, view_col, row); -} - -/* - * ECell::event method - */ -static gint -etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row); - const int value = GPOINTER_TO_INT (_value); - - switch (event->type){ - case GDK_BUTTON_RELEASE: - etog_set_value (toggle_view, model_col, view_col, row, value + 1); - return TRUE; - - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_space){ - etog_set_value (toggle_view, model_col, view_col, row, value + 1); - return TRUE; - } - return FALSE; - - default: - return FALSE; - } - return TRUE; -} - -/* - * ECell::height method - */ -static int -etog_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - - return toggle->height; -} - -static void -etog_destroy (GtkObject *object) -{ - ECellToggle *etog = E_CELL_TOGGLE (object); - int i; - - for (i = 0; i < etog->n_states; i++) - gdk_pixbuf_unref (etog->images [i]); - - g_free (etog->images); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -e_cell_toggle_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = etog_destroy; - - ecc->new_view = etog_new_view; - ecc->kill_view = etog_kill_view; - ecc->realize = etog_realize; - ecc->unrealize = etog_unrealize; - ecc->draw = etog_draw; - ecc->event = etog_event; - ecc->height = etog_height; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -E_MAKE_TYPE(e_cell_toggle, "ECellToggle", ECellToggle, e_cell_toggle_class_init, NULL, PARENT_TYPE); - -void -e_cell_toggle_construct (ECellToggle *etog, int border, int n_states, GdkPixbuf **images) -{ - int max_height = 0; - int i; - - etog->border = border; - etog->n_states = n_states; - - etog->images = g_new (GdkPixbuf *, n_states); - - for (i = 0; i < n_states; i++){ - etog->images [i] = images [i]; - gdk_pixbuf_ref (images [i]); - - if (images [i]->art_pixbuf->height > max_height) - max_height = images [i]->art_pixbuf->height; - } - - etog->height = max_height; -} - -ECell * -e_cell_toggle_new (int border, int n_states, GdkPixbuf **images) -{ - ECellToggle *etog = gtk_type_new (e_cell_toggle_get_type ()); - - e_cell_toggle_construct (etog, border, n_states, images); - - return (ECell *) etog; -} - - diff --git a/widgets/e-table/e-cell-toggle.h b/widgets/e-table/e-cell-toggle.h deleted file mode 100644 index d5773b454a..0000000000 --- a/widgets/e-table/e-cell-toggle.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _E_CELL_TOGGLE_H_ -#define _E_CELL_TOGGLE_H_ - -#include -#include -#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 1d87019007..0000000000 --- a/widgets/e-table/e-cell.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * e-cell.c: base class for cell renderers in e-table - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include "e-cell.h" -#include "e-util/e-util.h" - -#define PARENT_TYPE gtk_object_get_type() - -static ECellView * -ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - return NULL; -} - -static void -ec_realize (ECellView *e_cell) -{ -} - -static void -ec_kill_view (ECellView *ecell_view) -{ -} - -static void -ec_unrealize (ECellView *e_cell) -{ -} - -static void -ec_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, gboolean selected, - int x1, int y1, int x2, int y2) -{ - g_error ("e-cell-draw invoked\n"); -} - -static gint -ec_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) -{ - g_error ("e-cell-event invoked\n"); - return 0; -} - -static gint -ec_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - g_error ("e-cell-event invoked\n"); - return 0; -} - -static void -ec_focus (ECellView *ecell_view, int model_col, int view_col, int row, int x1, int y1, int x2, int y2) -{ - ecell_view->focus_col = view_col; - ecell_view->focus_row = row; - ecell_view->focus_x1 = x1; - ecell_view->focus_y1 = y1; - ecell_view->focus_x2 = x2; - ecell_view->focus_y2 = y2; -} - -static void -ec_unfocus (ECellView *ecell_view) -{ - ecell_view->focus_col = -1; - ecell_view->focus_row = -1; - ecell_view->focus_x1 = -1; - ecell_view->focus_y1 = -1; - ecell_view->focus_x2 = -1; - ecell_view->focus_y2 = -1; -} - -static void * -ec_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return NULL; -} - -static void -ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *context) -{ -} - -static void -e_cell_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - ecc->realize = ec_realize; - ecc->unrealize = ec_unrealize; - ecc->new_view = ec_new_view; - ecc->kill_view = ec_kill_view; - ecc->draw = ec_draw; - ecc->event = ec_event; - ecc->focus = ec_focus; - ecc->unfocus = ec_unfocus; - ecc->height = ec_height; - ecc->enter_edit = ec_enter_edit; - ecc->leave_edit = ec_leave_edit; -} - -static void -e_cell_init (GtkObject *object) -{ -} - -E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE); - - -void -e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event ( - ecell_view, event, model_col, view_col, row); -} - -ECellView * -e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->new_view ( - ecell, table_model, e_table_item_view); -} - -void -e_cell_realize (ECellView *ecell_view) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->realize (ecell_view); -} - -void -e_cell_kill_view (ECellView *ecell_view) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->kill_view (ecell_view); -} - -void -e_cell_unrealize (ECellView *ecell_view) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view); -} - -void -e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, gboolean selected, int x1, int y1, int x2, int y2) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw ( - ecell_view, drawable, model_col, view_col, row, selected, x1, y1, x2, y2); -} - -int -e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height ( - ecell_view, model_col, view_col, row); -} - -void * -e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->enter_edit ( - ecell_view, model_col, view_col, row); -} - -void -e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit ( - ecell_view, model_col, view_col, row, edit_context); -} diff --git a/widgets/e-table/e-cell.h b/widgets/e-table/e-cell.h deleted file mode 100644 index b21653d6d1..0000000000 --- a/widgets/e-table/e-cell.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _E_CELL_H_ -#define _E_CELL_H_ - -#include -#include -#include "e-table-model.h" - -#define E_CELL_TYPE (e_cell_get_type ()) -#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell)) -#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) -#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE)) -#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) - -typedef struct _ECell ECell; -typedef struct _ECellView ECellView; - -struct _ECell { - GtkObject object; -}; - -struct _ECellView { - ECell *ecell; - ETableModel *e_table_model; - void *e_table_item_view; - - gint focus_x1, focus_y1, focus_x2, focus_y2; - gint focus_col, focus_row; -}; - -#define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1) - -typedef struct { - GtkObjectClass parent_class; - - ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, void *e_table_item_view); - void (*kill_view) (ECellView *ecell_view); - - void (*realize) (ECellView *ecell_view); - void (*unrealize) (ECellView *ecell_view); - - void (*draw) (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, - gboolean selected, int x1, int y1, int x2, int y2); - gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row); - void (*focus) (ECellView *ecell_view, int model_col, int view_col, - int row, int x1, int y1, int x2, int y2); - void (*unfocus) (ECellView *ecell_view); - int (*height) (ECellView *ecell_view, int model_col, int view_col, int row); - - void *(*enter_edit)(ECellView *ecell_view, int model_col, int view_col, int row); - void (*leave_edit)(ECellView *ecell_view, int model_col, int view_col, int row, void *context); -} ECellClass; - -GtkType e_cell_get_type (void); -ECellView *e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view); -void e_cell_kill_view (ECellView *ecell_view); - -void e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row); - -void e_cell_realize (ECellView *ecell_view); -void e_cell_unrealize (ECellView *ecell_view); - -void e_cell_draw (ECellView *ecell_view, GdkDrawable *dr, - int model_col, int view_col, int row, gboolean selected, - int x1, int y1, int x2, int y2); -void e_cell_print (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width, double height); -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 e2e12caf63..0000000000 --- a/widgets/e-table/e-table-col.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-col.c: ETableCol implementation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include "e-table-col.h" -#include "e-util/e-util.h" - -#define PARENT_TYPE (gtk_object_get_type ()) - -static GtkObjectClass *parent_class; - -static void -etc_destroy (GtkObject *object) -{ - ETableCol *etc = E_TABLE_COL (object); - - if ( etc->is_pixbuf ) - gdk_pixbuf_unref( etc->pixbuf ); - else - 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->is_pixbuf = FALSE; - - etc->col_idx = col_idx; - etc->text = g_strdup (text); - etc->pixbuf = NULL; - etc->width = width; - etc->min_width = min_width; - etc->ecell = ecell; - etc->compare = compare; - - etc->arrow = E_TABLE_COL_ARROW_NONE; - - etc->selected = 0; - etc->resizeable = resizable; - - return etc; -} - -ETableCol * -e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, 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->is_pixbuf = TRUE; - - etc->col_idx = col_idx; - etc->text = NULL; - etc->pixbuf = pixbuf; - etc->width = width; - etc->min_width = min_width; - etc->ecell = ecell; - etc->compare = compare; - - etc->arrow = E_TABLE_COL_ARROW_NONE; - - etc->selected = 0; - etc->resizeable = resizable; - - gdk_pixbuf_ref(etc->pixbuf); - - return etc; -} - -void -e_table_col_set_arrow (ETableCol *col, ETableColArrow arrow) -{ - col->arrow = arrow; -} - -ETableColArrow -e_table_col_get_arrow (ETableCol *col) -{ - return col->arrow; -} - - diff --git a/widgets/e-table/e-table-col.h b/widgets/e-table/e-table-col.h deleted file mode 100644 index c6f9c9dfb5..0000000000 --- a/widgets/e-table/e-table-col.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_COL_H_ -#define _E_TABLE_COL_H_ - -#include "e-cell.h" -#include - -#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; -typedef struct _ETableColClass ETableColClass; -typedef enum _ETableColArrow ETableColArrow; - -enum _ETableColArrow { - E_TABLE_COL_ARROW_NONE, - E_TABLE_COL_ARROW_UP, - E_TABLE_COL_ARROW_DOWN -}; - -/* - * Information about a single column - */ -struct _ETableCol { - GtkObject base; - char *text; - GdkPixbuf *pixbuf; - short width; - short min_width; - short x; - GCompareFunc compare; - unsigned int is_pixbuf:1; - unsigned int selected:1; - unsigned int resizeable:1; - int col_idx; - - ETableColArrow arrow; - - ECell *ecell; -}; - -struct _ETableColClass { - GtkObjectClass parent_class; -}; - -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); -ETableCol *e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, - int width, int min_width, - ECell *ecell, GCompareFunc compare, - gboolean resizable); -void e_table_col_destroy (ETableCol *etc); -void e_table_col_set_arrow (ETableCol *col, ETableColArrow arrow); -ETableColArrow e_table_col_get_arrow (ETableCol *col); - - -#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 -#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 -#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-container.c b/widgets/e-table/e-table-group-container.c deleted file mode 100644 index 1ae73b6c3b..0000000000 --- a/widgets/e-table/e-table-group-container.c +++ /dev/null @@ -1,853 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include "e-table-group-container.h" -#include "e-table-item.h" -#include -#include "e-util/e-util.h" -#include "e-util/e-canvas-utils.h" -#include "widgets/e-text/e-text.h" - -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define BUTTON_HEIGHT 10 -#define BUTTON_PADDING 2 - -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgc_parent_class; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_FROZEN -}; - -static void etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static int etgc_event (GnomeCanvasItem *item, GdkEvent *event); -static void etgc_realize (GnomeCanvasItem *item); -static void etgc_unrealize (GnomeCanvasItem *item); - -static void etgc_add (ETableGroup *etg, gint row); -static gboolean etgc_remove (ETableGroup *etg, gint row); -static void etgc_increment (ETableGroup *etg, gint position, gint amount); -static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col); - -static void etgc_child_resize (GtkObject *object, gpointer data); - -static void etgc_queue_reposition (ETableGroupContainer *etgc); - -typedef struct { - ETableGroup *child; - void *key; - GnomeCanvasItem *text; - GnomeCanvasItem *rect; - gint count; -} ETableGroupContainerChildNode; - -static void -e_table_group_container_child_node_free(ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node) -{ - ETableGroup *etg = E_TABLE_GROUP(etgc); - ETableGroup *child = child_node->child; - gtk_object_destroy(GTK_OBJECT(child)); - e_table_model_free_value(etg->model, etgc->ecol->col_idx, child_node->key); - gtk_object_destroy(GTK_OBJECT(child_node->text)); - gtk_object_destroy(GTK_OBJECT(child_node->rect)); -} - -static void -e_table_group_container_list_free(ETableGroupContainer *etgc) -{ - ETableGroupContainerChildNode *child_node; - GList *list; - if ( etgc->idle ) - g_source_remove( etgc->idle ); - for ( list = etgc->children; list; list = g_list_next(list) ) { - child_node = (ETableGroupContainerChildNode *) list->data; - e_table_group_container_child_node_free(etgc, child_node); - } - g_list_free(etgc->children); -} - -static void -etgc_destroy (GtkObject *object) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - - if ( etgc->font ) { - gdk_font_unref(etgc->font); - etgc->font = NULL; - } - if ( etgc->ecol ) { - gtk_object_unref(GTK_OBJECT(etgc->ecol)); - } - if ( etgc->rect ) { - gtk_object_destroy(GTK_OBJECT(etgc->rect)); - } - e_table_group_container_list_free(etgc); - - GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object); -} - -#if 0 -void -e_table_group_add (ETableGroup *etg, GnomeCanvasItem *item) -{ - double x1, y1, x2, y2; - - g_return_if_fail (etg != NULL); - g_return_if_fail (item != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - etg->children = g_list_append (etg->children, item); - - GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etg)->klass)->bounds (etg, &x1, &y1, &x2, &y2); - - if (GTK_OBJECT (etg)->flags & GNOME_CANVAS_ITEM_REALIZED){ - GList *l; - int height = etg->transparent ? 0 : TITLE_HEIGHT; - int x = etg->transparent ? 0 : GROUP_INDENT; - - for (l = etg->children; l->next; l = l->next){ - GnomeCanvasItem *child = l->data; - - height += child->y2 - child->y1; - - printf ("Height\n"); - if (E_IS_TABLE_ITEM (item)){ - printf (" Item: "); - } else { - printf (" Group: "); - } - printf ("%d\n", child->y2-child->y1); - } - - e_canvas_item_move_absolute ( item, x, height); - - - if (E_IS_TABLE_ITEM (item)){ - - printf ("Table item! ---------\n"); - gtk_signal_connect (GTK_OBJECT (item), "resize", - GTK_SIGNAL_FUNC (etg_relayout), etg); - } - } -} - -static void -etg_realize (GnomeCanvasItem *item) -{ - ETableGroup *etg = E_TABLE_GROUP (item); - GList *l; - int height = 0; - - GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item); - - for (l = etg->children; l; l = l->next){ - GnomeCanvasItem *child = l->data; - - printf ("During realization for child %p -> %d\n", child, height); - gnome_canvas_item_set ( - child, - "y", (double) height, - NULL); - - height += child->y2 - child->y1; - } -} - -static void -etg_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ETableGroup *etg = E_TABLE_GROUP (item); - - GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (item, affine, clip_path, flags); - - if (!etg->transparent){ - int current_width, current_height; - - etg_dim (etg, ¤t_width, ¤t_height); - - if ((current_height != etg->height) || (current_width != etg->width)){ - etg->width = current_width; - etg->height = current_height; - - gnome_canvas_item_set ( - etg->rect, - "x1", 0.0, - "y1", 0.0, - "x2", (double) etg->width, - "y2", (double) etg->height, - NULL); - } - } -} -#endif - -void -e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules) -{ - e_table_group_construct (parent, E_TABLE_GROUP (etgc), full_header, header, model); - etgc->ecol = ecol; - gtk_object_ref(GTK_OBJECT(etgc->ecol)); - etgc->child_rules = child_rules; - etgc->ascending = ascending; - - etgc->font = gdk_font_load ("lucidasans-10"); -#if 0 - etgc->open = open; - etgc->transparent = transparent; - - etgc_dim (etgc, &etgc->width, &etgc->height); - - if (!etgc->transparent) - etgc->rect = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (etgc), - gnome_canvas_rect_get_type (), - "fill_color", "gray", - "outline_color", "gray20", - "x1", 0.0, - "y1", 0.0, - "x2", (double) etgc->width, - "y2", (double) etgc->height, - NULL); -#endif - -#if 0 - /* - * Reparent the child into our space. - */ - gnome_canvas_item_reparent (child, GNOME_CANVAS_GROUP (etgc)); - - gnome_canvas_item_set ( - child, - "x", (double) GROUP_INDENT, - "y", (double) TITLE_HEIGHT, - NULL); - - /* - * Force dimension computation - */ - GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update ( - GNOME_CANVAS_ITEM (etgc), NULL, NULL, GNOME_CANVAS_UPDATE_REQUESTED); -#endif -} - -ETableGroup * -e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules) -{ - ETableGroupContainer *etgc; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (ecol != NULL, NULL); - - etgc = gtk_type_new (e_table_group_container_get_type ()); - - e_table_group_container_construct (parent, etgc, full_header, header, - model, ecol, ascending, child_rules); - return E_TABLE_GROUP (etgc); -} - -#if 0 -static void -etgc_relayout (GnomeCanvasItem *eti, ETableGroupContainer *etgc) -{ - GList *l; - int height = etgc->transparent ? 0 : GROUP_INDENT; - gboolean move = FALSE; - - printf ("Relaying out\n"); - - for (l = etgc->children; l->next; l = l->next){ - GnomeCanvasItem *child = l->data; - - height += child->y2 - child->y1; - - if (child == eti) - move = TRUE; - - if (move){ - printf ("Moving item %p\n", child); - gnome_canvas_item_set ( child, - "y", (double) height, - NULL); - } - } - if (height != etgc->height){ - etgc->height = height; - gtk_signal_emit (GTK_OBJECT (etgc), etgc_signals [RESIZE]); - } -} - -void -e_table_group_container_add (ETableGroupContainer *etgc, GnomeCanvasItem *item) -{ - double x1, y1, x2, y2; - - g_return_if_fail (etgc != NULL); - g_return_if_fail (item != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etgc)); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - etgc->children = g_list_append (etgc->children, item); - - GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etgc)->klass)->bounds (etgc, &x1, &y1, &x2, &y2); - - if (GTK_OBJECT (etgc)->flags & GNOME_CANVAS_ITEM_REALIZED){ - GList *l; - int height = etgc->transparent ? 0 : TITLE_HEIGHT; - int x = etgc->transparent ? 0 : GROUP_INDENT; - - for (l = etgc->children; l->next; l = l->next){ - GnomeCanvasItem *child = l->data; - - height += child->y2 - child->y1; - - printf ("Height\n"); - if (E_IS_TABLE_ITEM (item)){ - printf (" Item: "); - } else { - printf (" Group: "); - } - printf ("%d\n", child->y2-child->y1); - } - - e_canvas_item_move_absolute ( item, x, height); - - - if (E_IS_TABLE_ITEM (item)){ - - printf ("Table item! ---------\n"); - gtk_signal_connect (GTK_OBJECT (item), "resize", - GTK_SIGNAL_FUNC (etgc_relayout), etgc); - } - } -} - -static void -etgc_realize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item); - GList *l; - int height = 0; - - GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize (item); - - for (l = etgc->children; l; l = l->next){ - GnomeCanvasItem *child = l->data; - - printf ("During realization for child %p -> %d\n", child, height); - gnome_canvas_item_set ( - child, - "y", (double) height, - NULL); - - height += child->y2 - child->y1; - } -} - -static void -etgc_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item); - - GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (item, affine, clip_path, flags); - - if ( etgc->need_resize ) { - - if (!etgc->transparent){ - int current_width, current_height; - - etgc_dim (etgc, ¤t_width, ¤t_height); - - if ((current_height != etgc->height) || (current_width != etgc->width)){ - etgc->width = current_width; - etgc->height = current_height; - - gnome_canvas_item_set ( - etgc->rect, - "x1", 0.0, - "y1", 0.0, - "x2", (double) etgc->width, - "y2", (double) etgc->height, - NULL); - } - } - etgc->need_resize = FALSE; - } -} -#endif - -static int -etgc_event (GnomeCanvasItem *item, GdkEvent *event) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item); - gboolean return_val = TRUE; - gboolean change_focus = FALSE; - gboolean use_col = FALSE; - gint start_col = 0; - gint old_col; - EFocus direction = E_FOCUS_START; - - switch (event->type) { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - change_focus = TRUE; - use_col = TRUE; - start_col = (event->key.state & GDK_SHIFT_MASK) ? -1 : 0; - direction = (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START; - } else if (event->key.keyval == GDK_Left || - event->key.keyval == GDK_KP_Left) { - change_focus = TRUE; - use_col = TRUE; - start_col = -1; - direction = E_FOCUS_END; - } else if (event->key.keyval == GDK_Right || - event->key.keyval == GDK_KP_Right) { - change_focus = TRUE; - use_col = TRUE; - start_col = 0; - direction = E_FOCUS_START; - } else if (event->key.keyval == GDK_Down || - event->key.keyval == GDK_KP_Down) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_START; - } else if (event->key.keyval == GDK_Up || - event->key.keyval == GDK_KP_Up) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_END; - } else if (event->key.keyval == GDK_Return || - event->key.keyval == GDK_KP_Enter) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_START; - } - if ( change_focus ) { - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - ETableGroup *child = child_node->child; - if (e_table_group_get_focus(child)) { - old_col = e_table_group_get_focus_column(child); - if ( old_col == -1 ) - old_col = 0; - if ( start_col == -1 ) - start_col = e_table_header_count(e_table_group_get_header(child)) - 1; - - if (direction == E_FOCUS_END) - list = list->prev; - else - list = list->next; - - if (list) { - child_node = (ETableGroupContainerChildNode *)list->data; - child = child_node->child; - if (use_col) - e_table_group_set_focus(child, direction, start_col); - else { - e_table_group_set_focus(child, direction, old_col); - } - return 1; - } else { - return 0; - } - } - } - } - return_val = FALSE; - default: - return_val = FALSE; - } - if ( return_val == FALSE ) { - if ( GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event ) - return GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event(item, event); - } - return return_val; - -} - -/* Realize handler for the text item */ -static void -etgc_realize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc; - - if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) (item); - - etgc = E_TABLE_GROUP_CONTAINER (item); -} - -/* Unrealize handler for the etgc item */ -static void -etgc_unrealize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc; - - etgc = E_TABLE_GROUP_CONTAINER (item); - - if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (item); -} - -static void -compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node) -{ - /* FIXME : What a hack, eh? */ - gchar *text = g_strdup_printf("%s : %s (%d item%s)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count, child_node->count == 1 ? "" : "s" ); - gnome_canvas_item_set(child_node->text, - "text", text, - NULL); - g_free(text); -} - -static void etgc_add (ETableGroup *etg, gint row) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, row); - GCompareFunc comp = etgc->ecol->compare; - GList *list = etgc->children; - ETableGroup *child; - ETableGroupContainerChildNode *child_node; - int i = 0; - for ( ; list; list = g_list_next(list), i++ ) { - int comp_val; - child_node = (ETableGroupContainerChildNode *)(list->data); - comp_val = (*comp)(child_node->key, val); - if ( comp_val == 0 ) { - child = child_node->child; - child_node->count ++; - e_table_group_add(child, row); - compute_text(etgc, child_node); - return; - } - if ( (comp_val > 0 && etgc->ascending) || - (comp_val < 0 && (!etgc->ascending)) ) - break; - } - child_node = g_new(ETableGroupContainerChildNode, 1); - child_node->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc), - gnome_canvas_rect_get_type (), - "fill_color", "grey70", - "outline_color", "grey50", - NULL); - child_node->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc), - e_text_get_type(), - "font_gdk", etgc->font, - "anchor", GTK_ANCHOR_SW, - "x", (double) 0, - "y", (double) 0, - "fill_color", "black", - NULL); - child = e_table_group_new(GNOME_CANVAS_GROUP(etgc), etg->full_header, etg->header, etg->model, etgc->child_rules); - child_node->child = child; - child_node->key = e_table_model_duplicate_value(etg->model, etgc->ecol->col_idx, val); - - gtk_signal_connect(GTK_OBJECT(child), "resize", - etgc_child_resize, etgc); - child_node->count = 1; - e_table_group_add(child, row); - if ( list ) { - etgc->children = g_list_insert(etgc->children, child_node, i); - } - else - etgc->children = g_list_append(etgc->children, child_node); - compute_text(etgc, child_node); - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static gboolean etgc_remove (ETableGroup *etg, gint row) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list = etgc->children; - for ( ; list; list = g_list_next(list) ) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; - ETableGroup *child = child_node->child; - if ( e_table_group_remove(child, row) ) { - child_node->count --; - if ( child_node->count == 0 ) { - e_table_group_container_child_node_free(etgc, child_node); - etgc->children = g_list_remove(etgc->children, child_node); - g_free(child_node); - } else { - compute_text(etgc, child_node); - } - return TRUE; - } - } - return FALSE; - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static void etgc_increment (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list = etgc->children; - for ( ; list; list = g_list_next(list) ) { - e_table_group_increment(((ETableGroupContainerChildNode *)list->data)->child, position, amount); - } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - if (etgc->children) { - if (direction == E_FOCUS_END) { - e_table_group_set_focus(((ETableGroupContainerChildNode *)g_list_last(etgc->children)->data)->child, direction, view_col); - } else { - e_table_group_set_focus(((ETableGroupContainerChildNode *)etgc->children->data)->child, direction, view_col); - } - } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static gint -etgc_get_focus_column (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - if (etgc->children) { - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - ETableGroup *child = child_node->child; - if (e_table_group_get_focus(child)) { - return e_table_group_get_focus_column(child); - } - } - } - return 0; -} - -static void etgc_thaw (ETableGroup *etg) -{ - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static void -etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - if ( GTK_VALUE_BOOL (*arg) ) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - etgc_thaw(etg); - } - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width ) - E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width(etg, GTK_VALUE_DOUBLE (*arg)); - break; - default: - break; - } -} - -static void -etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void etgc_set_width (ETableGroup *etg, gdouble width) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - GList *list = etgc->children; - etgc->width = width; - - for ( ; list; list = g_list_next(list) ) { - gdouble child_width = width - GROUP_INDENT; - gtk_object_set(GTK_OBJECT(((ETableGroupContainerChildNode *)list->data)->child), - "width", child_width, - NULL); - } - - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static gdouble etgc_get_width (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - return etgc->width; -} - -static gdouble etgc_get_height (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - return etgc->height; -} - -static void -etgc_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS( object_class ); - - object_class->destroy = etgc_destroy; - object_class->set_arg = etgc_set_arg; - object_class->get_arg = etgc_get_arg; - - item_class->event = etgc_event; - item_class->realize = etgc_realize; - item_class->unrealize = etgc_unrealize; - - etgc_parent_class = gtk_type_class (PARENT_TYPE); - - e_group_class->add = etgc_add; - e_group_class->remove = etgc_remove; - e_group_class->increment = etgc_increment; - e_group_class->set_focus = etgc_set_focus; - e_group_class->get_focus_column = etgc_get_focus_column; - e_group_class->thaw = etgc_thaw; - - e_group_class->get_width = etgc_get_width; - e_group_class->set_width = etgc_set_width; - e_group_class->get_height = etgc_get_height; - - gtk_object_add_arg_type ("ETableGroupContainer::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableGroupContainer::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_FROZEN); -} - -static void -etgc_init (GtkObject *object) -{ - ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object); - container->children = FALSE; -} - -static gboolean -etgc_update_positioning (ETableGroupContainer *etgc, gpointer data) -{ - gboolean frozen; - gtk_object_get(GTK_OBJECT(etgc), - "frozen", &frozen, - NULL); - if ( frozen ) { - etgc->idle = 0; - return FALSE; - } - if ( GTK_OBJECT_FLAGS( etgc ) & GNOME_CANVAS_ITEM_REALIZED ) { - gdouble old_height; - - old_height = etgc->height; - if ( etgc->children == NULL ) { - } else { - GList *list; - gdouble extra_height; - gdouble running_height; - gdouble item_height = 0; - - extra_height = 0; - if (etgc->font) - extra_height += etgc->font->ascent + etgc->font->descent + BUTTON_PADDING * 2; - - extra_height = MAX(extra_height, BUTTON_HEIGHT + BUTTON_PADDING * 2); - - running_height = extra_height; - - list = etgc->children; - for ( ; list; list = g_list_next(list) ) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; - ETableGroup *child = child_node->child; - gtk_object_get( GTK_OBJECT(child), - "height", &item_height, - NULL ); - - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(child_node->text), - GROUP_INDENT, - running_height - BUTTON_PADDING); - - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(child), - GROUP_INDENT, - running_height); - - gnome_canvas_item_set(GNOME_CANVAS_ITEM(child_node->rect), - "x1", (double) 0, - "x2", (double) etgc->width, - "y1", (double) running_height - extra_height, - "y2", (double) running_height + item_height, - NULL); - - running_height += item_height + extra_height; - } - running_height -= extra_height; - if ( running_height != old_height) { - etgc->height = running_height; - gtk_signal_emit_by_name (GTK_OBJECT (etgc), "resize"); - } - } - } - etgc->idle = 0; - return FALSE; -} - -static void -etgc_queue_reposition (ETableGroupContainer *etgc) -{ - if (etgc->idle == 0) - etgc->idle = g_idle_add((GSourceFunc)etgc_update_positioning, etgc); -} - -static void -etgc_child_resize (GtkObject *object, gpointer data) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(data); - etgc_queue_reposition (etgc); -} - -E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); - diff --git a/widgets/e-table/e-table-group-container.h b/widgets/e-table/e-table-group-container.h deleted file mode 100644 index 2234e77ac1..0000000000 --- a/widgets/e-table/e-table-group-container.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_CONTAINER_H_ -#define _E_TABLE_GROUP_CONTAINER_H_ - -#include -#include "e-table-model.h" -#include "e-table-header.h" -#include "e-table-group.h" - -#define E_TABLE_GROUP_CONTAINER_TYPE (e_table_group_container_get_type ()) -#define E_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainer)) -#define E_TABLE_GROUP_CONTAINER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainerClass)) -#define E_IS_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_CONTAINER_TYPE)) -#define E_IS_TABLE_GROUP_CONTAINER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_CONTAINER_TYPE)) - -typedef struct { - ETableGroup group; - - /* - * The ETableCol used to group this set - */ - ETableCol *ecol; - gint ascending; - - /* - * List of ETableGroups we stack - */ - GList *children; - - /* - * The canvas rectangle that contains the children - */ - GnomeCanvasItem *rect; - - GdkFont *font; - - gdouble width, height; - - void *child_rules; - - gint idle; - - /* - * Update booleans: - */ - guint need_resize : 1; - - /* - * State: the ETableGroup is open or closed - */ - guint open:1; -} ETableGroupContainer; - -typedef struct { - ETableGroupClass parent_class; -} ETableGroupContainerClass; - -ETableGroup *e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules); -void e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules); - -GtkType e_table_group_container_get_type (void); - -#endif /* _E_TABLE_GROUP_CONTAINER_H_ */ diff --git a/widgets/e-table/e-table-group-leaf.c b/widgets/e-table/e-table-group-leaf.c deleted file mode 100644 index 2e939453d7..0000000000 --- a/widgets/e-table/e-table-group-leaf.c +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include "e-table-group-leaf.h" -#include "e-table-item.h" -#include -#include "e-util/e-util.h" - -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgl_parent_class; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_FROZEN -}; - -static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void -etgl_destroy (GtkObject *object) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(object); - gtk_object_unref(GTK_OBJECT(etgl->subset)); - gtk_object_destroy(GTK_OBJECT(etgl->item)); - if ( GTK_OBJECT_CLASS (etgl_parent_class)->destroy ) - GTK_OBJECT_CLASS (etgl_parent_class)->destroy (object); -} - -static void -e_table_group_leaf_construct (GnomeCanvasGroup *parent, ETableGroupLeaf *etgl, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - int col, - int ascending) -{ - etgl->subset = E_TABLE_SUBSET_VARIABLE(e_table_sorted_variable_new(model, col, ascending, e_table_header_get_column(full_header, col)->compare)); - e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model); -} - -ETableGroup * -e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - int col, - int ascending) -{ - ETableGroupLeaf *etgl; - - g_return_val_if_fail (parent != NULL, NULL); - - etgl = gtk_type_new (e_table_group_leaf_get_type ()); - - e_table_group_leaf_construct (parent, etgl, full_header, - header, model, col, ascending); - return E_TABLE_GROUP (etgl); -} - -static void -etgl_resize (GtkObject *object, gpointer data) -{ - e_table_group_resize (E_TABLE_GROUP(data)); -} - -static void -etgl_realize (GnomeCanvasItem *item) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(item); - gdouble height; - - if ( GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize ) - GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item); - - etgl->item = E_TABLE_ITEM(gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgl), - e_table_item_get_type (), - "ETableHeader", E_TABLE_GROUP(etgl)->header, - "ETableModel", etgl->subset, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - "width", etgl->width, - NULL)); - gtk_signal_connect(GTK_OBJECT(etgl->item), - "resize", etgl_resize, etgl); - gtk_object_get(GTK_OBJECT(etgl->item), - "height", &height, - NULL); - if ( height != 1 ) - e_table_group_resize(E_TABLE_GROUP(etgl)); -} - -static int -etgl_event (GnomeCanvasItem *item, GdkEvent *event) -{ - gboolean return_val = TRUE; - - switch (event->type) { - - default: - return_val = FALSE; - } - if ( return_val == FALSE ) { - if ( GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event ) - return GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event(item, event); - } - return return_val; - -} - -static void -etgl_add (ETableGroup *etg, gint row) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - e_table_subset_variable_add(etgl->subset, row); -} - -static gboolean -etgl_remove (ETableGroup *etg, gint row) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - return e_table_subset_variable_remove(etgl->subset, row); -} - -static void -etgl_increment (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - e_table_subset_variable_increment(etgl->subset, position, amount); -} - -static void -etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (direction == E_FOCUS_END) { - e_table_item_focus(etgl->item, view_col, e_table_model_row_count(E_TABLE_MODEL(etgl->subset)) - 1); - } else { - e_table_item_focus(etgl->item, view_col, 0); - } -} - -static gint -etgl_get_focus_column (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - return e_table_item_get_focused_column(etgl->item); -} - -static void -etgl_set_width (ETableGroup *etg, gdouble width) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - etgl->width = width; -#if 0 - if ( etgl->item ) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(etgl->item), - "width", width, - NULL); - } -#endif -} - -static gdouble -etgl_get_width (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - gtk_object_get(GTK_OBJECT(etgl->item), - "width", &etgl->width, - NULL); - return etgl->width; -} - -static gdouble -etgl_get_height (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - gdouble height; - if ( etgl->item ) - gtk_object_get(GTK_OBJECT(etgl->item), - "height", &height, - NULL); - else - height = 1; - return height; -} - -static void -etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - if ( GTK_VALUE_BOOL (*arg) ) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - } - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width ) - E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width(etg, GTK_VALUE_DOUBLE (*arg)); - break; - default: - break; - } -} - -static void -etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -etgl_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS( object_class ); - - object_class->destroy = etgl_destroy; - object_class->set_arg = etgl_set_arg; - object_class->get_arg = etgl_get_arg; - - item_class->realize = etgl_realize; - item_class->event = etgl_event; - - etgl_parent_class = gtk_type_class (PARENT_TYPE); - - e_group_class->add = etgl_add; - e_group_class->remove = etgl_remove; - e_group_class->increment = etgl_increment; - e_group_class->set_focus = etgl_set_focus; - e_group_class->get_focus_column = etgl_get_focus_column; - - e_group_class->get_width = etgl_get_width; - e_group_class->set_width = etgl_set_width; - e_group_class->get_height = etgl_get_height; - - gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_FROZEN); -} - -static void -etgl_init (GtkObject *object) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); - - etgl->width = 1; - etgl->subset = NULL; - etgl->item = NULL; -} - -E_MAKE_TYPE (e_table_group_leaf, "ETableGroupLeaf", ETableGroupLeaf, etgl_class_init, etgl_init, PARENT_TYPE); diff --git a/widgets/e-table/e-table-group-leaf.h b/widgets/e-table/e-table-group-leaf.h deleted file mode 100644 index 6ffd9066d1..0000000000 --- a/widgets/e-table/e-table-group-leaf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_LEAF_H_ -#define _E_TABLE_GROUP_LEAF_H_ - -#include -#include "e-table-group.h" -#include "e-table-sorted-variable.h" -#include "e-table-item.h" - -#define E_TABLE_GROUP_LEAF_TYPE (e_table_group_leaf_get_type ()) -#define E_TABLE_GROUP_LEAF(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeaf)) -#define E_TABLE_GROUP_LEAF_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeafClass)) -#define E_IS_TABLE_GROUP_LEAF(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_LEAF_TYPE)) -#define E_IS_TABLE_GROUP_LEAF_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_LEAF_TYPE)) - -typedef struct { - ETableGroup group; - - /* - * Item. - */ - ETableItem *item; - - gdouble width; - - ETableSubsetVariable *subset; -} ETableGroupLeaf; - -typedef struct { - ETableGroupClass parent_class; -} ETableGroupLeafClass; - -ETableGroup *e_table_group_leaf_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - int col, - int ascending); -GtkType e_table_group_leaf_get_type (void); - -#endif /* _E_TABLE_GROUP_LEAF_H_ */ diff --git a/widgets/e-table/e-table-group.c b/widgets/e-table/e-table-group.c deleted file mode 100644 index 6ae8a25db7..0000000000 --- a/widgets/e-table/e-table-group.c +++ /dev/null @@ -1,369 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include "e-table-group.h" -#include "e-table-group-container.h" -#include "e-table-group-leaf.h" -#include "e-table-item.h" -#include -#include -#include "e-util/e-util.h" -#include "e-util/e-xml-utils.h" - -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define PARENT_TYPE gnome_canvas_group_get_type () - -#define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT(e)->klass)) - -static GnomeCanvasGroupClass *etg_parent_class; - -enum { - RESIZE, - LAST_SIGNAL -}; - -static gint etg_signals [LAST_SIGNAL] = { 0, }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_FROZEN -}; - -static void etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean etg_get_focus (ETableGroup *etg); -static void etg_destroy (GtkObject *object); -#if 0 -GnomeCanvasItem * -e_table_group_new (GnomeCanvasGroup *parent, ETableCol *ecol, - gboolean open, gboolean transparent) -{ - ETableGroup *etg; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (ecol != NULL, NULL); - - etg = gtk_type_new (e_table_group_get_type ()); - - e_table_group_construct (parent, etg, ecol, open, transparent); - - return GNOME_CANVAS_ITEM (etg); -} -#endif - -static void -etg_destroy (GtkObject *object) -{ - ETableGroup *etg = E_TABLE_GROUP(object); - gtk_object_unref(GTK_OBJECT(etg->header)); - gtk_object_unref(GTK_OBJECT(etg->full_header)); - gtk_object_unref(GTK_OBJECT(etg->model)); - if ( GTK_OBJECT_CLASS (etg_parent_class)->destroy ) - GTK_OBJECT_CLASS (etg_parent_class)->destroy (object); -} - -ETableGroup * -e_table_group_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - xmlNode *rules) -{ - int column; - int ascending; - - g_return_val_if_fail (model != NULL, NULL); - - column = e_xml_get_integer_prop_by_name(rules, "column"); - ascending = e_xml_get_integer_prop_by_name(rules, "ascending"); - - if(rules && !xmlStrcmp(rules->name, "group")) { - ETableCol *col; - if ( column > e_table_header_count(full_header) ) - return e_table_group_leaf_new(parent, full_header, header, model, column, ascending); - col = e_table_header_get_columns(full_header)[column]; - return e_table_group_container_new(parent, full_header, header, model, col, ascending, rules->childs); - } else { - return e_table_group_leaf_new(parent, full_header, header, model, column, ascending); - } - return NULL; -} - -void -e_table_group_construct (GnomeCanvasGroup *parent, - ETableGroup *etg, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model) -{ - etg->full_header = full_header; - gtk_object_ref(GTK_OBJECT(etg->full_header)); - etg->header = header; - gtk_object_ref(GTK_OBJECT(etg->header)); - etg->model = model; - gtk_object_ref(GTK_OBJECT(etg->model)); - gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); -} - -void -e_table_group_add (ETableGroup *etg, - gint row) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->add ) - ETG_CLASS (etg)->add (etg, row); -} - -gboolean -e_table_group_remove (ETableGroup *etg, - gint row) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if ( ETG_CLASS (etg)->remove ) - return ETG_CLASS (etg)->remove (etg, row); - else - return FALSE; -} - -gint -e_table_group_get_count (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), 0); - - if ( ETG_CLASS (etg)->get_count ) - return ETG_CLASS (etg)->get_count (etg); - else - return 0; -} - -void -e_table_group_increment (ETableGroup *etg, - gint position, - gint amount) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->increment ) - ETG_CLASS (etg)->increment (etg, position, amount); -} - -void -e_table_group_set_focus (ETableGroup *etg, - EFocus direction, - gint row) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->set_focus ) - ETG_CLASS (etg)->set_focus (etg, direction, row); -} - -gboolean -e_table_group_get_focus (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if ( ETG_CLASS (etg)->get_focus ) - return ETG_CLASS (etg)->get_focus (etg); - else - return FALSE; -} - -gboolean -e_table_group_get_focus_column (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if ( ETG_CLASS (etg)->get_focus_column ) - return ETG_CLASS (etg)->get_focus_column (etg); - else - return FALSE; -} - -ETableCol * -e_table_group_get_ecol (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL); - - if ( ETG_CLASS (etg)->get_ecol ) - return ETG_CLASS (etg)->get_ecol (etg); - else - return NULL; -} - -void -e_table_group_resize (ETableGroup *e_table_group) -{ - g_return_if_fail (e_table_group != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (e_table_group)); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [RESIZE]); -} - -ETableHeader * -e_table_group_get_header (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL); - - return etg->header; -} - -static int -etg_event (GnomeCanvasItem *item, GdkEvent *event) -{ - ETableGroup *etg = E_TABLE_GROUP (item); - gboolean return_val = TRUE; - - switch (event->type) { - - case GDK_FOCUS_CHANGE: - etg->has_focus = event->focus_change.in; - return_val = FALSE; - - default: - return_val = FALSE; - } - if ( return_val == FALSE ) { - if ( GNOME_CANVAS_ITEM_CLASS(etg_parent_class)->event ) - return GNOME_CANVAS_ITEM_CLASS(etg_parent_class)->event(item, event); - } - return return_val; - -} - -static void -etg_thaw(ETableGroup *etg) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->thaw ) - ETG_CLASS (etg)->thaw (etg); -} - -static void -etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - if ( GTK_VALUE_BOOL (*arg) ) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - etg_thaw(etg); - } - break; - case ARG_WIDTH: - if ( ETG_CLASS(etg)->set_width ) - ETG_CLASS(etg)->set_width(etg, GTK_VALUE_DOUBLE (*arg)); - break; - default: - break; - } -} - -static void -etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - if ( ETG_CLASS(etg)->get_height ) - GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_height(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - case ARG_WIDTH: - if ( ETG_CLASS(etg)->get_width ) - GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_width(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static gboolean -etg_get_focus (ETableGroup *etg) -{ - return etg->has_focus; -} - -static void -etg_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *klass = (ETableGroupClass *) object_class; - - object_class->set_arg = etg_set_arg; - object_class->get_arg = etg_get_arg; - object_class->destroy = etg_destroy; - - item_class->event = etg_event; - - klass->resize = NULL; - - klass->add = NULL; - klass->remove = NULL; - klass->get_count = NULL; - klass->increment = NULL; - klass->set_focus = NULL; - klass->get_focus = etg_get_focus; - klass->get_ecol = NULL; - - klass->thaw = NULL; - klass->get_height = NULL; - klass->get_width = NULL; - klass->set_width = NULL; - - etg_parent_class = gtk_type_class (PARENT_TYPE); - - etg_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL); -} - -E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE); - - - diff --git a/widgets/e-table/e-table-group.h b/widgets/e-table/e-table-group.h deleted file mode 100644 index 0dd62eb125..0000000000 --- a/widgets/e-table/e-table-group.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_H_ -#define _E_TABLE_GROUP_H_ - -#include -#include -#include "e-table-model.h" -#include "e-table-header.h" -#include "e-util/e-util.h" - -#define E_TABLE_GROUP_TYPE (e_table_group_get_type ()) -#define E_TABLE_GROUP(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup)) -#define E_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_TYPE, ETableGroupClass)) -#define E_IS_TABLE_GROUP(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_TYPE)) -#define E_IS_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_TYPE)) - -typedef struct { - GnomeCanvasGroup group; - - /* - * The full header. - */ - ETableHeader *full_header; - ETableHeader *header; - - /* - * The model we pull data from. - */ - ETableModel *model; - - /* - * Whether we should add indentation and open/close markers, - * or if we just act as containers of subtables. - */ - guint transparent : 1; - - guint has_focus : 1; - - guint frozen : 1; -} ETableGroup; - -typedef struct { - GnomeCanvasGroupClass parent_class; - void (*resize) (ETableGroup *etg); - - void (*add) (ETableGroup *etg, gint row); - gboolean (*remove) (ETableGroup *etg, gint row); - gint (*get_count) (ETableGroup *etg); - void (*increment) (ETableGroup *etg, gint position, gint amount); - void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); - gboolean (*get_focus) (ETableGroup *etg); - gint (*get_focus_column) (ETableGroup *etg); - ETableCol *(*get_ecol) (ETableGroup *etg); - - void (*thaw) (ETableGroup *etg); - gdouble (*get_height) (ETableGroup *etg); - gdouble (*get_width) (ETableGroup *etg); - void (*set_width) (ETableGroup *etg, gdouble width); -} ETableGroupClass; - -void e_table_group_add (ETableGroup *etg, - gint row); -gboolean e_table_group_remove (ETableGroup *etg, - gint row); -gint e_table_group_get_count (ETableGroup *etg); -void e_table_group_increment (ETableGroup *etg, - gint position, - gint amount); -void e_table_group_set_focus (ETableGroup *etg, - EFocus direction, - gint view_col); -gboolean e_table_group_get_focus (ETableGroup *etg); -gint e_table_group_get_focus_column (ETableGroup *etg); -ETableHeader *e_table_group_get_header (ETableGroup *etg); -ETableCol *e_table_group_get_ecol (ETableGroup *etg); - -ETableGroup *e_table_group_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - xmlNode *rules); -void e_table_group_construct (GnomeCanvasGroup *parent, - ETableGroup *etg, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model); - -/* For emitting the signal */ -void e_table_group_resize (ETableGroup *etg); - -GtkType e_table_group_get_type (void); - -#endif /* _E_TABLE_GROUP_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 6b6146c938..0000000000 --- a/widgets/e-table/e-table-header-item.c +++ /dev/null @@ -1,920 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include -#include "e-util/e-cursors.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-col-dnd.h" - -#include "add-col.xpm" -#include "remove-col.xpm" - -/* Padding above and below of the string in the header display */ -#define PADDING 4 - -#define MIN_ARROW_SIZE 10 - -/* 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; - -static void ethi_request_redraw (ETableHeaderItem *ethi); - - -/* - * 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; - if ( ethi->height < MIN_ARROW_SIZE + 4 + PADDING ) - ethi->height = MIN_ARROW_SIZE + 4 + 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) -{ - /* Check if it's the correct ethi */ - if (ethi->drag_col == -1) - return FALSE; - - gdk_drag_status (context, 0, time); - if (GTK_WIDGET(canvas) == gtk_drag_get_source_widget(context)) { - 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); - gdk_drag_status (context, context->suggested_action, time); - } else { - ethi_remove_drop_marker (ethi); - ethi_add_destroy_marker (ethi); - } - } else { - ethi_remove_drop_marker (ethi); - ethi_add_destroy_marker (ethi); - } - } - - return TRUE; -} - -static void -ethi_drag_end (GtkWidget *canvas, GdkDragContext *context, ETableHeaderItem *ethi) -{ - if (ethi->drag_col == -1) - return; - - if (canvas == gtk_drag_get_source_widget(context)) { - if (context->action == 0) { - ethi_request_redraw (ethi); - e_table_header_remove(ethi->eth, ethi->drag_col); - } - ethi_remove_drop_marker (ethi); - ethi_remove_destroy_marker (ethi); - ethi->drag_col = -1; - } -} - -static gboolean -ethi_drag_drop (GtkWidget *canvas, - GdkDragContext *context, - gint x, - gint y, - guint time, - ETableHeaderItem *ethi) -{ - gboolean successful = FALSE; - - if (ethi->drag_col == -1) - return FALSE; - - if (GTK_WIDGET(canvas) == gtk_drag_get_source_widget(context)) { - 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); - ethi_add_drop_marker(ethi, col); - - if (col != -1) { - if (col != ethi->drag_col) { - ethi_request_redraw (ethi); - e_table_header_move(ethi->eth, ethi->drag_col, col); - } - successful = TRUE; - } - } - } - gtk_drag_finish(context, successful, successful, time); - return successful; -} - -static void -ethi_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, ETableHeaderItem *ethi) -{ - if (ethi->drag_col == -1) - return; - - if (widget == gtk_drag_get_source_widget(context)) { - 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){ - g_warning ("Font had not been set for this ETableHeader"); - ethi_font_load (ethi, "fixed"); - } - - /* - * Now, configure DnD - */ - gtk_drag_dest_set (GTK_WIDGET (item->canvas), 0, - 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); - - ethi->drag_drop_id = gtk_signal_connect ( - GTK_OBJECT (item->canvas), "drag_drop", - GTK_SIGNAL_FUNC (ethi_drag_drop), 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); - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_drop_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 + PADDING / 2; - clip.y = y + PADDING / 2; - clip.width = width - PADDING; - clip.height = ethi->height; - - gdk_gc_set_clip_rectangle (ethi->gc, &clip); - - if ( col->is_pixbuf ) { - xtra = (clip.width - gdk_pixbuf_get_width(col->pixbuf))/2; - - xtra += PADDING / 2; - - gdk_pixbuf_render_to_drawable_alpha(col->pixbuf, - drawable, - 0, 0, - x + xtra, y + (clip.height - gdk_pixbuf_get_height(col->pixbuf)) / 2, - gdk_pixbuf_get_width(col->pixbuf), gdk_pixbuf_get_height(col->pixbuf), - GDK_PIXBUF_ALPHA_FULL, 128, - GDK_RGB_DITHER_NORMAL, - 0, 0); - } else { - /* Center the thing */ - xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2; - - /* Skip over border */ - if (xtra < 0) - xtra = 0; - - xtra += PADDING / 2; - - gdk_draw_text ( - drawable, ethi->font, - ethi->gc, x + xtra, y + ethi->height - ethi->font->descent - PADDING / 2, - col->text, strlen (col->text)); - } - - switch ( e_table_col_get_arrow(col) ) { - case E_TABLE_COL_ARROW_NONE: - break; - case E_TABLE_COL_ARROW_UP: - case E_TABLE_COL_ARROW_DOWN: - gtk_paint_arrow (gtk_widget_get_style(GTK_WIDGET(GNOME_CANVAS_ITEM(ethi)->canvas)), - drawable, - GTK_STATE_NORMAL, - GTK_SHADOW_IN, - &clip, - GTK_WIDGET(GNOME_CANVAS_ITEM(ethi)->canvas), - "header", - e_table_col_get_arrow(col) == E_TABLE_COL_ARROW_UP ? GTK_ARROW_UP : GTK_ARROW_DOWN, - TRUE, - x + PADDING / 2 + clip.width - MIN_ARROW_SIZE - 2, - y + (ethi->height - MIN_ARROW_SIZE) / 2, - MIN_ARROW_SIZE, - MIN_ARROW_SIZE); - break; - } -} - -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; - ETableCol *ecol; - int col_width; - GdkPixmap *pixmap; - GdkGC *gc; - - 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); - - ecol = e_table_header_get_column (ethi->eth, ethi->drag_col); - if (ethi->drag_col == ethi->resize_col) - col_width = ethi->resize_width; - else - col_width = ecol->width; - pixmap = gdk_pixmap_new(widget->window, col_width, ethi->height, -1); - gc = widget->style->bg_gc [GTK_STATE_ACTIVE]; - draw_button (ethi, ecol, pixmap, gc, - widget->style, - 0, 0, col_width, ethi->height); - gtk_drag_set_icon_pixmap (context, - gdk_window_get_colormap(widget->window), - pixmap, - NULL, - col_width / 2, - ethi->height / 2); - gdk_pixmap_unref(pixmap); - - 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) - new_width = 1; - - if (new_width < ethi->resize_min_width) - new_width = ethi->resize_min_width; - 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 156e25beef..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 -#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, drag_drop_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 91aa366932..0000000000 --- a/widgets/e-table/e-table-header.c +++ /dev/null @@ -1,345 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-col-head.c: TableColHead implementation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include -#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) -{ - memmove (ð->columns [pos+1], ð->columns [pos], - sizeof (ETableCol *) * (eth->col_count - pos)); - eth->columns [pos] = val; - eth->col_count ++; -} - -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_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])); - - memmove (ð->columns [idx], ð->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); - - { - if ( start_col < 0 ) - start_col = 0; - if ( end_col > eth->col_count ) - end_col = eth->col_count - 1; - - total = 0; - for (col = start_col; col < end_col; col++){ - - 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 -#include -#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 222d4592cf..0000000000 --- a/widgets/e-table/e-table-item.c +++ /dev/null @@ -1,1368 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include -#include -#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, - RESIZE, - LAST_SIGNAL -}; - -static gint eti_signals [LAST_SIGNAL] = { 0, }; - -enum { - ARG_0, - ARG_TABLE_HEADER, - ARG_TABLE_MODEL, - ARG_TABLE_DRAW_GRID, - ARG_TABLE_DRAW_FOCUS, - ARG_MODE_SPREADSHEET, - ARG_LENGHT_THRESHOLD, - - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS -}; - -static gboolean -eti_editing (ETableItem *eti) -{ - if (eti->editing_col == -1) - return FALSE; - else - return TRUE; -} - -/* - * During realization, we have to invoke the per-ecell realize routine - * (On our current setup, we have one e-cell per column. - * - * We might want to optimize this to only realize the unique e-cells: - * ie, a strings-only table, uses the same e-cell for every column, and - * we might want to avoid realizing each e-cell. - */ -static void -eti_realize_cell_views (ETableItem *eti) -{ - int i; - - for (i = 0; i < eti->n_cells; i++) - e_cell_realize (eti->cell_views [i]); - eti->cell_views_realized = 1; -} - -static void eti_compute_height (ETableItem *eti); - -static void -eti_attach_cell_views (ETableItem *eti) -{ - int i; - - g_assert (eti->header); - g_assert (eti->table_model); - - /* - * Now realize the various ECells - */ - eti->n_cells = eti->cols; - eti->cell_views = g_new (ECellView *, eti->n_cells); - - for (i = 0; i < eti->n_cells; i++){ - ETableCol *col = e_table_header_get_column (eti->header, i); - - eti->cell_views [i] = e_cell_new_view (col->ecell, eti->table_model, eti); - } - - eti_compute_height (eti); -} - -/* - * During unrealization: we invoke every e-cell (one per column in the current - * setup) to dispose all X resources allocated - */ -static void -eti_unrealize_cell_views (ETableItem *eti) -{ - int i; - - if (eti->cell_views_realized == 0) - return; - - for (i = 0; i < eti->n_cells; i++) - e_cell_unrealize (eti->cell_views [i]); - eti->cell_views_realized = 0; -} - -static void -eti_detach_cell_views (ETableItem *eti) -{ - int i; - - for (i = 0; i < eti->n_cells; i++){ - e_cell_kill_view (eti->cell_views [i]); - eti->cell_views [i] = NULL; - } - - g_free (eti->cell_views); - eti->cell_views = NULL; - eti->n_cells = 0; -} - -static void -eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - double i2c [6]; - ArtPoint c1, c2, i1, i2; - ETableItem *eti = E_TABLE_ITEM (item); - - gnome_canvas_item_i2c_affine (item, i2c); - i1.x = eti->x1; - i1.y = eti->y1; - i2.x = eti->x1 + eti->width; - i2.y = eti->y1 + eti->height; - art_affine_point (&c1, &i1, i2c); - art_affine_point (&c2, &i2, i2c); - - item->x1 = c1.x; - item->y1 = c1.y; - item->x2 = c2.x; - item->y2 = c2.y; -} - - -/* - * GnomeCanvasItem::update method - */ -static void -eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags); - - eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2); - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); -} - -/* - * eti_remove_table_model: - * - * Invoked to release the table model associated with this ETableItem - */ -static void -eti_remove_table_model (ETableItem *eti) -{ - if (!eti->table_model) - return; - - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_row_change_id); - gtk_object_unref (GTK_OBJECT (eti->table_model)); - - eti->table_model_change_id = 0; - eti->table_model_row_change_id = 0; - eti->table_model = NULL; -} - -/* - * eti_remove_header_model: - * - * Invoked to release the header model associated with this ETableItem - */ -static void -eti_remove_header_model (ETableItem *eti) -{ - if (!eti->header) - return; - - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_structure_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_dim_change_id); - - if (eti->cell_views){ - eti_unrealize_cell_views (eti); - eti_detach_cell_views (eti); - } - gtk_object_unref (GTK_OBJECT (eti->header)); - - - eti->header_structure_change_id = 0; - eti->header_dim_change_id = 0; - eti->header = NULL; -} - -/* - * eti_row_height: - * - * Returns the height used by row @row. This does not include the one-pixel - * used as a separator between rows - */ -static int -eti_row_height (ETableItem *eti, int row) -{ - const int cols = e_table_header_count (eti->header); - int col; - int h, max_h; - - g_assert (eti->cell_views); - - max_h = 0; - - for (col = 0; col < cols; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - h = e_cell_height (eti->cell_views [col], ecol->col_idx, col, row); - - if (h > max_h) - max_h = h; - } - return max_h; -} - -/* - * eti_get_height: - * - * Returns the height of the ETableItem. - * - * The ETableItem might compute the whole height by asking every row its - * size. There is a special mode (designed to work when there are too - * many rows in the table that performing the previous step could take - * too long) set by the ETableItem->length_threshold that would determine - * when the height is computed by using the first row as the size for - * every other row in the ETableItem. - */ -static int -eti_get_height (ETableItem *eti) -{ - const int rows = eti->rows; - int row; - int height; - - if (rows == 0) - return 0; - - if (eti->length_threshold != -1){ - if (rows > eti->length_threshold){ - height = (eti_row_height (eti, 0) + 1) * rows; - - /* - * 1 pixel at the top - */ - return height + 1; - } - } - - height = 1; - for (row = 0; row < rows; row++) - height += eti_row_height (eti, row) + 1; - - return height; -} - -static void -eti_compute_height (ETableItem *eti) -{ - int new_height = eti_get_height (eti); - - if (new_height != eti->height){ - /* double x1, y1, x2, y2;*/ - printf ("Emitting!\n"); - - eti->height = new_height; - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RESIZE]); - } -} - -/* - * 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->focused_row > eti->rows - 1) { - eti->focused_row = eti->rows - 1; - } - - if (eti->cell_views) - eti_compute_height (eti); - - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_item_region_redraw (eti, 0, 0, eti->width, eti->height); -} - -static void -eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1) -{ - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti); - ArtDRect rect; - double i2c [6]; - - rect.x0 = x0; - rect.y0 = y0; - rect.x1 = x1; - rect.y1 = y1; - - gnome_canvas_item_i2c_affine (item, i2c); - art_drect_affine_transform (&rect, &rect, i2c); - - gnome_canvas_request_redraw (item->canvas, rect.x0, rect.y0, rect.x1, rect.y1); -} - -/* - * eti_request_redraw: - * - * Queues a canvas redraw for the entire ETableItem. - */ -static void -eti_request_redraw (ETableItem *eti) -{ - eti_item_region_redraw (eti, eti->x1, eti->y1, eti->x1 + eti->width + 1, eti->y1 + eti->height + 1); -} - -/* - * Computes the distance between @start_row and @end_row in pixels - */ -static int -eti_row_diff (ETableItem *eti, int start_row, int end_row) -{ - int row, total; - - total = 0; - - for (row = start_row; row < end_row; row++) - total += eti_row_height (eti, row) + 1; - - return total; -} - -/* - * eti_request_region_redraw: - * - * Request a canvas redraw on the range (start_col, start_row) to (end_col, end_row). - * This is inclusive (ie, you can use: 0,0-0,0 to redraw the first cell). - * - * The @border argument is a number of pixels around the region that should also be queued - * for redraw. This is typically used by the focus routines to queue a redraw for the - * border as well. - */ -static void -eti_request_region_redraw (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row, int border) -{ - int x1, y1, width, height; - - x1 = e_table_header_col_diff (eti->header, 0, start_col); - y1 = eti_row_diff (eti, 0, start_row); - width = e_table_header_col_diff (eti->header, start_col, end_col + 1); - height = eti_row_diff (eti, start_row, end_row + 1); - - eti_item_region_redraw (eti, eti->x1 + x1 - border, - eti->y1 + y1 - border, - eti->x1 + x1 + width + 1 + border, - eti->y1 + y1 + height + 1 + border); -} - -static void -eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) -{ - if (eti->renderers_can_change_size){ - eti_table_model_changed (table_model, eti); - return; - } - - eti_request_region_redraw (eti, 0, row, eti->cols, row, 0); -} - -void -e_table_item_redraw_range (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row) -{ - int border; - - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - if ((start_col == eti->focused_col) || - (end_col == eti->focused_col) || - (start_row == eti->focused_row) || - (end_row == eti->focused_row)) - border = 2; - else - border = 0; - - eti_request_region_redraw (eti, start_col, start_row, end_col, end_row, border); -} - -static void -eti_add_table_model (ETableItem *eti, ETableModel *table_model) -{ - g_assert (eti->table_model == NULL); - - eti->table_model = table_model; - gtk_object_ref (GTK_OBJECT (eti->table_model)); - - eti->table_model_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_changed", - GTK_SIGNAL_FUNC (eti_table_model_changed), eti); - - eti->table_model_row_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_row_changed", - GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti); - - if (eti->header){ - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - } - - eti_table_model_changed (table_model, eti); -} - -static void -eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti) -{ - eti_request_redraw (eti); - - eti->width = e_table_header_total_width (eti->header); - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_request_redraw (eti); -} - -static void -eti_header_structure_changed (ETableHeader *eth, ETableItem *eti) -{ - eti_request_redraw (eti); - - eti->cols = e_table_header_count (eti->header); - eti->width = e_table_header_total_width (eti->header); - - /* - * There should be at least one column - */ - g_assert (eti->cols != 0); - - if (eti->cell_views){ - eti_unrealize_cell_views (eti); - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - eti_realize_cell_views (eti); - } else { - if (eti->table_model){ - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - } - } - - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_request_redraw (eti); -} - -static void -eti_add_header_model (ETableItem *eti, ETableHeader *header) -{ - g_assert (eti->header == NULL); - - eti->header = header; - gtk_object_ref (GTK_OBJECT (header)); - - eti_header_structure_changed (header, eti); - - eti->header_dim_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "dimension_change", - GTK_SIGNAL_FUNC (eti_header_dim_changed), eti); - - eti->header_structure_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "structure_change", - GTK_SIGNAL_FUNC (eti_header_structure_changed), eti); -} - -/* - * GtkObject::destroy method - */ -static void -eti_destroy (GtkObject *object) -{ - ETableItem *eti = E_TABLE_ITEM (object); - - eti_remove_header_model (eti); - eti_remove_table_model (eti); - - g_slist_free (eti->selection); - - if (GTK_OBJECT_CLASS (eti_parent_class)->destroy) - (*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object); -} - -static void -eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableItem *eti; - - item = GNOME_CANVAS_ITEM (o); - eti = E_TABLE_ITEM (o); - - switch (arg_id){ - case ARG_TABLE_HEADER: - eti_remove_header_model (eti); - eti_add_header_model (eti, GTK_VALUE_POINTER (*arg)); - break; - - case ARG_TABLE_MODEL: - eti_remove_table_model (eti); - eti_add_table_model (eti, GTK_VALUE_POINTER (*arg)); - break; - - case ARG_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_get_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_WIDTH: - GTK_VALUE_DOUBLE (*arg) = eti->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = eti->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - } -} - -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 = 1; - - eti->selection_mode = GTK_SELECTION_SINGLE; -} - -#define gray50_width 2 -#define gray50_height 2 -static const char gray50_bits[] = { - 0x02, 0x01, }; - -static void -eti_realize (GnomeCanvasItem *item) -{ - ETableItem *eti = E_TABLE_ITEM (item); - GtkWidget *canvas_widget = GTK_WIDGET (item->canvas); - GdkWindow *window; - - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item); - - /* - * Gdk Resource allocation - */ - window = canvas_widget->window; - - eti->fill_gc = canvas_widget->style->white_gc; - gdk_gc_ref (canvas_widget->style->white_gc); - - eti->grid_gc = gdk_gc_new (window); -#if 0 - /* This sets it to gray */ -/* gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); */ -#else - gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->black); -#endif - eti->focus_gc = gdk_gc_new (window); - gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); - gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]); - eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height); - gdk_gc_set_ts_origin (eti->focus_gc, 0, 0); - gdk_gc_set_stipple (eti->focus_gc, eti->stipple); - gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED); - - if (eti->cell_views == NULL) - eti_attach_cell_views (eti); - - eti_realize_cell_views (eti); - - eti_compute_height (eti); - - eti_update (item, NULL, NULL, 0); -} - -static void -eti_unrealize (GnomeCanvasItem *item) -{ - ETableItem *eti = E_TABLE_ITEM (item); - - gdk_gc_unref (eti->fill_gc); - eti->fill_gc = NULL; - gdk_gc_unref (eti->grid_gc); - eti->grid_gc = NULL; - gdk_gc_unref (eti->focus_gc); - eti->focus_gc = NULL; - gdk_bitmap_unref (eti->stipple); - eti->stipple = NULL; - - eti_unrealize_cell_views (eti); - - eti->height = 0; - - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize)(item); -} - -static void -eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) -{ - ETableItem *eti = E_TABLE_ITEM (item); - const int rows = eti->rows; - const int cols = eti->cols; - int row, col, y1, y2; - int first_col, last_col, x_offset; - int first_row, last_row, y_offset, yd; - int x1, x2; - int f_x1, f_x2, f_y1, f_y2; - gboolean f_found; - double i2c [6]; - ArtPoint eti_base, eti_base_item; - - /* - * Clear the background - */ -#if 0 - gdk_draw_rectangle ( - drawable, eti->fill_gc, TRUE, - eti->x1 - x, eti->y1 - y, eti->width, eti->height); -#endif - - /* - * Find out our real position after grouping - */ - gnome_canvas_item_i2c_affine (item, i2c); - eti_base_item.x = eti->x1; - eti_base_item.y = eti->y1; - art_affine_point (&eti_base, &eti_base_item, i2c); - - /* - * First column to draw, last column to draw - */ - first_col = -1; - last_col = x_offset = 0; - x1 = x2 = floor (eti_base.x); - for (col = 0; col < cols; col++, x1 = x2){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - x2 = x1 + ecol->width; - - if (x1 > (x + width)) - break; - if (x2 < x) - continue; - if (first_col == -1){ - x_offset = x1 - x; - first_col = col; - } - } - last_col = col; - - /* - * Nothing to paint - */ - if (first_col == -1) - return; - - /* - * Compute row span. - */ - first_row = -1; - y_offset = 0; - y1 = y2 = floor (eti_base.y) + 1; - for (row = 0; row < rows; row++, y1 = y2){ - - y2 += eti_row_height (eti, row) + 1; - - if (y1 > y + height) - break; - - if (y2 < y) - continue; - - if (first_row == -1){ - y_offset = y1 - y; - first_row = row; - } - } - last_row = row; - - if (first_row == -1) - return; - - /* - * Draw cells - */ - yd = y_offset; - f_x1 = f_x2 = f_y1 = f_y2 = -1; - f_found = FALSE; - - if (eti->draw_grid && first_row == 0){ - gdk_draw_line ( - drawable, eti->grid_gc, - eti_base.x - x, yd, eti_base.x + eti->width - x, yd); - } - yd++; - - for (row = first_row; row < last_row; row++){ - int xd, height; - gboolean selected; - - height = eti_row_height (eti, row); - - xd = x_offset; -/* printf ("paint: %d %d\n", yd, yd + height); */ - - selected = g_slist_find (eti->selection, GINT_TO_POINTER (row)) != NULL; - - for (col = first_col; col < last_col; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - ECellView *ecell_view = eti->cell_views [col]; - - e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, selected, - xd, yd, xd + ecol->width, yd + height); - - if (col == eti->focused_col && row == eti->focused_row){ - f_x1 = xd; - f_x2 = xd + ecol->width; - f_y1 = yd; - f_y2 = yd + height; - f_found = TRUE; - } - - xd += ecol->width; - } - yd += height; - - if (eti->draw_grid) - gdk_draw_line ( - drawable, eti->grid_gc, - eti_base.x - x, yd, eti_base.x + eti->width - x, yd); - yd++; - } - - if (eti->draw_grid){ - int xd = x_offset; - - for (col = first_col; col <= last_col; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - gdk_draw_line ( - drawable, eti->grid_gc, - xd, y_offset, xd, yd - 1); - - /* - * This looks wierd, but it is to draw the last line - */ - if (ecol) - xd += ecol->width; - } - } - - /* - * Draw focus - */ - if (f_found && eti->draw_focus){ - - if (!eti_editing (eti)) - gdk_draw_rectangle ( - drawable, eti->focus_gc, FALSE, - f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1); - } -} - -static double -eti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - *actual_item = item; - - return 0.0; -} - -static gboolean -find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, double *x1_res, double *y1_res) -{ - const int cols = eti->cols; - const int rows = eti->rows; - gdouble x1, y1, x2, y2; - int col, row; - - /* FIXME: this routine is inneficient, fix later */ - - x -= eti->x1; - y -= eti->y1; - - x1 = 0; - for (col = 0; col < cols; col++, x1 = x2){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - if (x < x1) - return FALSE; - - x2 = x1 + ecol->width; - - if (x > x2) - continue; - - *col_res = col; - if (x1_res) - *x1_res = x - x1; - break; - } - - y1 = y2 = 0; - for (row = 0; row < rows; row++, y1 = y2){ - if (y < y1) - return FALSE; - - y2 += eti_row_height (eti, row) + 1; - - if (y > y2) - continue; - - *row_res = row; - if (y1_res) - *y1_res = y - y1; - break; - } - - return TRUE; -} - -static void -eti_cursor_move (ETableItem *eti, gint row, gint column) -{ - e_table_item_leave_edit (eti); - e_table_item_focus (eti, column, row); -} - -static void -eti_cursor_move_left (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row, eti->focused_col - 1); -} - -static void -eti_cursor_move_right (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row, eti->focused_col + 1); -} - -static void -eti_cursor_move_up (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row - 1, eti->focused_col); -} - -static void -eti_cursor_move_down (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row + 1, eti->focused_col); -} - -static int -eti_event (GnomeCanvasItem *item, GdkEvent *e) -{ - ETableItem *eti = E_TABLE_ITEM (item); - ECellView *ecell_view; - ETableCol *ecol; - gint return_val = TRUE; - - 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->motion.x, &e->motion.y); - - if (!find_cell (eti, e->motion.x, e->motion.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->motion.x = x1; - e->motion.y = y1; - - e_cell_event (ecell_view, e, ecol->col_idx, col, row); - } - break; - } - - case GDK_KEY_PRESS: - if (eti->focused_col == -1) - return FALSE; - - switch (e->key.keyval){ - case GDK_Left: - if (!eti->mode_spreadsheet && eti_editing (eti)) - break; - - if (eti->focused_col > 0) - eti_cursor_move_left (eti); - break; - - case GDK_Right: - if (!eti->mode_spreadsheet && eti_editing (eti)) - break; - - if (eti->focused_col < eti->cols - 1) - eti_cursor_move_right (eti); - break; - - case GDK_Up: - if (eti->focused_row > 0) - eti_cursor_move_up (eti); - else - return_val = FALSE; - break; - - case GDK_Down: - if ((eti->focused_row + 1) < eti->rows) - eti_cursor_move_down (eti); - else - return_val = FALSE; - break; - - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: - if ((e->key.state & GDK_SHIFT_MASK) != 0){ - /* shift tab */ - if (eti->focused_col > 0) - eti_cursor_move_left (eti); - else if (eti->focused_row > 0) - eti_cursor_move(eti, eti->focused_row - 1, eti->cols - 1); - else - return_val = FALSE; - } else { - if (eti->focused_col < eti->cols - 1) - eti_cursor_move_right (eti); - else if (eti->focused_row < eti->rows - 1) - eti_cursor_move(eti, eti->focused_row + 1, 0); - else - return_val = FALSE; - } - break; - - default: - if (!eti_editing (eti)){ - if ((e->key.state & (GDK_MOD1_MASK | GDK_CONTROL_MASK)) != 0) - return_val = FALSE; - - if (!(e->key.keyval >= 0x20 && e->key.keyval <= 0xff)) - return_val = FALSE; - } - - 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; - - case GDK_FOCUS_CHANGE: - if (e->focus_change.in) { - } else { - e_table_item_leave_edit (eti); - e_table_item_unfocus (eti); - } - - default: - return_val = FALSE; - } - return return_val; -} - -/* - * 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; - object_class->get_arg = eti_get_arg; - - item_class->update = eti_update; - item_class->realize = eti_realize; - item_class->unrealize = eti_unrealize; - item_class->draw = eti_draw; - item_class->point = eti_point; - item_class->event = eti_event; - item_class->bounds = eti_bounds; - - eti_class->row_selection = eti_row_selection; - - gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_POINTER, - GTK_ARG_WRITABLE, ARG_TABLE_HEADER); - gtk_object_add_arg_type ("ETableItem::ETableModel", GTK_TYPE_POINTER, - GTK_ARG_WRITABLE, ARG_TABLE_MODEL); - gtk_object_add_arg_type ("ETableItem::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); - - gtk_object_add_arg_type ("ETableItem::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableItem::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableItem::has_focus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - - eti_signals [ROW_SELECTION] = - gtk_signal_new ("row_selection", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, row_selection), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - - eti_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL); - -} - -GtkType -e_table_item_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableItem", - sizeof (ETableItem), - sizeof (ETableItemClass), - (GtkClassInitFunc) eti_class_init, - (GtkObjectInitFunc) eti_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_OBJECT_TYPE, &info); - } - - return type; -} - -void -e_table_item_focus (ETableItem *eti, int col, int row) -{ - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - /* - * make sure we have the Gtk Focus - */ - gnome_canvas_item_grab_focus (GNOME_CANVAS_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); -} - -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; -} - -gint -e_table_item_get_focused_column (ETableItem *eti) -{ - g_return_val_if_fail (eti != NULL, -1); - g_return_val_if_fail (E_IS_TABLE_ITEM (eti), -1); - - return eti->focused_col; -} - - -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 635dc76922..0000000000 --- a/widgets/e-table/e-table-item.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef _E_TABLE_ITEM_H_ -#define _E_TABLE_ITEM_H_ - -#include -#include "e-table-model.h" -#include "e-table-header.h" - -#define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) -#define E_TABLE_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem)) -#define E_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ITEM_TYPE, ETableItemClass)) -#define E_IS_TABLE_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_ITEM_TYPE)) -#define E_IS_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ITEM_TYPE)) - -typedef struct { - GnomeCanvasItem parent; - ETableModel *table_model; - ETableHeader *header; - - int x1, y1; - int width, height; - - int cols, rows; - - /* - * Ids for the signals we connect to - */ - int header_dim_change_id; - int header_structure_change_id; - int table_model_change_id; - int table_model_row_change_id; - - GdkGC *fill_gc; - GdkGC *grid_gc; - GdkGC *focus_gc; - GdkBitmap *stipple; - - unsigned int draw_grid:1; - unsigned int draw_focus:1; - unsigned int mode_spreadsheet:1; - unsigned int renderers_can_change_size:1; - unsigned int cell_views_realized:1; - - int focused_col, focused_row; - - /* - * Realized views, per column - */ - ECellView **cell_views; - int n_cells; - - /* - * Lengh Threshold: above this, we stop computing correctly - * the size - */ - int length_threshold; - - GSList *selection; - GtkSelectionMode selection_mode; - - /* - * During edition - */ - int editing_col, editing_row; - void *edit_ctx; -} ETableItem; - -typedef struct { - GnomeCanvasItemClass parent_class; - - void (*row_selection) (ETableItem *eti, int row, gboolean selected); - void (*resize) (ETableItem *eti); -} ETableItemClass; - -GtkType e_table_item_get_type (void); - -/* - * Focus - */ -void e_table_item_focus (ETableItem *eti, int col, int row); -void e_table_item_unfocus (ETableItem *eti); - -gint e_table_item_get_focused_column (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 ef14b98018..0000000000 --- a/widgets/e-table/e-table-model.c +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-model.c: a Table Model - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc. - */ -#include -#include -#include "e-table-model.h" - -#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type(); - - -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); -} - -void * -e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value) -{ - g_return_val_if_fail (e_table_model != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - - if (ETM_CLASS (e_table_model)->duplicate_value) - return ETM_CLASS (e_table_model)->duplicate_value (e_table_model, col, value); - else - return NULL; -} - -void -e_table_model_free_value (ETableModel *e_table_model, int col, void *value) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - if (ETM_CLASS (e_table_model)->free_value) - ETM_CLASS (e_table_model)->free_value (e_table_model, col, value); -} - -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); -} - - -guint -e_table_model_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "ETableModle", - sizeof (ETableModel), - sizeof (ETableModelClass), - (GtkClassInitFunc) e_table_model_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (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); -} - -void -e_table_model_freeze (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = TRUE; - return ETM_CLASS (e_table_model)->thaw (e_table_model); -} - -void -e_table_model_thaw (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = FALSE; - if (ETM_CLASS(e_table_model)->thaw) - ETM_CLASS (e_table_model)->thaw (e_table_model); -} diff --git a/widgets/e-table/e-table-model.h b/widgets/e-table/e-table-model.h deleted file mode 100644 index ceca8e348f..0000000000 --- a/widgets/e-table/e-table-model.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_MODEL_H_ -#define _E_TABLE_MODEL_H_ - -#include - -#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; - - guint frozen : 1; -} 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); - - void *(*duplicate_value) (ETableModel *etm, int col, const void *value); - void (*free_value) (ETableModel *etm, int col, void *value); - - void (*thaw) (ETableModel *etm); - /* - * 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 *value); -gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row); - -void *e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value); -void e_table_model_free_value (ETableModel *e_table_model, int col, void *value); - -void e_table_model_freeze (ETableModel *e_table_model); -void e_table_model_thaw (ETableModel *e_table_model); - -/* - * 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 -#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 - -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 e90abfcc4f..0000000000 --- a/widgets/e-table/e-table-simple.c +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#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 * -simple_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETableSimple *simple = (ETableSimple *)etm; - - return simple->duplicate_value (etm, col, value, simple->data); -} - -static void -simple_free_value (ETableModel *etm, int col, void *value) -{ - ETableSimple *simple = (ETableSimple *)etm; - - simple->free_value (etm, col, value, simple->data); -} - -static void -simple_thaw (ETableModel *etm) -{ - ETableSimple *simple = (ETableSimple *)etm; - - simple->thaw (etm, 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; - model_class->duplicate_value = simple_duplicate_value; - model_class->free_value = simple_free_value; - model_class->thaw = simple_thaw; -} - -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, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleThawFn thaw, - 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; - et->thaw = thaw; - et->duplicate_value = duplicate_value; - et->free_value = free_value; - et->data = data; - - 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 51134f45aa..0000000000 --- a/widgets/e-table/e-table-simple.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#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 void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, const void *val, void *data); -typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data); -typedef void (*ETableSimpleThawFn) (ETableModel *etm, void *data); - -typedef struct { - ETableModel parent; - - ETableSimpleColumnCountFn col_count; - ETableSimpleRowCountFn row_count; - ETableSimpleValueAtFn value_at; - ETableSimpleSetValueAtFn set_value_at; - ETableSimpleIsCellEditableFn is_cell_editable; - ETableSimpleDuplicateValueFn duplicate_value; - ETableSimpleFreeValueFn free_value; - ETableSimpleThawFn thaw; - 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, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleThawFn thaw, - void *data); - -#endif /* _E_TABLE_SIMPLE_H_ */ - diff --git a/widgets/e-table/e-table-sorted-variable.c b/widgets/e-table/e-table-sorted-variable.c deleted file mode 100644 index 478038fdb7..0000000000 --- a/widgets/e-table/e-table-sorted-variable.c +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-sorted.c: Implements a table that sorts another table - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc. - */ -#include -#include -#include -#include -#include "e-util/e-util.h" -#include "e-table-sorted-variable.h" - -#define PARENT_TYPE E_TABLE_SUBSET_VARIABLE_TYPE - -#define INCREMENT_AMOUNT 10 - -static ETableSubsetVariableClass *etsv_parent_class; - -static void etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv); -static void etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv); -static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedVariable *etsv); -static void etsv_add (ETableSubsetVariable *etssv, gint row); - -static void -etsv_destroy (GtkObject *object) -{ - ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object); - ETableSubset *etss = E_TABLE_SUBSET (object); - - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_cell_changed_id); - - etsv->table_model_changed_id = 0; - etsv->table_model_row_changed_id = 0; - etsv->table_model_cell_changed_id = 0; - - GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); -} - -static void -etsv_class_init (GtkObjectClass *object_class) -{ - ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - - etsv_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = etsv_destroy; - - etssv_class->add = etsv_add; -} - -E_MAKE_TYPE(e_table_sorted_variable, "ETableSortedVariable", ETableSortedVariable, etsv_class_init, NULL, PARENT_TYPE); - -static void -etsv_add (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE(etssv); - int i; - int col = etsv->sort_col; - GCompareFunc comp = etsv->compare; - gint ascending = etsv->ascending; - - void *val = e_table_model_value_at(etss->source, col, row); - - /* FIXME: binary search anyone? */ - for ( i = 0; i < etss->n_map; i++ ) { - int comp_val = (*comp)(val, e_table_model_value_at(etss->source, col, etss->map_table[i])); - if ( (ascending && comp_val < 0) || ((!ascending) && comp_val > 0) ) - break; - } - if ( etss->n_map + 1 > etssv->n_vals_allocated ) { - etss->map_table = g_realloc(etss->map_table, (etssv->n_vals_allocated + INCREMENT_AMOUNT) * sizeof(int)); - etssv->n_vals_allocated += INCREMENT_AMOUNT; - } - if ( i < etss->n_map ) - memmove(etss->map_table + i + 1, etss->map_table + i, (etss->n_map - i) * sizeof(int)); - etss->map_table[i] = row; - etss->n_map++; - if ( !etm->frozen ) - e_table_model_changed(etm); -} - -ETableModel * -e_table_sorted_variable_new (ETableModel *source, int col, int ascending, GCompareFunc compare) -{ - ETableSortedVariable *etsv = gtk_type_new (E_TABLE_SORTED_VARIABLE_TYPE); - ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE (etsv); - - if (e_table_subset_variable_construct (etssv, source) == NULL){ - gtk_object_destroy (GTK_OBJECT (etsv)); - return NULL; - } - - etsv->sort_col = col; - etsv->ascending = ascending; - etsv->compare = compare; - - etsv->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_changed), etsv); - etsv->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_row_changed), etsv); - etsv->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_cell_changed), etsv); - - return E_TABLE_MODEL(etsv); -} - -static void -etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv) -{ - if ( !E_TABLE_MODEL(etsv)->frozen ) { - /* FIXME: do_resort(); */ - } -} - -static void -etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv) -{ - ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if ( !E_TABLE_MODEL(etsv)->frozen ) { - if(e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add(etssv, row); - } -} - -static void -etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedVariable *etsv) -{ - ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if ( !E_TABLE_MODEL(etsv)->frozen ) { - if ( col == etsv->sort_col ) { - if(e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add(etssv, row); - } - } -} - diff --git a/widgets/e-table/e-table-sorted-variable.h b/widgets/e-table/e-table-sorted-variable.h deleted file mode 100644 index cf188acd4a..0000000000 --- a/widgets/e-table/e-table-sorted-variable.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SORTED_VARIABLE_H_ -#define _E_TABLE_SORTED_VARIABLE_H_ - -#include -#include "e-table-model.h" -#include "e-table-subset-variable.h" - -#define E_TABLE_SORTED_VARIABLE_TYPE (e_table_sorted_variable_get_type ()) -#define E_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariable)) -#define E_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) -#define E_IS_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTED_VARIABLE_TYPE)) -#define E_IS_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_VARIABLE_TYPE)) - -typedef struct { - ETableSubsetVariable base; - - short sort_col; - int ascending; - GCompareFunc compare; - - int table_model_changed_id; - int table_model_row_changed_id; - int table_model_cell_changed_id; -} ETableSortedVariable; - -typedef struct { - ETableSubsetVariableClass parent_class; -} ETableSortedVariableClass; - -GtkType e_table_sorted_variable_get_type (void); -ETableModel *e_table_sorted_variable_new (ETableModel *etm, int col, int ascending, GCompareFunc compare); - -#endif /* _E_TABLE_SORTED_VARIABLE_H_ */ diff --git a/widgets/e-table/e-table-sorted.c b/widgets/e-table/e-table-sorted.c deleted file mode 100644 index c754f4cff7..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 -#include -#include "e-util/e-util.h" -#include "e-table-sorted.h" - -#define PARENT_TYPE E_TABLE_SUBSET_TYPE - -static ETableSubsetClass *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 92bd8d1522..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 -#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 { - ETableSubsetClass 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-variable.c b/widgets/e-table/e-table-subset-variable.c deleted file mode 100644 index 5a3e0f2ddf..0000000000 --- a/widgets/e-table/e-table-subset-variable.c +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include -#include "e-util/e-util.h" -#include "e-table-subset-variable.h" - -#define ETSSV_CLASS(e) ((ETableSubsetVariableClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE E_TABLE_SUBSET_TYPE - -#define INCREMENT_AMOUNT 10 - -static ETableSubsetClass *etssv_parent_class; - -static void -etssv_add (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - - if ( etss->n_map + 1 > etssv->n_vals_allocated ) { - etss->map_table = g_realloc(etss->map_table, (etssv->n_vals_allocated + INCREMENT_AMOUNT) * sizeof(int)); - etssv->n_vals_allocated += INCREMENT_AMOUNT; - } - etss->map_table[etss->n_map++] = row; - if ( !etm->frozen ) - e_table_model_changed(etm); -} - -static gboolean -etssv_remove (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - int i; - - for ( i = 0; i < etss->n_map; i++ ) { - if (etss->map_table[i] == row) { - memmove(etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int)); - etss->n_map --; - if ( !etm->frozen ) - e_table_model_changed(etm); - return TRUE; - } - } - return FALSE; -} - -static void -etssv_class_init (GtkObjectClass *object_class) -{ - ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - etssv_parent_class = gtk_type_class (PARENT_TYPE); - - klass->add = etssv_add; - klass->remove = etssv_remove; -} - -E_MAKE_TYPE(e_table_subset_variable, "ETableSubsetVariable", ETableSubsetVariable, etssv_class_init, NULL, PARENT_TYPE); - -ETableModel * -e_table_subset_variable_construct (ETableSubsetVariable *etssv, - ETableModel *source) -{ - if ( e_table_subset_construct(E_TABLE_SUBSET(etssv), source, 1) == NULL ) - return NULL; - E_TABLE_SUBSET(etssv)->n_map = 0; - - return E_TABLE_MODEL (etssv); -} - -ETableModel * -e_table_subset_variable_new (ETableModel *source) -{ - ETableSubsetVariable *etssv = gtk_type_new (E_TABLE_SUBSET_VARIABLE_TYPE); - - if (e_table_subset_variable_construct (etssv, source) == NULL){ - gtk_object_destroy (GTK_OBJECT (etssv)); - return NULL; - } - - return (ETableModel *) etssv; -} - -void -e_table_subset_variable_add (ETableSubsetVariable *etssv, - gint row) -{ - g_return_if_fail (etssv != NULL); - g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv)); - - if (ETSSV_CLASS(etssv)->add) - ETSSV_CLASS (etssv)->add (etssv, row); -} - -gboolean -e_table_subset_variable_remove (ETableSubsetVariable *etssv, - gint row) -{ - g_return_val_if_fail (etssv != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv), FALSE); - - if (ETSSV_CLASS(etssv)->remove) - return ETSSV_CLASS (etssv)->remove (etssv, row); - else - return FALSE; -} - -void -e_table_subset_variable_increment (ETableSubsetVariable *etssv, - gint position, - gint amount) -{ - int i; - ETableSubset *etss = E_TABLE_SUBSET(etssv); - for ( i = 0; i < etss->n_map; i++ ) { - if ( etss->map_table[i] > position ) - etss->map_table[i] += amount; - } -} - -void -e_table_subset_variable_set_allocation (ETableSubsetVariable *etssv, - gint total) -{ - ETableSubset *etss = E_TABLE_SUBSET(etssv); - if ( total <= 0 ) - total = 1; - if ( total > etss->n_map ) { - etss->map_table = g_realloc(etss->map_table, total * sizeof(int)); - } -} diff --git a/widgets/e-table/e-table-subset-variable.h b/widgets/e-table/e-table-subset-variable.h deleted file mode 100644 index 8ac0af0382..0000000000 --- a/widgets/e-table/e-table-subset-variable.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SUBSET_VARIABLE_H_ -#define _E_TABLE_SUBSET_VARIABLE_H_ - -#include -#include "e-table-subset.h" - -#define E_TABLE_SUBSET_VARIABLE_TYPE (e_table_subset_variable_get_type ()) -#define E_TABLE_SUBSET_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariable)) -#define E_TABLE_SUBSET_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariableClass)) -#define E_IS_TABLE_SUBSET_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SUBSET_VARIABLE_TYPE)) -#define E_IS_TABLE_SUBSET_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_VARIABLE_TYPE)) - -typedef struct { - ETableSubset base; - - int n_vals_allocated; -} ETableSubsetVariable; - -typedef struct { - ETableSubsetClass parent_class; - - void (*add) (ETableSubsetVariable *ets, - gint row); - gboolean (*remove) (ETableSubsetVariable *ets, - gint row); -} ETableSubsetVariableClass; - -GtkType e_table_subset_variable_get_type (void); -ETableModel *e_table_subset_variable_new (ETableModel *etm); -ETableModel *e_table_subset_variable_construct (ETableSubsetVariable *etssv, - ETableModel *source); -void e_table_subset_variable_add (ETableSubsetVariable *ets, - gint row); -gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets, - gint row); -void e_table_subset_variable_increment (ETableSubsetVariable *ets, - gint position, - gint amount); -void e_table_subset_variable_set_allocation (ETableSubsetVariable *ets, - gint total); -#endif /* _E_TABLE_SUBSET_VARIABLE_H_ */ - diff --git a/widgets/e-table/e-table-subset.c b/widgets/e-table/e-table-subset.c deleted file mode 100644 index b4473b87ef..0000000000 --- a/widgets/e-table/e-table-subset.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include "e-util/e-util.h" -#include "e-table-subset.h" - -#define PARENT_TYPE E_TABLE_MODEL_TYPE - -static ETableModelClass *etss_parent_class; - -static void -etss_destroy (GtkObject *object) -{ - ETableSubset *etss = E_TABLE_SUBSET (object); - - if (etss->source) - gtk_object_unref (GTK_OBJECT (etss->source)); - - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_cell_changed_id); - - etss->table_model_changed_id = 0; - etss->table_model_row_changed_id = 0; - etss->table_model_cell_changed_id = 0; - - 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_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_duplicate_value (etss->source, col, value); -} - -static void -etss_free_value (ETableModel *etm, int col, void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - e_table_model_free_value (etss->source, col, value); -} - -static void -etss_thaw (ETableModel *etm) -{ - e_table_model_changed (etm); -} - -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; - table_class->duplicate_value = etss_duplicate_value; - table_class->free_value = etss_free_value; - table_class->thaw = etss_thaw; -} - -E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE); - -static void -etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss) -{ - if ( !E_TABLE_MODEL(etss)->frozen ) - e_table_model_changed (E_TABLE_MODEL (etss)); -} - -static void -etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) -{ - if ( !E_TABLE_MODEL(etss)->frozen ) { - 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) -{ - if ( !E_TABLE_MODEL(etss)->frozen ) { - 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 *) g_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; - - etss->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (etss_proxy_model_changed), etss); - etss->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", - GTK_SIGNAL_FUNC (etss_proxy_model_row_changed), etss); - etss->table_model_cell_changed_id = 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 074120a410..0000000000 --- a/widgets/e-table/e-table-subset.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SUBSET_H_ -#define _E_TABLE_SUBSET_H_ - -#include -#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; - - int table_model_changed_id; - int table_model_row_changed_id; - int table_model_cell_changed_id; -} 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 e508e24e02..0000000000 --- a/widgets/e-table/e-table.c +++ /dev/null @@ -1,723 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table.c: A graphical view of a Table. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright 1999, Helix Code, Inc - */ -#include -#include -#include -#include -#ifdef HAVE_ALLOCA_H -#include -#endif -#include -#include -#include -#include -#include "e-util/e-util.h" -#include "e-util/e-xml-utils.h" -#include "e-table.h" -#include "e-table-header-item.h" -#include "e-table-subset.h" -#include "e-table-item.h" -#include "e-table-group.h" - -#define COLUMN_HEADER_HEIGHT 16 -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define PARENT_TYPE gtk_table_get_type () - -static GtkObjectClass *e_table_parent_class; - -static void e_table_fill_table (ETable *e_table, ETableModel *model); - -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)); - gtk_widget_destroy (GTK_WIDGET (et->header_canvas)); - gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); - - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_model_change_id); - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_row_change_id); - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_cell_change_id); - - if (et->rebuild_idle_id) { - g_source_remove(et->rebuild_idle_id); - et->rebuild_idle_id = 0; - } - - (*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; - - e_table->need_rebuild = 0; - e_table->need_row_changes = 0; - e_table->row_changes_list = NULL; - e_table->rebuild_idle_id = 0; -} - -static ETableHeader * -e_table_make_header (ETable *e_table, ETableHeader *full_header, xmlNode *xmlColumns) -{ - ETableHeader *nh; - xmlNode *column; - const int max_cols = e_table_header_count (full_header); - - nh = e_table_header_new (); - for (column = xmlColumns->childs; column; column = column->next) { - int col = atoi (column->childs->content); - - 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); - -} - -#if 0 -typedef struct { - void *value; - GArray *array; -} group_key_t; - -static GArray * -e_table_create_groups (ETableModel *etm, int key_col, GCompareFunc comp) -{ - GArray *groups; - const int rows = e_table_model_row_count (etm); - int row, i; - - groups = g_array_new (FALSE, FALSE, sizeof (group_key_t)); - - for (row = 0; row < rows; row++){ - void *val = e_table_model_value_at (etm, key_col, row); - const int n_groups = groups->len; - - /* - * Should replace this with a bsearch later - */ - for (i = 0; i < n_groups; i++){ - group_key_t *g = &g_array_index (groups, group_key_t, i); - - if ((*comp) (g->value, val)){ - g_array_append_val (g->array, row); - break; - } - } - if (i != n_groups) - continue; - - /* - * We need to create a new group - */ - { - group_key_t gk; - - gk.value = val; - gk.array = g_array_new (FALSE, FALSE, sizeof (int)); - - g_array_append_val (gk.array, row); - g_array_append_val (groups, gk); - } - } - - return groups; -} - -static void -e_table_destroy_groups (GArray *groups) -{ - const int n = groups->len; - int i; - - for (i = 0; i < n; i++){ - group_key_t *g = &g_array_index (groups, group_key_t, i); - - g_array_free (g->array, TRUE); - } - g_array_free (groups, TRUE); -} - -static ETableModel ** -e_table_make_subtables (ETableModel *model, GArray *groups) -{ - const int n_groups = groups->len; - ETableModel **tables; - int i; - - tables = g_new (ETableModel *, n_groups+1); - - for (i = 0; i < n_groups; i++){ - group_key_t *g = &g_array_index (groups, group_key_t, i); - const int sub_size = g->array->len; - ETableSubset *ss; - int j; - - tables [i] = e_table_subset_new (model, sub_size); - ss = E_TABLE_SUBSET (tables [i]); - - for (j = 0; j < sub_size; j++) - ss->map_table [j] = g_array_index (g->array, int, j); - } - tables [i] = NULL; - - return (ETableModel **) tables; -} -#endif -typedef struct _Node Node; - -struct _Node { - Node *parent; - GnomeCanvasItem *item; - ETableModel *table_model; - GSList *children; - - guint is_leaf:1; -}; -#if 0 -static Node * -leaf_new (GnomeCanvasItem *table_item, ETableModel *table_model, Node *parent) -{ - Node *node = g_new (Node, 1); - - g_assert (table_item != NULL); - g_assert (table_model != NULL); - g_assert (parent != NULL); - - node->item = table_item; - node->parent = parent; - node->table_model = table_model; - node->is_leaf = 1; - - g_assert (!parent->is_leaf); - - parent->children = g_slist_append (parent->children, node); - - e_table_group_add (E_TABLE_GROUP (parent->item), table_item); - - return node; -} - -static Node * -node_new (GnomeCanvasItem *group_item, ETableModel *table_model, Node *parent) -{ - Node *node = g_new (Node, 1); - - g_assert (table_model != NULL); - - node->children = NULL; - node->item = group_item; - node->parent = parent; - node->table_model = table_model; - node->is_leaf = 0; - - if (parent){ - parent->children = g_slist_append (parent->children, node); - - e_table_group_add (E_TABLE_GROUP (parent->item), group_item); - } - - return node; -} - -static Node * -e_table_create_leaf (ETable *e_table, ETableModel *etm, Node *parent) -{ - GnomeCanvasItem *table_item; - Node *leaf; - - table_item = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (parent->item), - e_table_item_get_type (), - "ETableHeader", e_table->header, - "ETableModel", etm, - "drawgrid", e_table->draw_grid, - "drawfocus", e_table->draw_focus, - "spreadsheet", e_table->spreadsheet, - NULL); - - leaf = leaf_new (table_item, etm, parent); - - return leaf; -} - -static int -leaf_height (Node *leaf) -{ - const GnomeCanvasItem *item = leaf->item; - - return item->y2 - item->y1; -} - -static int -leaf_event (GnomeCanvasItem *item, GdkEvent *event) -{ - static int last_x = -1; - static int last_y = -1; - - if (event->type == GDK_BUTTON_PRESS){ - last_x = event->button.x; - last_y = event->button.y; - } else if (event->type == GDK_BUTTON_RELEASE){ - last_x = -1; - last_y = -1; - } else if (event->type == GDK_MOTION_NOTIFY){ - if (last_x == -1) - return FALSE; - - gnome_canvas_item_move (item, event->motion.x - last_x, event->motion.y - last_y); - last_x = event->motion.x; - last_y = event->motion.y; - } else - return FALSE; - return TRUE; -} - -static Node * -e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header, - GnomeCanvasGroup *root, Node *parent, int *groups_list) -{ - GArray *groups; - ETableModel **tables; - ETableCol *ecol; - int key_col, i; - GnomeCanvasItem *group_item; - Node *group; - - key_col = *groups_list; - g_assert (key_col != -1); - - /* - * Create groups - */ - ecol = e_table_header_get_column (header, key_col); - - g_assert (ecol != NULL); - - groups = e_table_create_groups (model, key_col, ecol->compare); - tables = e_table_make_subtables (e_table->model, groups); - e_table_destroy_groups (groups); - group_item = gnome_canvas_item_new (root, - e_table_group_get_type(), - "columns", ecol, TRUE, parent == NULL); - group = node_new (group_item, model, parent); - - for (i = 0; tables [i] != NULL; i++){ - /* - * Leafs - */ - if (groups_list [1] == -1){ - GnomeCanvasItem *item_leaf_header; - Node *leaf_header; - - /* FIXME *//* - item_leaf_header = e_table_group_new ( - GNOME_CANVAS_GROUP (group_item), ecol, TRUE, FALSE);*/ - leaf_header = node_new (item_leaf_header, tables [i], group); - - e_table_create_leaf (e_table, tables [i], leaf_header); - } else { - e_table_create_nodes ( - e_table, tables [i], header, GNOME_CANVAS_GROUP (group_item), - group, &groups_list [1]); - } - } - - return group; -} - -static int * -group_spec_to_desc (const char *group_spec) -{ - int a_size = 10; - int *elements; - char *p, *copy, *follow; - int n_elements = 0; - - if (group_spec == NULL) - return NULL; - - elements = g_new (int, a_size); - copy = alloca (strlen (group_spec) + 1); - strcpy (copy, group_spec); - - while ((p = strtok_r (copy, ",", &follow)) != NULL){ - elements [n_elements] = atoi (p); - ++n_elements; - if (n_elements+1 == a_size){ - int *new_e; - - n_elements += 10; - new_e = g_renew (int, elements, n_elements); - if (new_e == NULL){ - g_free (elements); - return NULL; - } - elements = new_e; - } - copy = NULL; - } - - /* Tag end */ - elements [n_elements] = -1; - - return elements; -} - -/* - * The ETableCanvas object is just used to enable us to - * hook up to the realize/unrealize phases of the canvas - * initialization (as laying out the subtables requires us to - * know the actual size of the subtables we are inserting - */ - -#define E_TABLE_CANVAS_PARENT_TYPE gnome_canvas_get_type () - -typedef struct { - GnomeCanvas base; - - ETable *e_table; -} ETableCanvas; - -typedef struct { - GnomeCanvasClass base_class; -} ETableCanvasClass; - -static GnomeCanvasClass *e_table_canvas_parent_class; - -static void -e_table_canvas_realize (GtkWidget *widget) -{ -#if 0 - GnomeCanvasItem *group_item; - - group_item = gnome_canvas_item_new (root, - e_table_group_get_type(), - "header", E_TABLE, TRUE, parent == NULL); - - - ETableCanvas *e_table_canvas = (ETableCanvas *) widget; - ETable *e_table = e_table_canvas->e_table; - int *groups; - Node *leaf; - - GTK_WIDGET_CLASS (e_table_canvas_parent_class)->realize (widget); - - groups = group_spec_to_desc (e_table->group_spec); - - - - leaf = e_table_create_nodes ( - e_table, e_table->model, - e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups); - - - if (groups) - g_free (groups); -#endif -} - -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)); - - GTK_WIDGET_CLASS (e_table_canvas_parent_class)->unrealize (widget); -} - -static void -e_table_canvas_class_init (GtkObjectClass *object_class) -{ - GtkWidgetClass *widget_class = (GtkWidgetClass *) object_class; - - widget_class->realize = e_table_canvas_realize; - widget_class->unrealize = e_table_canvas_unrealize; - - e_table_canvas_parent_class = gtk_type_class (E_TABLE_CANVAS_PARENT_TYPE); -} - -static void -e_table_canvas_init (GtkObject *canvas) -{ - ETableCanvas *e_table_canvas = (ETableCanvas *) (canvas); - ETable *e_table = e_table_canvas->e_table; - - GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS); - -} - -GtkType e_table_canvas_get_type (void); - -E_MAKE_TYPE (e_table_canvas, "ETableCanvas", ETableCanvas, e_table_canvas_class_init, - e_table_canvas_init, E_TABLE_CANVAS_PARENT_TYPE); - -static GnomeCanvas * -e_table_canvas_new (ETable *e_table) -{ - ETableCanvas *e_table_canvas; - - e_table_canvas = gtk_type_new (e_table_canvas_get_type ()); - e_table_canvas->e_table = e_table; - - e_table->root = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (GNOME_CANVAS (e_table_canvas)->root), - gnome_canvas_group_get_type (), - "x", 0.0, - "y", 0.0, - NULL); - - return GNOME_CANVAS (e_table_canvas); -} -#endif - -static void -table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) -{ - gdouble height; - gdouble width; - gtk_object_get(GTK_OBJECT(e_table->group), - "height", &height, - NULL); - gnome_canvas_set_scroll_region ( - GNOME_CANVAS (e_table->table_canvas), - 0, 0, alloc->width, MAX(height, alloc->height)); - width = alloc->width; - gtk_object_set(GTK_OBJECT(e_table->group), - "width", width, - NULL); -} - -static void -change_row (gpointer key, gpointer value, gpointer data) -{ - ETable *et = E_TABLE(data); - gint row = GPOINTER_TO_INT(key); - if ( e_table_group_remove(et->group, row) ) { - e_table_group_add(et->group, row); - } -} - -static gboolean -changed_idle (gpointer data) -{ - ETable *et = E_TABLE(data); - if ( et->need_rebuild ) { - gtk_object_destroy( GTK_OBJECT(et->group ) ); - et->group = e_table_group_new(GNOME_CANVAS_GROUP(et->table_canvas->root), - et->full_header, - et->header, - et->model, - e_xml_get_child_by_name(xmlDocGetRootElement(et->specification), "grouping")->childs); - e_table_fill_table(et, et->model); - } else if (et->need_row_changes) { - g_hash_table_foreach(et->row_changes_list, change_row, et); - } - et->need_rebuild = 0; - et->need_row_changes = 0; - if (et->row_changes_list) - g_hash_table_destroy(et->row_changes_list); - et->row_changes_list = NULL; - et->rebuild_idle_id = 0; - return FALSE; -} - -static void -et_table_model_changed (ETableModel *model, ETable *et) -{ - et->need_rebuild = TRUE; - if ( !et->rebuild_idle_id ) { - et->rebuild_idle_id = g_idle_add(changed_idle, et); - } -} - -static void -et_table_row_changed (ETableModel *table_model, int row, ETable *et) -{ - if ( !et->need_rebuild ) { - if (!et->need_row_changes) { - et->need_row_changes = 1; - et->row_changes_list = g_hash_table_new (g_direct_hash, g_direct_equal); - } - if (!g_hash_table_lookup(et->row_changes_list, GINT_TO_POINTER(row))) { - g_hash_table_insert(et->row_changes_list, GINT_TO_POINTER(row), GINT_TO_POINTER(row + 1)); - } - } - if ( !et->rebuild_idle_id ) { - et->rebuild_idle_id = g_idle_add(changed_idle, et); - } -} - -static void -et_table_cell_changed (ETableModel *table_model, int view_col, int row, ETable *et) -{ - et_table_row_changed(table_model, row, et); -} - -static void -e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header, ETableModel *model, xmlNode *xml_grouping) -{ - e_table->table_canvas = GNOME_CANVAS(gnome_canvas_new ()); - gtk_signal_connect ( - GTK_OBJECT (e_table->table_canvas), "size_allocate", - GTK_SIGNAL_FUNC (table_canvas_size_allocate), 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); - - e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root), - full_header, - header, - model, - xml_grouping->childs); - - e_table->table_model_change_id = gtk_signal_connect ( - GTK_OBJECT (model), "model_changed", - GTK_SIGNAL_FUNC (et_table_model_changed), e_table); - - e_table->table_row_change_id = gtk_signal_connect ( - GTK_OBJECT (model), "model_row_changed", - GTK_SIGNAL_FUNC (et_table_row_changed), e_table); - - e_table->table_cell_change_id = gtk_signal_connect ( - GTK_OBJECT (model), "model_cell_changed", - GTK_SIGNAL_FUNC (et_table_cell_changed), e_table); -} - -static void -e_table_fill_table (ETable *e_table, ETableModel *model) -{ - int count; - int i; - count = e_table_model_row_count(model); - gtk_object_set(GTK_OBJECT(e_table->group), - "frozen", TRUE, - NULL); - for ( i = 0; i < count; i++ ) { - e_table_group_add(e_table->group, i); - } - gtk_object_set(GTK_OBJECT(e_table->group), - "frozen", FALSE, - NULL); -} - -void -e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, - const char *spec) -{ - xmlDoc *xmlSpec; - xmlNode *xmlRoot; - xmlNode *xmlColumns; - xmlNode *xmlGrouping; - - char *copy; - copy = g_strdup(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)); - - xmlSpec = xmlParseMemory(copy, strlen(copy) + 1); - e_table->specification = xmlSpec; - - xmlRoot = xmlDocGetRootElement(xmlSpec); - xmlColumns = e_xml_get_child_by_name(xmlRoot, "columns-shown"); - xmlGrouping = e_xml_get_child_by_name(xmlRoot, "grouping"); - - e_table->header = e_table_make_header (e_table, full_header, xmlColumns); - - e_table_setup_header (e_table); - e_table_setup_table (e_table, full_header, e_table->header, etm, xmlGrouping); - e_table_fill_table (e_table, etm); -} - -GtkWidget * -e_table_new (ETableHeader *full_header, ETableModel *etm, const char *spec) -{ - ETable *e_table; - - e_table = gtk_type_new (e_table_get_type ()); - - e_table_construct (e_table, full_header, etm, 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 841013c09a..0000000000 --- a/widgets/e-table/e-table.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_H_ -#define _E_TABLE_H_ - -#include -#include -#include -#include "e-table-model.h" -#include "e-table-header.h" -#include "e-table-group.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; - - ETableGroup *group; - - int table_model_change_id; - int table_row_change_id; - int table_cell_change_id; - - GnomeCanvas *header_canvas, *table_canvas; - - GnomeCanvasItem *header_item, *root; - - xmlDoc *specification; - - guint draw_grid:1; - guint draw_focus:1; - guint spreadsheet:1; - - guint need_rebuild:1; - guint need_row_changes:1; - - GHashTable *row_changes_list; - gint rebuild_idle_id; -} 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 *spec); -GtkWidget *e_table_new (ETableHeader *full_header, ETableModel *etm, - const char *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 Binary files a/widgets/e-table/image1.png and /dev/null differ diff --git a/widgets/e-table/image2.png b/widgets/e-table/image2.png deleted file mode 100644 index e6a4c75dbe..0000000000 Binary files a/widgets/e-table/image2.png and /dev/null differ diff --git a/widgets/e-table/image3.png b/widgets/e-table/image3.png deleted file mode 100644 index 50e16e8620..0000000000 Binary files a/widgets/e-table/image3.png and /dev/null 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 62160e7035..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 -#include -#include -#include -#include -#include "e-util/e-cursors.h" -#include "table-test.h" - -int -main (int argc, char *argv []) -{ - - if (isatty (0)){ - int fd; - - close (0); - fd = open ("sample.table", O_RDONLY); - if (fd == -1){ - fprintf (stderr, "Could not find sample.table, try feeding a table on stdin"); - exit (1); - } - dup2 (fd, 0); - } - - gnome_init ("TableTest", "TableTest", argc, argv); - e_cursors_init (); - - - table_browser_test (); - multi_cols_test (); - check_test (); - - e_table_test (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} diff --git a/widgets/e-table/table-test.h b/widgets/e-table/table-test.h deleted file mode 100644 index ad8cfcc083..0000000000 --- a/widgets/e-table/table-test.h +++ /dev/null @@ -1,4 +0,0 @@ -void table_browser_test (void); -void multi_cols_test (void); -void check_test (void); -void e_table_test (void); diff --git a/widgets/e-table/test-check.c b/widgets/e-table/test-check.c deleted file mode 100644 index 7894898255..0000000000 --- a/widgets/e-table/test-check.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include -#include -#include -#include -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-util/e-cursors.h" -#include "e-util/e-canvas-utils.h" -#include "e-util/e-util.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 * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0){ - return (void *) value; - } else { - return g_strdup(value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0){ - g_free(value); - } -} - -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed(etc); -} - -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; - GdkPixbuf *pixbuf; - GnomeCanvasItem *item; - - 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, - duplicate_value, free_value, thaw, NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - cell_image_check = e_cell_checkbox_new (); - pixbuf = gdk_pixbuf_new_from_file("clip.png"); - col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 18, 18, cell_image_check, g_int_compare, TRUE); - gdk_pixbuf_unref(pixbuf); - 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_compare, TRUE); - e_table_header_add_column (e_table_header, col_1, 1); - e_table_col_set_arrow ( col_1, E_TABLE_COL_ARROW_DOWN ); - - /* - * 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); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); - e_canvas_item_move_absolute(item, 0, 30); -} - diff --git a/widgets/e-table/test-cols.c b/widgets/e-table/test-cols.c deleted file mode 100644 index d65b9945b7..0000000000 --- a/widgets/e-table/test-cols.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include -#include -#include -#include -#include "e-util/e-canvas-utils.h" -#include "e-util/e-cursors.h" -#include "e-util/e-util.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-cell-toggle.h" - -#include "table-test.h" - -#define LINES 4 - -static struct { - int value; - char *string; -} my_table [LINES] = { - { 0, "You are not" }, - { 1, "A beautiful and unique " }, - { 0, "Snowflake" }, - { 2, "You are not your wallet" }, -}; -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return 2; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return LINES; -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) - return GINT_TO_POINTER (my_table [row].value); - else - return my_table [row].string; - -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0){ - my_table [row].value = GPOINTER_TO_INT (val); - printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val)); - } else { - my_table [row].string = g_strdup (val); - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); - } -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0){ - return (void *)value; - } else { - return g_strdup(value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0){ - g_free(value); - } -} - -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed(etc); -} - -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; - GnomeCanvasItem *item; - - 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, - duplicate_value, free_value, - thaw, NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - { - 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_compare, 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_compare, 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); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); - - e_canvas_item_move_absolute(item, 0, 30); - - 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); - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header_multiple, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); - e_canvas_item_move_absolute(item, 300, 30); -} - - - - - diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c deleted file mode 100644 index 0fdf32fcbe..0000000000 --- a/widgets/e-table/test-table.c +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include -#include -#include -#include -#include "e-util/e-cursors.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-table.h" - -#include "table-test.h" - -char buffer [1024]; -char **column_labels; -char ***table_data; -int cols = 0; -int lines = 0; -int lines_alloc = 0; - -static void -parse_headers () -{ - char *p, *s; - int in_value = 0, i; - - fgets (buffer, sizeof (buffer)-1, stdin); - - for (p = buffer; *p; p++){ - if (*p == ' ' || *p == '\t'){ - if (in_value){ - cols++; - in_value = 0; - } - } else - in_value = 1; - } - if (in_value) - cols++; - - if (!cols){ - fprintf (stderr, "No columns in first row\n"); - exit (1); - } - - column_labels = g_new0 (char *, cols); - - p = buffer; - for (i = 0; (s = strtok (p, " \t")) != NULL; i++){ - column_labels [i] = g_strdup (s); - if ( strchr(column_labels [i], '\n') ) - *strchr(column_labels [i], '\n') = 0; - 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 * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup(value); -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - g_free(value); -} - -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed(etc); -} - -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, - duplicate_value, free_value, thaw, NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - for (i = 0; i < cols; i++){ - ETableCol *ecol = e_table_col_new ( - i, column_labels [i], - 80, 20, cell_left_just, - g_str_compare, 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, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); -} - -static void -do_e_table_demo (const char *spec) -{ - GtkWidget *e_table, *window, *frame; - ECell *cell_left_just; - ETableHeader *full_header; - int i; - - /* - * Data model - */ - static ETableModel *e_table_model = NULL; - - if ( e_table_model == NULL ) - e_table_model = - e_table_simple_new (col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - thaw, NULL); - - full_header = e_table_header_new (); - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - for (i = 0; i < cols; i++){ - ETableCol *ecol = e_table_col_new ( - i, column_labels [i], - 80, 20, cell_left_just, - g_str_compare, TRUE); - - e_table_header_add_column (full_header, ecol, i); - } - - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - frame = gtk_frame_new (NULL); - e_table = e_table_new (full_header, e_table_model, spec); - gtk_container_add (GTK_CONTAINER (frame), e_table); - gtk_container_add (GTK_CONTAINER (window), frame); - - gtk_widget_set_usize (window, 200, 200); - gtk_widget_show (e_table); - gtk_widget_show (frame); - gtk_widget_show (window); -} - -void -e_table_test (void) -{ - load_data (); - - if (1){/*getenv ("DO")){*/ - do_e_table_demo (" 0 1 2 3 4 "); - do_e_table_demo (" 0 0 1 2 3 4 "); - } - do_e_table_demo (" 0 1 2 3 4 "); - do_e_table_demo (" 0 1 2 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 -#include "e-table-simple.h" - -struct { - char *str; - int val; -} data [] = { - { "Miguel", 10 }, - { "Nat", 20 }, - { NULL, 0 }, -}; - -main () -{ - -} - diff --git a/widgets/e-text/.cvsignore b/widgets/e-text/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/widgets/e-text/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/widgets/e-text/Makefile.am b/widgets/e-text/Makefile.am deleted file mode 100644 index ec7795f283..0000000000 --- a/widgets/e-text/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - $(GNOME_INCLUDEDIR) - -noinst_LIBRARIES = \ - libetext.a - -libetext_a_SOURCES = \ - e-text.c \ - e-text.h \ - e-text-event-processor.c \ - e-text-event-processor.h \ - e-text-event-processor-emacs-like.c \ - e-text-event-processor-emacs-like.h diff --git a/widgets/e-text/e-text-event-processor-emacs-like.c b/widgets/e-text/e-text-event-processor-emacs-like.c deleted file mode 100644 index 41bcd0c31d..0000000000 --- a/widgets/e-text/e-text-event-processor-emacs-like.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-text-event-processor-emacs-like.h" -static void e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *card); -static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass); -static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -static ETextEventProcessorClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0 -}; - -static const ETextEventProcessorCommand control_keys[26] = -{ - { E_TEP_START_OF_LINE, E_TEP_MOVE, 0, "" }, /* a */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_COPY, 0, "" }, /* c */ - { E_TEP_FORWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_END_OF_LINE, E_TEP_MOVE, 0, "" }, /* e */ - { E_TEP_FORWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_END_OF_LINE, E_TEP_DELETE, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_FORWARD_LINE, E_TEP_MOVE, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_BACKWARD_LINE, E_TEP_MOVE, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_START_OF_LINE, E_TEP_DELETE, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* v */ - { E_TEP_BACKWARD_WORD, E_TEP_DELETE, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ -}; - -static const ETextEventProcessorCommand alt_keys[26] = -{ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* a */ - { E_TEP_BACKWARD_WORD, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* c */ - { E_TEP_FORWARD_WORD, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* e */ - { E_TEP_FORWARD_WORD, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* v */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ - -}; - -GtkType -e_text_event_processor_emacs_like_get_type (void) -{ - static GtkType text_event_processor_emacs_like_type = 0; - - if (!text_event_processor_emacs_like_type) - { - static const GtkTypeInfo text_event_processor_emacs_like_info = - { - "ETextEventProcessorEmacsLike", - sizeof (ETextEventProcessorEmacsLike), - sizeof (ETextEventProcessorEmacsLikeClass), - (GtkClassInitFunc) e_text_event_processor_emacs_like_class_init, - (GtkObjectInitFunc) e_text_event_processor_emacs_like_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_emacs_like_type = gtk_type_unique (e_text_event_processor_get_type (), &text_event_processor_emacs_like_info); - } - - return text_event_processor_emacs_like_type; -} - -static void -e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass) -{ - GtkObjectClass *object_class; - ETextEventProcessorClass *processor_class; - - object_class = (GtkObjectClass*) klass; - processor_class = (ETextEventProcessorClass*) klass; - - parent_class = gtk_type_class (e_text_event_processor_get_type ()); - - processor_class->event = e_text_event_processor_emacs_like_event; -} - -static void -e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *tep) -{ -} - -static gint -e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - ETextEventProcessorCommand command; - ETextEventProcessorEmacsLike *tep_el = E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(tep); - command.action = E_TEP_NOP; - switch (event->type) { - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - command.action = E_TEP_GRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - if (event->button.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - tep_el->mouse_down = TRUE; - } - break; - case GDK_BUTTON_RELEASE: - if (event->button.button == 1) { - command.action = E_TEP_UNGRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - command.time = event->button.time; - tep_el->mouse_down = FALSE; - } else if (event->button.button == 2) { - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_GET_SELECTION; - command.position = E_TEP_SELECTION; - command.value = 0; - command.time = event->button.time; - } - break; - case GDK_MOTION_NOTIFY: - if (tep_el->mouse_down) { - command.action = E_TEP_SELECT; - command.position = E_TEP_VALUE; - command.time = event->motion.time; - command.value = event->motion.position; - } - break; - case GDK_KEY_PRESS: - { - ETextEventProcessorEventKey key = event->key; - command.time = event->key.time; - if (key.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - switch(key.keyval) { - case GDK_Home: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_START_OF_BUFFER; - else - command.position = E_TEP_START_OF_LINE; - break; - case GDK_End: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_END_OF_BUFFER; - else - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break; - case GDK_Page_Down: command.position = E_TEP_FORWARD_PAGE; break; - /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */ - case GDK_Up: command.position = E_TEP_BACKWARD_LINE; break; - case GDK_Down: command.position = E_TEP_FORWARD_LINE; break; - case GDK_Left: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Right: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_FORWARD_WORD; - else - command.position = E_TEP_FORWARD_CHARACTER; - break; - - case GDK_BackSpace: - command.action = E_TEP_DELETE; - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Clear: - command.action = E_TEP_DELETE; - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Insert: - if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_PASTE; - command.position = E_TEP_SELECTION; - } else if (key.state & GDK_CONTROL_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - } else { - /* gtk_toggle_insert(text) -- IMPLEMENT */ - } - break; - case GDK_Delete: - if (key.state & GDK_CONTROL_MASK){ - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_WORD; - } else if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } else { - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_CHARACTER; - } - break; - case GDK_Tab: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - case GDK_Return: - if (key.state & GDK_CONTROL_MASK) { - command.action = E_TEP_ACTIVATE; - command.position = E_TEP_SELECTION; - } else { - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "\n"; - } - break; - case GDK_Escape: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - - default: - if (key.state & GDK_CONTROL_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = control_keys[(int) (key.keyval - 'a')].position; - if (control_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = control_keys[(int) (key.keyval - 'a')].action; - command.value = control_keys[(int) (key.keyval - 'a')].value; - command.string = control_keys[(int) (key.keyval - 'a')].string; - } - - if (key.keyval == 'x') { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } - - break; - } else if (key.state & GDK_MOD1_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = alt_keys[(int) (key.keyval - 'a')].position; - if (alt_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = alt_keys[(int) (key.keyval - 'a')].action; - command.value = alt_keys[(int) (key.keyval - 'a')].value; - command.string = alt_keys[(int) (key.keyval - 'a')].string; - } - } else if (key.length > 0) { - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = strlen(key.string); - command.string = key.string; - - } else { - command.action = E_TEP_NOP; - } - } - break; - case GDK_KEY_RELEASE: - command.time = event->key.time; - command.action = E_TEP_NOP; - break; - default: - command.action = E_TEP_NOP; - break; - } - } - if (command.action != E_TEP_NOP) { - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - return 1; - } - else - return 0; -} - -ETextEventProcessor * -e_text_event_processor_emacs_like_new (void) -{ - ETextEventProcessorEmacsLike *retval = gtk_type_new (e_text_event_processor_emacs_like_get_type ()); - return E_TEXT_EVENT_PROCESSOR (retval); -} - diff --git a/widgets/e-text/e-text-event-processor-emacs-like.h b/widgets/e-text/e-text-event-processor-emacs-like.h deleted file mode 100644 index 651bb552b3..0000000000 --- a/widgets/e-text/e-text-event-processor-emacs-like.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor-emacs-like.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ -#define __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ - -#include -#include "e-text-event-processor.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessorEmacsLike - Turns events on a text widget into commands. Uses an emacs-ish interface. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE (e_text_event_processor_emacs_like_get_type ()) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike)) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) - - -typedef struct _ETextEventProcessorEmacsLike ETextEventProcessorEmacsLike; -typedef struct _ETextEventProcessorEmacsLikeClass ETextEventProcessorEmacsLikeClass; - -struct _ETextEventProcessorEmacsLike -{ - ETextEventProcessor parent; - - /* object specific fields */ - gboolean mouse_down; -}; - -struct _ETextEventProcessorEmacsLikeClass -{ - ETextEventProcessorClass parent_class; -}; - - -GtkType e_text_event_processor_emacs_like_get_type (void); -ETextEventProcessor *e_text_event_processor_emacs_like_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ */ diff --git a/widgets/e-text/e-text-event-processor-types.h b/widgets/e-text/e-text-event-processor-types.h deleted file mode 100644 index 32a39bf0c0..0000000000 --- a/widgets/e-text/e-text-event-processor-types.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 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/. - */ - -#ifndef __E_TEXT_EVENT_PROCESSOR_TYPES_H__ -#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__ - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include - -typedef enum _ETextEventProcessorCommandPosition ETextEventProcessorCommandPosition; -typedef enum _ETextEventProcessorCommandAction ETextEventProcessorCommandAction; -typedef struct _ETextEventProcessorCommand ETextEventProcessorCommand; - -typedef union _ETextEventProcessorEvent ETextEventProcessorEvent; -typedef struct _ETextEventProcessorEventButton ETextEventProcessorEventButton; -typedef struct _ETextEventProcessorEventKey ETextEventProcessorEventKey; -typedef struct _ETextEventProcessorEventMotion ETextEventProcessorEventMotion; - -enum _ETextEventProcessorCommandPosition { - E_TEP_VALUE, - E_TEP_SELECTION, - - E_TEP_START_OF_BUFFER, - E_TEP_END_OF_BUFFER, - - E_TEP_START_OF_LINE, - E_TEP_END_OF_LINE, - - E_TEP_FORWARD_CHARACTER, - E_TEP_BACKWARD_CHARACTER, - - E_TEP_FORWARD_WORD, - E_TEP_BACKWARD_WORD, - - E_TEP_FORWARD_LINE, - E_TEP_BACKWARD_LINE, - - E_TEP_FORWARD_PARAGRAPH, - E_TEP_BACKWARD_PARAGRAPH, - - E_TEP_FORWARD_PAGE, - E_TEP_BACKWARD_PAGE -}; - -enum _ETextEventProcessorCommandAction { - E_TEP_MOVE, - E_TEP_SELECT, - E_TEP_DELETE, - E_TEP_INSERT, - - E_TEP_COPY, - E_TEP_PASTE, - E_TEP_GET_SELECTION, - E_TEP_SET_SELECT_BY_WORD, - E_TEP_ACTIVATE, - - E_TEP_GRAB, - E_TEP_UNGRAB, - - E_TEP_NOP -}; - -struct _ETextEventProcessorCommand { - ETextEventProcessorCommandPosition position; - ETextEventProcessorCommandAction action; - int value; - char *string; - guint32 time; -}; - -struct _ETextEventProcessorEventButton { - GdkEventType type; - guint32 time; - guint state; - guint button; - gint position; -}; - -struct _ETextEventProcessorEventKey { - GdkEventType type; - guint32 time; - guint state; - guint keyval; - gint length; - gchar *string; -}; - -struct _ETextEventProcessorEventMotion { - GdkEventType type; - guint32 time; - guint state; - gint position; -}; - -union _ETextEventProcessorEvent { - GdkEventType type; - ETextEventProcessorEventButton button; - ETextEventProcessorEventKey key; - ETextEventProcessorEventMotion motion; -}; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_TYPES_H__ */ diff --git a/widgets/e-text/e-text-event-processor.c b/widgets/e-text/e-text-event-processor.c deleted file mode 100644 index 47f028ca62..0000000000 --- a/widgets/e-text/e-text-event-processor.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-text-event-processor.h" -static void e_text_event_processor_init (ETextEventProcessor *card); -static void e_text_event_processor_class_init (ETextEventProcessorClass *klass); - -static GtkObjectClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0 -}; - -enum { - E_TEP_EVENT, - E_TEP_LAST_SIGNAL -}; - -static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 }; - -GtkType -e_text_event_processor_get_type (void) -{ - static GtkType text_event_processor_type = 0; - - if (!text_event_processor_type) - { - static const GtkTypeInfo text_event_processor_info = - { - "ETextEventProcessor", - sizeof (ETextEventProcessor), - sizeof (ETextEventProcessorClass), - (GtkClassInitFunc) e_text_event_processor_class_init, - (GtkObjectInitFunc) e_text_event_processor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_type = gtk_type_unique (gtk_object_get_type (), &text_event_processor_info); - } - - return text_event_processor_type; -} - -static void -e_text_event_processor_class_init (ETextEventProcessorClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - e_tep_signals[E_TEP_EVENT] = - gtk_signal_new ("command", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, e_tep_signals, E_TEP_LAST_SIGNAL); - - klass->event = NULL; - klass->command = NULL; -} - -static void -e_text_event_processor_init (ETextEventProcessor *tep) -{ -} - -gint -e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - if (E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event) { - return E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event(tep, event); - } else { - return 0; - } -} diff --git a/widgets/e-text/e-text-event-processor.h b/widgets/e-text/e-text-event-processor.h deleted file mode 100644 index 1fc79f3f70..0000000000 --- a/widgets/e-text/e-text-event-processor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_H__ -#define __E_TEXT_EVENT_PROCESSOR_H__ - -#include -#include "e-text-event-processor-types.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessor - Turns events on a text widget into commands. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_TYPE (e_text_event_processor_get_type ()) -#define E_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor)) -#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass)) -#define E_IS_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) - - -typedef struct _ETextEventProcessor ETextEventProcessor; -typedef struct _ETextEventProcessorClass ETextEventProcessorClass; - -struct _ETextEventProcessor -{ - GtkObject parent; - - /* object specific fields */ - -}; - -struct _ETextEventProcessorClass -{ - GtkObjectClass parent_class; - - /* signals */ - void (* command) (ETextEventProcessor *tep, ETextEventProcessorCommand *command); - - /* virtual functions */ - gint (* event) (ETextEventProcessor *tep, ETextEventProcessorEvent *event); -}; - - -GtkType e_text_event_processor_get_type (void); -gint e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_H__ */ diff --git a/widgets/e-text/e-text-test.c b/widgets/e-text/e-text-test.c deleted file mode 100644 index ae43d41611..0000000000 --- a/widgets/e-text/e-text-test.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - ETextTest: E-Text item test program - Copyright (C)2000: Iain Holmes - - This code is licensed under the GPL -*/ - -#include "e-text.h" -#include - -void -quit_cb (GtkWidget *widget, - gpointer data) -{ - gtk_main_quit (); -} - -void -change_text_cb (GtkEntry *entry, - EText *text) -{ - gchar *str; - - str = gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "text", str, - NULL); -} - -void -change_font_cb (GtkEntry *entry, - EText *text) -{ - gchar *font; - - font = gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "font", font, - NULL); -} - -int -main (int argc, - char **argv) -{ - GtkWidget *window, *canvas, *scroller, *vbox, *text, *font; - GtkWidget *frame; - GnomeCanvasItem *item; - - gnome_init ("ETextTest", "0.0.1", argc, argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), "EText Test"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (quit_cb), NULL); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - canvas = gnome_canvas_new (); - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - scroller = gtk_scrolled_window_new (NULL, NULL); - vbox = gtk_vbox_new (FALSE, 2); - - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_box_pack_start (GTK_BOX (vbox), scroller, TRUE, TRUE, 2); - gtk_container_add (GTK_CONTAINER (scroller), canvas); - - frame = gtk_frame_new ("Text"); - text = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (frame), text); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - frame = gtk_frame_new ("Font"); - font = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (frame), font); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - item = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - e_text_get_type (), - "text", "Hello World! This is a really long string to test out the ellipsis stuff.", - "x", 10.0, - "y", 10.0, - "font", "-adobe-helvetica-medium-r-normal--12-*-72-72-p-*-iso8859-1", - "fill_color", "black", - "anchor", GTK_ANCHOR_NW, - "use_ellipsis", TRUE, - "ellipsis", "...", - "editable", TRUE, - "line_wrap", TRUE, - "max_lines", 3, - "clip_width", 150.0, - NULL); - - gtk_signal_connect (GTK_OBJECT (text), "activate", - GTK_SIGNAL_FUNC (change_text_cb), item); - gtk_signal_connect (GTK_OBJECT (font), "activate", - GTK_SIGNAL_FUNC (change_font_cb), item); - - gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, 400.0, 400.0); - gtk_widget_show_all (window); - gtk_main (); - - return 0; -} diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c deleted file mode 100644 index 6647531eee..0000000000 --- a/widgets/e-text/e-text.c +++ /dev/null @@ -1,2549 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* EText - Text item for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ - -#include -#include -#include -#include "e-text.h" -#include /* for BlackPixel */ -#include -#include -#include -#include - -#include "e-text-event-processor-emacs-like.h" - -enum { - E_TEXT_RESIZE, - E_TEXT_CHANGE, - E_TEXT_LAST_SIGNAL -}; - -static guint e_text_signals[E_TEXT_LAST_SIGNAL] = { 0 }; - - - -/* This defines a line of text */ -struct line { - char *text; /* Line's text, it is a pointer into the text->text string */ - int length; /* Line's length in characters */ - int width; /* Line's width in pixels */ - int ellipsis_length; /* Length before adding ellipsis */ -}; - - - -/* Object argument IDs */ -enum { - ARG_0, - ARG_TEXT, - ARG_X, - ARG_Y, - ARG_FONT, - ARG_FONTSET, - ARG_FONT_GDK, - ARG_ANCHOR, - ARG_JUSTIFICATION, - ARG_CLIP_WIDTH, - ARG_CLIP_HEIGHT, - ARG_CLIP, - ARG_X_OFFSET, - ARG_Y_OFFSET, - ARG_FILL_COLOR, - ARG_FILL_COLOR_GDK, - ARG_FILL_COLOR_RGBA, - ARG_FILL_STIPPLE, - ARG_TEXT_WIDTH, - ARG_TEXT_HEIGHT, - ARG_EDITABLE, - ARG_USE_ELLIPSIS, - ARG_ELLIPSIS, - ARG_LINE_WRAP, - ARG_MAX_LINES -}; - - -enum { - E_SELECTION_PRIMARY, - E_SELECTION_CLIPBOARD -}; -enum { - TARGET_STRING, - TARGET_TEXT, - TARGET_COMPOUND_TEXT -}; - -static void e_text_class_init (ETextClass *class); -static void e_text_init (EText *text); -static void e_text_destroy (GtkObject *object); -static void e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void e_text_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); -static void e_text_realize (GnomeCanvasItem *item); -static void e_text_unrealize (GnomeCanvasItem *item); -static void e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double e_text_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item); -static void e_text_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); -static void e_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); -static gint e_text_event (GnomeCanvasItem *item, GdkEvent *event); - -static void e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data); - -static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time); -static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length); - -static GtkWidget *e_text_get_invisible(EText *text); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - EText *text); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - EText *text); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - EText *text); - -static ETextSuckFont *e_suck_font (GdkFont *font); -static void e_suck_font_free (ETextSuckFont *suckfont); - - -static GnomeCanvasItemClass *parent_class; -static GdkAtom clipboard_atom = GDK_NONE; - - - -/** - * e_text_get_type: - * @void: - * - * Registers the &EText class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &EText class. - **/ -GtkType -e_text_get_type (void) -{ - static GtkType text_type = 0; - - if (!text_type) { - GtkTypeInfo text_info = { - "EText", - sizeof (EText), - sizeof (ETextClass), - (GtkClassInitFunc) e_text_class_init, - (GtkObjectInitFunc) e_text_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - text_type = gtk_type_unique (gnome_canvas_item_get_type (), &text_info); - } - - return text_type; -} - -/* Class initialization function for the text item */ -static void -e_text_class_init (ETextClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass *) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_item_get_type ()); - - e_text_signals[E_TEXT_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - e_text_signals[E_TEXT_CHANGE] = - gtk_signal_new ("change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_text_signals, E_TEXT_LAST_SIGNAL); - - gtk_object_add_arg_type ("EText::text", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT); - gtk_object_add_arg_type ("EText::x", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X); - gtk_object_add_arg_type ("EText::y", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y); - gtk_object_add_arg_type ("EText::font", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT); - gtk_object_add_arg_type ("EText::fontset", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET); - gtk_object_add_arg_type ("EText::font_gdk", - GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK); - gtk_object_add_arg_type ("EText::anchor", - GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR); - gtk_object_add_arg_type ("EText::justification", - GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION); - gtk_object_add_arg_type ("EText::clip_width", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_WIDTH); - gtk_object_add_arg_type ("EText::clip_height", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_HEIGHT); - gtk_object_add_arg_type ("EText::clip", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CLIP); - gtk_object_add_arg_type ("EText::x_offset", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X_OFFSET); - gtk_object_add_arg_type ("EText::y_offset", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y_OFFSET); - gtk_object_add_arg_type ("EText::fill_color", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR); - gtk_object_add_arg_type ("EText::fill_color_gdk", - GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); - gtk_object_add_arg_type ("EText::fill_color_rgba", - GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA); - gtk_object_add_arg_type ("EText::fill_stipple", - GTK_TYPE_GDK_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); - gtk_object_add_arg_type ("EText::text_width", - GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_WIDTH); - gtk_object_add_arg_type ("EText::text_height", - GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_HEIGHT); - gtk_object_add_arg_type ("EText::editable", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); - gtk_object_add_arg_type ("EText::use_ellipsis", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USE_ELLIPSIS); - gtk_object_add_arg_type ("EText::ellipsis", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ELLIPSIS); - gtk_object_add_arg_type ("EText::line_wrap", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_LINE_WRAP); - gtk_object_add_arg_type ("EText::max_lines", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES); - - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - - - - klass->resize = NULL; - klass->change = NULL; - - object_class->destroy = e_text_destroy; - object_class->set_arg = e_text_set_arg; - object_class->get_arg = e_text_get_arg; - - item_class->update = e_text_update; - item_class->realize = e_text_realize; - item_class->unrealize = e_text_unrealize; - item_class->draw = e_text_draw; - item_class->point = e_text_point; - item_class->bounds = e_text_bounds; - item_class->render = e_text_render; - item_class->event = e_text_event; -} - -/* Object initialization function for the text item */ -static void -e_text_init (EText *text) -{ - text->x = 0.0; - text->y = 0.0; - text->anchor = GTK_ANCHOR_CENTER; - text->justification = GTK_JUSTIFY_LEFT; - text->clip_width = 0.0; - text->clip_height = 0.0; - text->xofs = 0.0; - text->yofs = 0.0; - - text->ellipsis = NULL; - text->use_ellipsis = FALSE; - text->ellipsis_width = 0; - - text->editable = FALSE; - text->editing = FALSE; - text->xofs_edit = 0; - - text->selection_start = 0; - text->selection_end = 0; - text->select_by_word = FALSE; - - text->timeout_id = 0; - text->timer = NULL; - - text->lastx = 0; - text->lasty = 0; - text->last_state = 0; - - text->scroll_start = 0; - text->show_cursor = TRUE; - text->button_down = FALSE; - - text->tep = NULL; - - text->has_selection = FALSE; - - text->invisible = NULL; - text->primary_selection = NULL; - text->primary_length = 0; - text->clipboard_selection = NULL; - text->clipboard_length = 0; - - text->pointer_in = FALSE; - text->default_cursor_shown = TRUE; - - text->line_wrap = FALSE; - text->max_lines = -1; -} - -/* Destroy handler for the text item */ -static void -e_text_destroy (GtkObject *object) -{ - EText *text; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_TEXT (object)); - - text = E_TEXT (object); - - if (text->text) - g_free (text->text); - - if (text->tep) - gtk_object_unref (GTK_OBJECT(text->tep)); - - if (text->invisible) - gtk_object_unref (GTK_OBJECT(text->invisible)); - - if (text->lines) - g_free (text->lines); - - if (text->font) - gdk_font_unref (text->font); - - if (text->suckfont) - e_suck_font_free (text->suckfont); - - if (text->stipple) - gdk_bitmap_unref (text->stipple); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, double *py2) -{ - GnomeCanvasItem *item; - double x, y; - double clip_x, clip_y; - int old_height; - - item = GNOME_CANVAS_ITEM (text); - - x = text->x; - y = text->y; - - clip_x = x; - clip_y = y; - - /* Calculate text dimensions */ - - old_height = text->height; - - if (text->text && text->font) - text->height = (text->font->ascent + text->font->descent) * text->num_lines; - else - text->height = 0; - - if (old_height != text->height) - gtk_signal_emit_by_name (GTK_OBJECT (text), "resize"); - - /* Anchor text */ - - switch (text->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 -= text->max_width / 2; - clip_x -= text->clip_width / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - x -= text->max_width; - clip_x -= text->clip_width; - break; - } - - switch (text->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 -= text->height / 2; - clip_y -= text->clip_height / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - y -= text->height; - clip_y -= text->clip_height; - break; - } - - /* Bounds */ - - if (text->clip) { - /* maybe do bbox intersection here? */ - *px1 = clip_x; - *py1 = clip_y; - *px2 = clip_x + text->clip_width; - *py2 = clip_y + text->clip_height; - } else { - *px1 = x; - *py1 = y; - *px2 = x + text->max_width; - *py2 = y + text->height; - } -} - -static void -get_bounds (EText *text, double *px1, double *py1, double *px2, double *py2) -{ - GnomeCanvasItem *item; - double wx, wy; - int old_height; - - item = GNOME_CANVAS_ITEM (text); - - /* Get canvas pixel coordinates for text position */ - - wx = text->x; - wy = text->y; - gnome_canvas_item_i2w (item, &wx, &wy); - gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy); - - /* Get canvas pixel coordinates for clip rectangle position */ - - gnome_canvas_w2c (item->canvas, wx, wy, &text->clip_cx, &text->clip_cy); - text->clip_cwidth = text->clip_width * item->canvas->pixels_per_unit; - text->clip_cheight = text->clip_height * item->canvas->pixels_per_unit; - - /* Calculate text dimensions */ - - old_height = text->height; - - if (text->text && text->font) - text->height = (text->font->ascent + text->font->descent) * text->num_lines; - else - text->height = 0; - - if (old_height != text->height) - gtk_signal_emit_by_name (GTK_OBJECT (text), "resize"); - - /* Anchor text */ - - switch (text->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: - text->cx -= text->max_width / 2; - text->clip_cx -= text->clip_cwidth / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - text->cx -= text->max_width; - text->clip_cx -= text->clip_cwidth; - break; - } - - switch (text->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: - text->cy -= text->height / 2; - text->clip_cy -= text->clip_cheight / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - text->cy -= text->height; - text->clip_cy -= text->clip_cheight; - break; - } - - /* Bounds */ - - if (text->clip) { - *px1 = text->clip_cx; - *py1 = text->clip_cy; - *px2 = text->clip_cx + text->clip_cwidth; - *py2 = text->clip_cy + text->clip_cheight; - } else { - *px1 = text->cx; - *py1 = text->cy; - *px2 = text->cx + text->max_width; - *py2 = text->cy + text->height; - } -} - -/* Recalculates the bounding box of the text item. The bounding box is defined - * by the text's extents if the clip rectangle is disabled. If it is enabled, - * the bounding box is defined by the clip rectangle itself. - */ -static void -recalc_bounds (EText *text) -{ - GnomeCanvasItem *item; - - item = GNOME_CANVAS_ITEM (text); - - get_bounds (text, &item->x1, &item->y1, &item->x2, &item->y2); - - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); -} - -static void -calc_ellipsis (EText *text) -{ - if (text->font) - text->ellipsis_width = - gdk_text_width (text->font, - text->ellipsis ? text->ellipsis : "...", - text->ellipsis ? strlen (text->ellipsis) : 3); -} - -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (EText *text) -{ - struct line *lines; - int i; - int j; - - lines = text->lines; - text->max_width = 0; - - if (!lines) - return; - - for (i = 0; i < text->num_lines; i++) { - if (lines->length != 0) { - if (text->font) { - lines->width = gdk_text_width (text->font, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (text->clip && - text->use_ellipsis && - ! text->editing && - lines->width > text->clip_width) { - if (text->font) { - lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++ ) { - if (gdk_text_width (text->font, lines->text, j) + text->ellipsis_width <= text->clip_width) - lines->ellipsis_length = j; - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = gdk_text_width (text->font, lines->text, lines->ellipsis_length) + - text->ellipsis_width; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > text->max_width) - text->max_width = lines->width; - } - - lines++; - } -} - -/* Splits the text of the text item into lines */ -static void -split_into_lines (EText *text) -{ - char *p; - struct line *lines; - int len; - int line_num; - char *laststart; - char *lastend; - char *linestart; - - /* Free old array of lines */ - - if (text->lines) - g_free (text->lines); - - text->lines = NULL; - text->num_lines = 0; - - if (!text->text) - return; - - /* First, count the number of lines */ - - lastend = text->text; - laststart = text->text; - linestart = text->text; - - for (p = text->text; *p; p++) { - if (text->line_wrap && (*p == ' ' || *p == '\n')) { - if ( laststart != lastend - && gdk_text_width(text->font, - linestart, - p - linestart) - > text->clip_width ) { - text->num_lines ++; - linestart = laststart; - laststart = p + 1; - lastend = p; - } else if (*p == ' ') { - laststart = p + 1; - lastend = p; - } - } - if (*p == '\n') { - text->num_lines ++; - lastend = p + 1; - laststart = p + 1; - linestart = p + 1; - } - } - - if (text->line_wrap) { - if ( laststart != lastend - && gdk_text_width(text->font, - linestart, - p - linestart) - > text->clip_width ) { - text->num_lines ++; - } - } - - text->num_lines++; - - if ( (!text->editing) && text->max_lines != -1 && text->num_lines > text->max_lines ) { - text->num_lines = text->max_lines; - } - - /* Allocate array of lines and calculate split positions */ - - text->lines = lines = g_new0 (struct line, text->num_lines); - len = 0; - line_num = 1; - lastend = text->text; - laststart = text->text; - - for (p = text->text; line_num < text->num_lines && *p; p++) { - gboolean handled = FALSE; - if (len == 0) - lines->text = p; - if (text->line_wrap && (*p == ' ' || *p == '\n')) { - if ( gdk_text_width(text->font, - lines->text, - p - lines->text) - > text->clip_width - && laststart != lastend ) { - lines->length = lastend - lines->text; - lines++; - line_num ++; - len = p - laststart; - lines->text = laststart; - laststart = p + 1; - lastend = p; - } else if (*p == ' ') { - laststart = p + 1; - lastend = p; - len ++; - } - handled = TRUE; - } - if ( line_num >= text->num_lines ) - break; - if (*p == '\n') { - lines->length = p - lines->text; - lines++; - line_num ++; - len = 0; - lastend = p + 1; - laststart = p + 1; - handled = TRUE; - } - if (!handled) - len++; - } - - if ( line_num < text->num_lines && text->line_wrap ) { - if ( gdk_text_width(text->font, - lines->text, - p - lines->text) - > text->clip_width - && laststart != lastend ) { - lines->length = lastend - lines->text; - lines++; - line_num ++; - len = p - laststart; - lines->text = laststart; - laststart = p + 1; - lastend = p; - } - } - - if (len == 0) - lines->text = p; - lines->length = strlen(lines->text); - - calc_line_widths (text); -} - -/* Convenience function to set the text's GC's foreground color */ -static void -set_text_gc_foreground (EText *text) -{ - GdkColor c; - - if (!text->gc) - return; - - c.pixel = text->pixel; - gdk_gc_set_foreground (text->gc, &c); -} - -/* Sets the stipple pattern for the text */ -static void -set_stipple (EText *text, GdkBitmap *stipple, int reconfigure) -{ - if (text->stipple && !reconfigure) - gdk_bitmap_unref (text->stipple); - - text->stipple = stipple; - if (stipple && !reconfigure) - gdk_bitmap_ref (stipple); - - if (text->gc) { - if (stipple) { - gdk_gc_set_stipple (text->gc, stipple); - gdk_gc_set_fill (text->gc, GDK_STIPPLED); - } else - gdk_gc_set_fill (text->gc, GDK_SOLID); - } -} - -/* Set_arg handler for the text item */ -static void -e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EText *text; - GdkColor color = { 0, 0, 0, 0, }; - GdkColor *pcolor; - gboolean color_changed; - int have_pixel; - - item = GNOME_CANVAS_ITEM (object); - text = E_TEXT (object); - - color_changed = FALSE; - have_pixel = FALSE; - - switch (arg_id) { - case ARG_TEXT: - if (text->text) - g_free (text->text); - - text->text = g_strdup (GTK_VALUE_STRING (*arg)); - split_into_lines (text); - recalc_bounds (text); - break; - - case ARG_X: - text->x = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_Y: - text->y = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_FONT: - if (text->font) - gdk_font_unref (text->font); - - text->font = gdk_font_load (GTK_VALUE_STRING (*arg)); - - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } - - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_FONTSET: - if (text->font) - gdk_font_unref (text->font); - - text->font = gdk_fontset_load (GTK_VALUE_STRING (*arg)); - - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } - - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_FONT_GDK: - if (text->font) - gdk_font_unref (text->font); - - text->font = GTK_VALUE_BOXED (*arg); - gdk_font_ref (text->font); - - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_ANCHOR: - text->anchor = GTK_VALUE_ENUM (*arg); - recalc_bounds (text); - break; - - case ARG_JUSTIFICATION: - text->justification = GTK_VALUE_ENUM (*arg); - break; - - case ARG_CLIP_WIDTH: - text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg)); - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_CLIP_HEIGHT: - text->clip_height = fabs (GTK_VALUE_DOUBLE (*arg)); - recalc_bounds (text); - break; - - case ARG_CLIP: - text->clip = GTK_VALUE_BOOL (*arg); - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_X_OFFSET: - text->xofs = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_Y_OFFSET: - text->yofs = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_FILL_COLOR: - if (GTK_VALUE_STRING (*arg)) - gdk_color_parse (GTK_VALUE_STRING (*arg), &color); - - text->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - color_changed = TRUE; - break; - - case ARG_FILL_COLOR_GDK: - pcolor = GTK_VALUE_BOXED (*arg); - if (pcolor) { - color = *pcolor; - gdk_color_context_query_color (item->canvas->cc, &color); - have_pixel = TRUE; - } - - text->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - color_changed = TRUE; - break; - - case ARG_FILL_COLOR_RGBA: - text->rgba = GTK_VALUE_UINT (*arg); - color_changed = TRUE; - break; - - case ARG_FILL_STIPPLE: - set_stipple (text, GTK_VALUE_BOXED (*arg), FALSE); - break; - - case ARG_EDITABLE: - text->editable = GTK_VALUE_BOOL (*arg); - break; - - case ARG_USE_ELLIPSIS: - text->use_ellipsis = GTK_VALUE_BOOL (*arg); - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_ELLIPSIS: - if (text->ellipsis) - g_free (text->ellipsis); - - text->ellipsis = g_strdup (GTK_VALUE_STRING (*arg)); - calc_ellipsis (text); - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_LINE_WRAP: - text->line_wrap = GTK_VALUE_BOOL (*arg); - split_into_lines (text); - recalc_bounds (text); - break; - - case ARG_MAX_LINES: - text->max_lines = GTK_VALUE_INT (*arg); - split_into_lines (text); - recalc_bounds (text); - break; - - default: - break; - } - - if (color_changed) { - if (have_pixel) - text->pixel = color.pixel; - else - text->pixel = gnome_canvas_get_color_pixel (item->canvas, text->rgba); - - if (!item->canvas->aa) - set_text_gc_foreground (text); - - gnome_canvas_item_request_update (item); - } -} - -/* Get_arg handler for the text item */ -static void -e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EText *text; - GdkColor *color; - - text = E_TEXT (object); - - switch (arg_id) { - case ARG_TEXT: - GTK_VALUE_STRING (*arg) = g_strdup (text->text); - break; - - case ARG_X: - GTK_VALUE_DOUBLE (*arg) = text->x; - break; - - case ARG_Y: - GTK_VALUE_DOUBLE (*arg) = text->y; - break; - - case ARG_FONT_GDK: - GTK_VALUE_BOXED (*arg) = text->font; - break; - - case ARG_ANCHOR: - GTK_VALUE_ENUM (*arg) = text->anchor; - break; - - case ARG_JUSTIFICATION: - GTK_VALUE_ENUM (*arg) = text->justification; - break; - - case ARG_CLIP_WIDTH: - GTK_VALUE_DOUBLE (*arg) = text->clip_width; - break; - - case ARG_CLIP_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = text->clip_height; - break; - - case ARG_CLIP: - GTK_VALUE_BOOL (*arg) = text->clip; - break; - - case ARG_X_OFFSET: - GTK_VALUE_DOUBLE (*arg) = text->xofs; - break; - - case ARG_Y_OFFSET: - GTK_VALUE_DOUBLE (*arg) = text->yofs; - break; - - case ARG_FILL_COLOR_GDK: - color = g_new (GdkColor, 1); - color->pixel = text->pixel; - gdk_color_context_query_color (text->item.canvas->cc, color); - GTK_VALUE_BOXED (*arg) = color; - break; - - case ARG_FILL_COLOR_RGBA: - GTK_VALUE_UINT (*arg) = text->rgba; - break; - - case ARG_FILL_STIPPLE: - GTK_VALUE_BOXED (*arg) = text->stipple; - break; - - case ARG_TEXT_WIDTH: - GTK_VALUE_DOUBLE (*arg) = text->max_width / text->item.canvas->pixels_per_unit; - break; - - case ARG_TEXT_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = text->height / text->item.canvas->pixels_per_unit; - break; - - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = text->editable; - break; - - case ARG_USE_ELLIPSIS: - GTK_VALUE_BOOL (*arg) = text->use_ellipsis; - break; - - case ARG_ELLIPSIS: - GTK_VALUE_STRING (*arg) = g_strdup (text->ellipsis); - break; - - case ARG_LINE_WRAP: - GTK_VALUE_BOOL (*arg) = text->line_wrap; - break; - - case ARG_MAX_LINES: - GTK_VALUE_INT (*arg) = text->max_lines; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/* Update handler for the text item */ -static void -e_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - EText *text; - double x1, y1, x2, y2; - ArtDRect i_bbox, c_bbox; - int i; - - text = E_TEXT (item); - - if (parent_class->update) - (* parent_class->update) (item, affine, clip_path, flags); - - if (!item->canvas->aa) { - set_text_gc_foreground (text); - set_stipple (text, text->stipple, TRUE); - get_bounds (text, &x1, &y1, &x2, &y2); - - gnome_canvas_update_bbox (item, x1, y1, x2, y2); - } else { - /* aa rendering */ - for (i = 0; i < 6; i++) - text->affine[i] = affine[i]; - get_bounds_item_relative (text, &i_bbox.x0, &i_bbox.y0, &i_bbox.x1, &i_bbox.y1); - art_drect_affine_transform (&c_bbox, &i_bbox, affine); - gnome_canvas_update_bbox (item, c_bbox.x0, c_bbox.y0, c_bbox.x1, c_bbox.y1); - - } -} - -/* Realize handler for the text item */ -static void -e_text_realize (GnomeCanvasItem *item) -{ - EText *text; - - text = E_TEXT (item); - - if (parent_class->realize) - (* parent_class->realize) (item); - - text->gc = gdk_gc_new (item->canvas->layout.bin_window); - - text->i_cursor = gdk_cursor_new (GDK_XTERM); - text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); -} - -/* Unrealize handler for the text item */ -static void -e_text_unrealize (GnomeCanvasItem *item) -{ - EText *text; - - text = E_TEXT (item); - - gdk_gc_unref (text->gc); - text->gc = NULL; - - gdk_cursor_destroy (text->i_cursor); - gdk_cursor_destroy (text->default_cursor); - - if (parent_class->unrealize) - (* parent_class->unrealize) (item); -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static double -get_line_xpos_item_relative (EText *text, struct line *line) -{ - double x; - - x = text->x; - - switch (text->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 -= text->max_width / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - x -= text->max_width; - break; - } - - switch (text->justification) { - case GTK_JUSTIFY_RIGHT: - x += text->max_width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (text->max_width - line->width) * 0.5; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -/* Calculates the y position of the first line of text. */ -static double -get_line_ypos_item_relative (EText *text) -{ - double y; - - y = text->y; - - switch (text->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 -= text->height / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - y -= text->height; - break; - } - - return y; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (EText *text, struct line *line) -{ - int x; - - x = text->cx; - - switch (text->justification) { - case GTK_JUSTIFY_RIGHT: - x += text->max_width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (text->max_width - line->width) / 2; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -static void -_get_tep(EText *text) -{ - if (!text->tep) { - text->tep = e_text_event_processor_emacs_like_new(); - gtk_object_ref (GTK_OBJECT (text->tep)); - gtk_object_sink (GTK_OBJECT (text->tep)); - gtk_signal_connect(GTK_OBJECT(text->tep), - "command", - GTK_SIGNAL_FUNC(e_text_command), - (gpointer) text); - } -} - -/* Draw handler for the text item */ -static void -e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - EText *text; - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - GnomeCanvas *canvas; - - text = E_TEXT (item); - canvas = GNOME_CANVAS_ITEM(text)->canvas; - - fg_gc = GTK_WIDGET(canvas)->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - - if (!text->text || !text->font) - return; - - clip_rect = NULL; - if (text->clip) { - rect.x = text->clip_cx - x; - rect.y = text->clip_cy - y; - rect.width = text->clip_cwidth; - rect.height = text->clip_cheight; - - gdk_gc_set_clip_rectangle (text->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - } - lines = text->lines; - ypos = text->cy + text->font->ascent; - - if (text->stipple) - gnome_canvas_set_stipple_origin (item->canvas, text->gc); - - for (i = 0; i < text->num_lines; i++) { - xpos = get_line_xpos (text, lines); - if (text->editing) { - xpos -= text->xofs_edit; - start_char = lines->text - text->text; - end_char = start_char + lines->length; - sel_start = text->selection_start; - sel_end = text->selection_end; - if (sel_start > sel_end ) { - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if ( sel_start < start_char ) - sel_start = start_char; - if ( sel_end > end_char ) - sel_end = end_char; - if ( sel_start < sel_end ) { - sel_rect.x = xpos - x + gdk_text_width (text->font, - lines->text, - sel_start - start_char); - sel_rect.y = ypos - y - text->font->ascent; - sel_rect.width = gdk_text_width (text->font, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = text->font->ascent + text->font->descent; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - text->has_selection ? - GTK_STATE_SELECTED : - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - GTK_WIDGET(item->canvas), - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - sel_start - start_char); - gdk_draw_text (drawable, - text->font, - fg_gc, - xpos - x + gdk_text_width (text->font, - lines->text, - sel_start - start_char), - ypos - y, - lines->text + sel_start - start_char, - sel_end - sel_start); - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x + gdk_text_width (text->font, - lines->text, - sel_end - start_char), - ypos - y, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->length); - } - if (text->selection_start == text->selection_end && - text->selection_start >= start_char && - text->selection_start <= end_char && - text->show_cursor) { - gdk_draw_rectangle (drawable, - text->gc, - TRUE, - xpos - x + gdk_text_width (text->font, - lines->text, - sel_start - start_char), - ypos - y - text->font->ascent, - 1, - text->font->ascent + text->font->descent); - } - } else { - if ( text->clip && text->use_ellipsis && lines->ellipsis_length < lines->length) { - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->ellipsis_length); - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x + - lines->width - text->ellipsis_width, - ypos - y, - text->ellipsis ? text->ellipsis : "...", - text->ellipsis ? strlen (text->ellipsis) : 3); - } else - - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->length); - } - - ypos += text->font->ascent + text->font->descent; - lines++; - } - - if (text->clip) { - gdk_gc_set_clip_rectangle (text->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); - } -} - -/* Render handler for the text item */ -static void -e_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) -{ - EText *text; - guint32 fg_color; - double xpos, ypos; - struct line *lines; - int i, j; - double affine[6]; - ETextSuckFont *suckfont; - int dx, dy; - ArtPoint start_i, start_c; - - text = E_TEXT (item); - - if (!text->text || !text->font || !text->suckfont) - return; - - suckfont = text->suckfont; - - fg_color = text->rgba; - - gnome_canvas_buf_ensure_buf (buf); - - lines = text->lines; - start_i.y = get_line_ypos_item_relative (text); - - art_affine_scale (affine, item->canvas->pixels_per_unit, item->canvas->pixels_per_unit); - for (i = 0; i < 6; i++) - affine[i] = text->affine[i]; - - for (i = 0; i < text->num_lines; i++) { - if (lines->length != 0) { - start_i.x = get_line_xpos_item_relative (text, lines); - art_affine_point (&start_c, &start_i, text->affine); - xpos = start_c.x; - ypos = start_c.y; - - for (j = 0; j < lines->length; j++) { - ETextSuckChar *ch; - - ch = &suckfont->chars[(unsigned char)((lines->text)[j])]; - - affine[4] = xpos; - affine[5] = ypos; - art_rgb_bitmap_affine ( - buf->buf, - buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1, - buf->buf_rowstride, - suckfont->bitmap + (ch->bitmap_offset >> 3), - ch->width, - suckfont->bitmap_height, - suckfont->bitmap_width >> 3, - fg_color, - affine, - ART_FILTER_NEAREST, NULL); - - dx = ch->left_sb + ch->width + ch->right_sb; - xpos += dx * affine[0]; - ypos += dx * affine[1]; - } - } - - dy = text->font->ascent + text->font->descent; - start_i.y += dy; - lines++; - } - - buf->is_bg = 0; -} - -/* Point handler for the text item */ -static double -e_text_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) -{ - EText *text; - int i; - struct line *lines; - int x1, y1, x2, y2; - int font_height; - int dx, dy; - double dist, best; - - text = E_TEXT (item); - - *actual_item = item; - - /* The idea is to build bounding rectangles for each of the lines of - * text (clipped by the clipping rectangle, if it is activated) and see - * whether the point is inside any of these. If it is, we are done. - * Otherwise, calculate the distance to the nearest rectangle. - */ - - if (text->font) - font_height = text->font->ascent + text->font->descent; - else - font_height = 0; - - best = 1.0e36; - - lines = text->lines; - - for (i = 0; i < text->num_lines; i++) { - /* Compute the coordinates of rectangle for the current line, - * clipping if appropriate. - */ - - x1 = get_line_xpos (text, lines); - y1 = text->cy + i * font_height; - x2 = x1 + lines->width; - y2 = y1 + font_height; - - if (text->clip) { - if (x1 < text->clip_cx) - x1 = text->clip_cx; - - if (y1 < text->clip_cy) - y1 = text->clip_cy; - - if (x2 > (text->clip_cx + text->clip_width)) - x2 = text->clip_cx + text->clip_width; - - if (y2 > (text->clip_cy + text->clip_height)) - y2 = text->clip_cy + text->clip_height; - - if ((x1 >= x2) || (y1 >= y2)) - continue; - } - - /* Calculate distance from point to rectangle */ - - if (cx < x1) - dx = x1 - cx; - else if (cx >= x2) - dx = cx - x2 + 1; - else - dx = 0; - - if (cy < y1) - dy = y1 - cy; - else if (cy >= y2) - dy = cy - y2 + 1; - else - dy = 0; - - if ((dx == 0) && (dy == 0)) - return 0.0; - - dist = sqrt (dx * dx + dy * dy); - if (dist < best) - best = dist; - - /* Next! */ - - lines++; - } - - return best / item->canvas->pixels_per_unit; -} - -/* Bounds handler for the text item */ -static void -e_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - EText *text; - double width, height; - - text = E_TEXT (item); - - *x1 = text->x; - *y1 = text->y; - - if (text->clip) { - width = text->clip_width; - height = text->clip_height; - } else { - width = text->max_width / item->canvas->pixels_per_unit; - height = text->height / item->canvas->pixels_per_unit; - } - - switch (text->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: - *x1 -= width / 2.0; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - *x1 -= width; - break; - } - - switch (text->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: - *y1 -= height / 2.0; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - *y1 -= height; - break; - } - - *x2 = *x1 + width; - *y2 = *y1 + height; -} - -static void -_get_xy_from_position (EText *text, gint position, gint *xp, gint *yp) -{ - if (xp || yp) { - struct line *lines = NULL; - int x, y; - int j; - x = get_line_xpos (text, lines); - y = text->cy; - for (j = 0, lines = text->lines; j < text->num_lines; lines++, j++) { - if (lines->text > text->text + position) - break; - y += text->font->ascent + text->font->descent; - } - lines --; - y -= text->font->descent; - - x += gdk_text_width (text->font, - lines->text, - position - (lines->text - text->text)); - x -= text->xofs_edit; - if (xp) - *xp = x; - if (yp) - *yp = y; - } -} - -static gint -_get_position_from_xy (EText *text, gint x, gint y) -{ - int i, j; - int ypos = text->cy; - int xpos; - struct line *lines; - j = 0; - while (y > ypos) { - ypos += text->font->ascent + text->font->descent; - j ++; - } - j--; - if (j >= text->num_lines) - j = text->num_lines - 1; - if (j < 0) - j = 0; - i = 0; - lines = text->lines; - lines += j; - x += text->xofs_edit; - xpos = get_line_xpos (text, lines); - for(i = 0; i < lines->length; i++) { - int charwidth = gdk_text_width(text->font, - lines->text + i, - 1); - xpos += charwidth / 2; - if (xpos > x) { - break; - } - xpos += (charwidth + 1) / 2; - } - return lines->text + i - text->text; -} - -#define SCROLL_WAIT_TIME 30000 - -static gboolean -_blink_scroll_timeout (gpointer data) -{ - EText *text = E_TEXT(data); - gulong current_time; - gboolean scroll = FALSE; - gboolean redraw = FALSE; - - g_timer_elapsed(text->timer, ¤t_time); - - if (text->scroll_start + SCROLL_WAIT_TIME > 1000000) { - if (current_time > text->scroll_start - (1000000 - SCROLL_WAIT_TIME) && - current_time < text->scroll_start) - scroll = TRUE; - } else { - if (current_time > text->scroll_start + SCROLL_WAIT_TIME || - current_time < text->scroll_start) - scroll = TRUE; - } - if (scroll && text->button_down) { - if (text->lastx - text->clip_cx > text->clip_cwidth && - text->xofs_edit < text->max_width - text->clip_cwidth) { - text->xofs_edit += 4; - if (text->xofs_edit > text->max_width - text->clip_cwidth + 1) - text->xofs_edit = text->max_width - text->clip_cwidth + 1; - redraw = TRUE; - } - if (text->lastx - text->clip_cx < 0 && - text->xofs_edit > 0) { - text->xofs_edit -= 4; - if (text->xofs_edit < 0) - text->xofs_edit = 0; - redraw = TRUE; - } - if (redraw) { - ETextEventProcessorEvent e_tep_event; - e_tep_event.type = GDK_MOTION_NOTIFY; - e_tep_event.motion.state = text->last_state; - e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy(text, text->lastx, text->lasty); - _get_tep(text); - e_text_event_processor_handle_event (text->tep, - &e_tep_event); - text->scroll_start = current_time; - } - } - - if (!((current_time / 500000) % 2)) { - if (!text->show_cursor) - redraw = TRUE; - text->show_cursor = TRUE; - } else { - if (text->show_cursor) - redraw = TRUE; - text->show_cursor = FALSE; - } - if (redraw) - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); - return TRUE; -} - -static gboolean -_do_tooltip (gpointer data) -{ - EText *text = E_TEXT (data); - struct line *lines; - GtkWidget *label, *vbox; - gint x, y, pointer_x, pointer_y, scr_w, scr_h, tip_w, tip_h; - int i; - - lines = text->lines; - - scr_w = gdk_screen_width (); - scr_h = gdk_screen_height (); - gdk_window_get_pointer (NULL, &pointer_x, &pointer_y, NULL); - - text->tooltip_window = gtk_window_new (GTK_WINDOW_POPUP); - vbox = gtk_vbox_new (TRUE, 0); - for (i = 0; i < text->num_lines; i++) { - gchar *linetext; - - linetext = g_strndup (lines->text, lines->length); - label = gtk_label_new (linetext); - g_free (linetext); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); - lines++; - } - - gtk_widget_show_all (vbox); - gtk_container_add (GTK_CONTAINER (text->tooltip_window), vbox); - gtk_widget_realize (text->tooltip_window); - tip_w = text->tooltip_window->allocation.width; - tip_h = text->tooltip_window->allocation.height; - - /* Stay on screen */ - x = pointer_x + tip_w <= scr_w ? pointer_x : scr_w - tip_w; - y = pointer_y + tip_h + 1 <= scr_h ? pointer_y + 1: pointer_y - tip_h; - gtk_widget_popup (text->tooltip_window, x, y); - - return FALSE; -} - -static gint -e_text_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EText *text = E_TEXT(item); - ETextEventProcessorEvent e_tep_event; - - gint return_val = 0; - - e_tep_event.type = event->type; - switch (event->type) { - case GDK_FOCUS_CHANGE: - if (text->editable) { - GdkEventFocus *focus_event; - focus_event = (GdkEventFocus *) event; - if (focus_event->in) { - if(!text->editing) { - text->editing = TRUE; - if ( text->pointer_in ) { - if ( text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->i_cursor); - text->default_cursor_shown = FALSE; - } - } - text->selection_start = 0; - text->selection_end = 0; - text->select_by_word = FALSE; - text->xofs_edit = 0; - if (text->timeout_id == 0) - text->timeout_id = g_timeout_add(10, _blink_scroll_timeout, text); - text->timer = g_timer_new(); - g_timer_elapsed(text->timer, &(text->scroll_start)); - g_timer_start(text->timer); - } - } else { - text->editing = FALSE; - if ( ! text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->default_cursor); - text->default_cursor_shown = TRUE; - } - if (text->timeout_id) { - g_source_remove(text->timeout_id); - text->timeout_id = 0; - } - if (text->timer) { - g_timer_stop(text->timer); - g_timer_destroy(text->timer); - text->timer = NULL; - } - } - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - } - return_val = 0; - break; - case GDK_KEY_PRESS: /* Fall Through */ - case GDK_KEY_RELEASE: - if (text->editing) { - GdkEventKey key = event->key; - e_tep_event.key.time = key.time; - e_tep_event.key.state = key.state; - e_tep_event.key.keyval = key.keyval; - e_tep_event.key.length = key.length; - e_tep_event.key.string = key.string; - _get_tep(text); - return e_text_event_processor_handle_event (text->tep, - &e_tep_event); - } - else - return 0; - break; - case GDK_BUTTON_PRESS: /* Fall Through */ - case GDK_BUTTON_RELEASE: - if ((!text->editing) - && text->editable - && event->type == GDK_BUTTON_RELEASE - && event->button.button == 1) { - GdkEventButton button = event->button; - - gnome_canvas_item_grab_focus (item); - - e_tep_event.type = GDK_BUTTON_PRESS; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(text, button.x, button.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - e_tep_event.type = GDK_BUTTON_RELEASE; - } - if (text->editing) { - GdkEventButton button = event->button; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(text, button.x, button.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - text->button_down = TRUE; - else - text->button_down = FALSE; - } - text->lastx = button.x; - text->lasty = button.y; - text->last_state = button.state; - } - break; - case GDK_MOTION_NOTIFY: - if (text->editing) { - GdkEventMotion motion = event->motion; - e_tep_event.motion.time = motion.time; - e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy(text, motion.x, motion.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - text->lastx = motion.x; - text->lasty = motion.y; - text->last_state = motion.state; - } - break; - case GDK_ENTER_NOTIFY: - if ( text->tooltip_count == 0 ) - text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text); - text->tooltip_count ++; - text->pointer_in = TRUE; - if (text->editing) { - if ( text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->i_cursor); - text->default_cursor_shown = FALSE; - } - } - break; - case GDK_LEAVE_NOTIFY: - text->tooltip_count --; - if ( text->tooltip_count == 0 ) { - gtk_timeout_remove (text->tooltip_timeout); - if (text->tooltip_window) { - gtk_widget_destroy (text->tooltip_window); - text->tooltip_window = NULL; - } - } - - text->pointer_in = FALSE; - if (text->editing) { - if ( ! text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->default_cursor); - text->default_cursor_shown = TRUE; - } - } - break; - default: - break; - } - if (return_val) - return return_val; - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); - else - return 0; -} - -static int -_get_position(EText *text, ETextEventProcessorCommand *command) -{ - int i; - int length; - int x, y; - - switch (command->position) { - - case E_TEP_VALUE: - return command->value; - - case E_TEP_SELECTION: - return text->selection_end; - - case E_TEP_START_OF_BUFFER: - return 0; - case E_TEP_END_OF_BUFFER: - return strlen(text->text); - - case E_TEP_START_OF_LINE: - for (i = text->selection_end - 2; i > 0; i--) - if (text->text[i] == '\n') { - i++; - break; - } - return i; - case E_TEP_END_OF_LINE: - length = strlen(text->text); - for (i = text->selection_end + 1; i < length; i++) - if (text->text[i] == '\n') { - break; - } - if (i > length) - i = length; - return i; - - case E_TEP_FORWARD_CHARACTER: - length = strlen(text->text); - i = text->selection_end + 1; - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_CHARACTER: - i = text->selection_end - 1; - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_WORD: - length = strlen(text->text); - for (i = text->selection_end + 1; i < length; i++) - if (isspace(text->text[i])) { - break; - } - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_WORD: - for (i = text->selection_end - 2; i > 0; i--) - if (isspace(text->text[i])) { - i++; - break; - } - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_LINE: - _get_xy_from_position(text, text->selection_end, &x, &y); - y += text->font->ascent + text->font->descent; - return _get_position_from_xy(text, x, y); - case E_TEP_BACKWARD_LINE: - _get_xy_from_position(text, text->selection_end, &x, &y); - y -= text->font->ascent + text->font->descent; - return _get_position_from_xy(text, x, y); - - case E_TEP_FORWARD_PARAGRAPH: - case E_TEP_BACKWARD_PARAGRAPH: - - case E_TEP_FORWARD_PAGE: - case E_TEP_BACKWARD_PAGE: - return text->selection_end; - default: - return text->selection_end; - } -} - -static void -_delete_selection(EText *text) -{ - gint length = strlen(text->text); - if (text->selection_end == text->selection_start) - return; - if (text->selection_end < text->selection_start) { - text->selection_end ^= text->selection_start; - text->selection_start ^= text->selection_end; - text->selection_end ^= text->selection_start; - } - memmove( text->text + text->selection_start, - text->text + text->selection_end, - length - text->selection_end + 1 ); - length -= text->selection_end - text->selection_start; - text->selection_end = text->selection_start; -} - -static void -_insert(EText *text, char *string, int value) -{ - if (value > 0) { - char *temp; - gint length = strlen(text->text); - temp = g_new(gchar, length + value + 1); - strncpy(temp, text->text, text->selection_start); - strncpy(temp + text->selection_start, string, value); - strcpy(temp + text->selection_start + value, text->text + text->selection_start); - g_free(text->text); - text->text = temp; - text->selection_start += value; - text->selection_end = text->selection_start; - } -} - -static void -e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) -{ - EText *text = E_TEXT(data); - int sel_start, sel_end; - switch (command->action) { - case E_TEP_MOVE: - text->selection_start = _get_position(text, command); - text->selection_end = text->selection_start; - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_SELECT: - text->selection_end = _get_position(text, command); - sel_start = MIN(text->selection_start, text->selection_end); - sel_end = MAX(text->selection_start, text->selection_end); - if (sel_start != sel_end) { - e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start); - } else if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_DELETE: - if (text->selection_end == text->selection_start) { - text->selection_end = _get_position(text, command); - } - _delete_selection(text); - split_into_lines (text); - recalc_bounds (text); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - - case E_TEP_INSERT: - if (text->selection_end != text->selection_start) { - _delete_selection(text); - } - _insert(text, command->string, command->value); - split_into_lines (text); - recalc_bounds (text); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_COPY: - sel_start = MIN(text->selection_start, text->selection_end); - sel_end = MAX(text->selection_start, text->selection_end); - if (sel_start != sel_end) { - e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start); - } - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_PASTE: - e_text_get_selection (text, clipboard_atom, command->time); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_GET_SELECTION: - e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time); - break; - case E_TEP_ACTIVATE: - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_SET_SELECT_BY_WORD: - text->select_by_word = command->value; - break; - case E_TEP_GRAB: - gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - text->i_cursor, - command->time); - break; - case E_TEP_UNGRAB: - gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time); - break; - case E_TEP_NOP: - break; - } - - if (!text->button_down) { - int x; - int i; - struct line *lines = text->lines; - for (lines = text->lines, i = 0; i < text->num_lines ; i++, lines ++) { - if (lines->text - text->text > text->selection_end) { - break; - } - } - lines --; - x = gdk_text_width(text->font, - lines->text, - text->selection_end - (lines->text - text->text)); - - - if (x < text->xofs_edit) { - text->xofs_edit = x; - } - - if (2 + x - text->clip_width > text->xofs_edit) { - text->xofs_edit = 2 + x - text->clip_width; - } - } - - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -} - -static void _invisible_destroy (GtkInvisible *invisible, - EText *text) -{ - text->invisible = NULL; -} - -static GtkWidget *e_text_get_invisible(EText *text) -{ - GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - text); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - text); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - text); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } - return invisible; -} - -static void -_selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - EText *text) -{ - if (event->selection == GDK_SELECTION_PRIMARY) { - g_free (text->primary_selection); - text->primary_selection = NULL; - text->primary_length = 0; - - text->has_selection = FALSE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); - - } else if (event->selection == clipboard_atom) { - g_free (text->clipboard_selection); - text->clipboard_selection = NULL; - text->clipboard_length = 0; - } -} - -static void -_selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - EText *text) -{ - switch (info) { - case E_SELECTION_PRIMARY: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, text->primary_selection, text->primary_length); - break; - case E_SELECTION_CLIPBOARD: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, text->clipboard_selection, text->clipboard_length); - break; - } -} - -static void -_selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - EText *text) -{ - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - return; - } else { - ETextEventProcessorCommand command; - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.string = selection_data->data; - command.value = selection_data->length; - command.time = time; - e_text_command(text->tep, &command, text); - } -} - -static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length) -{ - gboolean successful; - GtkWidget *invisible; - - invisible = e_text_get_invisible(text); - - if (selection == GDK_SELECTION_PRIMARY ) { - if (text->primary_selection) { - g_free (text->primary_selection); - } - text->primary_selection = g_strndup(data, length); - text->primary_length = length; - } else if (selection == clipboard_atom) { - if (text->clipboard_selection) { - g_free (text->clipboard_selection); - } - text->clipboard_selection = g_strndup(data, length); - text->clipboard_length = length; - } - - successful = gtk_selection_owner_set (invisible, - selection, - time); - - if (selection == GDK_SELECTION_PRIMARY) - text->has_selection = successful; -} - -static void -e_text_get_selection(EText *text, GdkAtom selection, guint32 time) -{ - GtkWidget *invisible; - invisible = e_text_get_invisible(text); - gtk_selection_convert(invisible, - selection, - GDK_SELECTION_TYPE_STRING, - time); -} - -#if 0 -static void -e_text_real_copy_clipboard (EText *text) -{ - guint32 time; - gint selection_start_pos; - gint selection_end_pos; - - g_return_if_fail (text != NULL); - g_return_if_fail (E_IS_TEXT (text)); - - time = gtk_text_get_event_time (text); - selection_start_pos = MIN (text->selection_start, text->selection_end); - selection_end_pos = MAX (text->selection_start, text->selection_end); - - if (selection_start_pos != selection_end_pos) - { - if (gtk_selection_owner_set (GTK_WIDGET (text->canvas), - clipboard_atom, - time)) - text->clipboard_text = ""; - } -} - -static void -e_text_real_paste_clipboard (EText *text) -{ - guint32 time; - - g_return_if_fail (text != NULL); - g_return_if_fail (E_IS_TEXT (text)); - - time = e_text_get_event_time (text); - if (text->editable) - gtk_selection_convert (GTK_WIDGET(text->widget), - clipboard_atom, - gdk_atom_intern ("COMPOUND_TEXT", FALSE), time); -} -#endif - - - -/* Routines for sucking fonts from the X server */ - -static ETextSuckFont * -e_suck_font (GdkFont *font) -{ - ETextSuckFont *suckfont; - int i; - int x, y; - char text[1]; - int lbearing, rbearing, ch_width, ascent, descent; - GdkPixmap *pixmap; - GdkColor black, white; - GdkImage *image; - GdkGC *gc; - guchar *line; - int width, height; - int black_pixel, pixel; - - if (!font) - return NULL; - - suckfont = g_new (ETextSuckFont, 1); - - height = font->ascent + font->descent; - x = 0; - for (i = 0; i < 256; i++) { - text[0] = i; - gdk_text_extents (font, text, 1, - &lbearing, &rbearing, &ch_width, &ascent, &descent); - suckfont->chars[i].left_sb = lbearing; - suckfont->chars[i].right_sb = ch_width - rbearing; - suckfont->chars[i].width = rbearing - lbearing; - suckfont->chars[i].ascent = ascent; - suckfont->chars[i].descent = descent; - suckfont->chars[i].bitmap_offset = x; - x += (ch_width + 31) & -32; - } - - width = x; - - suckfont->bitmap_width = width; - suckfont->bitmap_height = height; - suckfont->ascent = font->ascent; - - pixmap = gdk_pixmap_new (NULL, suckfont->bitmap_width, - suckfont->bitmap_height, 1); - gc = gdk_gc_new (pixmap); - gdk_gc_set_font (gc, font); - - black_pixel = BlackPixel (gdk_display, DefaultScreen (gdk_display)); - black.pixel = black_pixel; - white.pixel = WhitePixel (gdk_display, DefaultScreen (gdk_display)); - gdk_gc_set_foreground (gc, &white); - gdk_draw_rectangle (pixmap, gc, 1, 0, 0, width, height); - - gdk_gc_set_foreground (gc, &black); - for (i = 0; i < 256; i++) { - text[0] = i; - gdk_draw_text (pixmap, font, gc, - suckfont->chars[i].bitmap_offset - suckfont->chars[i].left_sb, - font->ascent, - text, 1); - } - - /* The handling of the image leaves me with distinct unease. But this - * is more or less copied out of gimp/app/text_tool.c, so it _ought_ to - * work. -RLL - */ - - image = gdk_image_get (pixmap, 0, 0, width, height); - suckfont->bitmap = g_malloc0 ((width >> 3) * height); - - line = suckfont->bitmap; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - pixel = gdk_image_get_pixel (image, x, y); - if (pixel == black_pixel) - line[x >> 3] |= 128 >> (x & 7); - } - line += width >> 3; - } - - gdk_image_destroy (image); - - /* free the pixmap */ - gdk_pixmap_unref (pixmap); - - /* free the gc */ - gdk_gc_destroy (gc); - - return suckfont; -} - -static void -e_suck_font_free (ETextSuckFont *suckfont) -{ - g_free (suckfont->bitmap); - g_free (suckfont); -} diff --git a/widgets/e-text/e-text.h b/widgets/e-text/e-text.h deleted file mode 100644 index 2f29fb189b..0000000000 --- a/widgets/e-text/e-text.h +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* EText - Text item for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ - -#ifndef E_TEXT_H -#define E_TEXT_H - -#include -#include "e-text-event-processor.h" - - -BEGIN_GNOME_DECLS - - -/* Text item for the canvas. Text items are positioned by an anchor point and an anchor direction. - * - * A clipping rectangle may be specified for the text. The rectangle is anchored at the text's anchor - * point, and is specified by clipping width and height parameters. If the clipping rectangle is - * enabled, it will clip the text. - * - * In addition, x and y offset values may be specified. These specify an offset from the anchor - * position. If used in conjunction with the clipping rectangle, these could be used to implement - * simple scrolling of the text within the clipping rectangle. - * - * The following object arguments are available: - * - * name type read/write description - * ------------------------------------------------------------------------------------------ - * text string RW The string of the text label - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point - * font string W X logical font descriptor - * fontset string W X logical fontset descriptor - * font_gdk GdkFont* RW Pointer to a GdkFont - * anchor GtkAnchorType RW Anchor side for the text - * justification GtkJustification RW Justification for multiline text - * fill_color string W X color specification for text - * fill_color_gdk GdkColor* RW Pointer to an allocated GdkColor - * fill_stipple GdkBitmap* RW Stipple pattern for filling the text - * clip_width double RW Width of clip rectangle - * clip_height double RW Height of clip rectangle - * clip boolean RW Use clipping rectangle? - * x_offset double RW Horizontal offset distance from anchor position - * y_offset double RW Vertical offset distance from anchor position - * text_width double R Used to query the width of the rendered text - * text_height double R Used to query the rendered height of the text - * - * These are currently ignored in the AA version: - * editable boolean RW Can this item be edited - * use_ellipsis boolean RW Whether to use ellipsises if text gets cut off. Meaningless if clip == false. - * ellipsis string RW The characters to use as ellipsis. NULL = "...". - * line_wrap boolean RW Line wrap when not editing. - * max_line_wrap int RW Number of lines possible when doing line wrap. - */ - -#define E_TYPE_TEXT (e_text_get_type ()) -#define E_TEXT(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT, EText)) -#define E_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass)) -#define E_IS_TEXT(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT)) -#define E_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT)) - - -typedef struct _EText EText; -typedef struct _ETextClass ETextClass; -typedef struct _ETextSuckFont ETextSuckFont; -typedef struct _ETextSuckChar ETextSuckChar; - -struct _ETextSuckChar { - int left_sb; - int right_sb; - int width; - int ascent; - int descent; - int bitmap_offset; /* in pixels */ -}; - -struct _ETextSuckFont { - guchar *bitmap; - gint bitmap_width; - gint bitmap_height; - gint ascent; - ETextSuckChar chars[256]; -}; - -struct _EText { - GnomeCanvasItem item; - - char *text; /* Text to display */ - gpointer lines; /* Text split into lines (private field) */ - int num_lines; /* Number of lines of text */ - - double x, y; /* Position at anchor */ - GdkFont *font; /* Font for text */ - GtkAnchorType anchor; /* Anchor side for text */ - GtkJustification justification; /* Justification for text */ - - double clip_width; /* Width of optional clip rectangle */ - double clip_height; /* Height of optional clip rectangle */ - - double xofs, yofs; /* Text offset distance from anchor position */ - - gulong pixel; /* Fill color */ - GdkBitmap *stipple; /* Stipple for text */ - GdkGC *gc; /* GC for drawing text */ - - int cx, cy; /* Top-left canvas coordinates for text */ - int clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ - int clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */ - int max_width; /* Maximum width of text lines */ - int height; /* Rendered text height in pixels */ - - guint clip : 1; /* Use clip rectangle? */ - - /* Antialiased specific stuff follows */ - ETextSuckFont *suckfont; /* Sucked font */ - guint32 rgba; /* RGBA color for text */ - double affine[6]; /* The item -> canvas affine */ - - char *ellipsis; /* The ellipsis characters. NULL = "...". */ - double ellipsis_width; /* The width of the ellipsis. */ - gboolean use_ellipsis; /* Whether to use the ellipsis. */ - - gboolean editable; /* Item is editable */ - gboolean editing; /* Item is currently being edited */ - - int xofs_edit; /* Offset because of editing */ - - /* This needs to be reworked a bit once we get line wrapping. */ - int selection_start; /* Start of selection */ - int selection_end; /* End of selection */ - gboolean select_by_word; /* Current selection is by word */ - - /* This section is for drag scrolling and blinking cursor. */ - gint timeout_id; /* Current timeout id for scrolling */ - GTimer *timer; /* Timer for blinking cursor and scrolling */ - - gint lastx, lasty; /* Last x and y motion events */ - gint last_state; /* Last state */ - gulong scroll_start; /* Starting time for scroll (microseconds) */ - - gint show_cursor; /* Is cursor currently shown */ - gboolean button_down; /* Is mouse button 1 down */ - - ETextEventProcessor *tep; /* Text Event Processor */ - - GtkWidget *invisible; /* For selection handling */ - gboolean has_selection; /* TRUE if we have the selection */ - gchar *primary_selection; /* Primary selection text */ - gint primary_length; /* Primary selection text length */ - gchar *clipboard_selection; /* Clipboard selection text */ - gint clipboard_length; /* Clipboard selection text length*/ - - guint pointer_in : 1; /* Is the pointer currently over us? */ - guint default_cursor_shown : 1; /* Is the default cursor currently shown? */ - - guint line_wrap : 1; /* Do line wrap */ - - gint max_lines; /* Max number of lines (-1 = infinite) */ - - GdkCursor *default_cursor; /* Default cursor (arrow) */ - GdkCursor *i_cursor; /* I beam cursor */ - - gint tooltip_timeout; /* Timeout for the tooltip */ - GtkWidget *tooltip_window; /* GtkWindow for displaying the tooltip */ - gint tooltip_count; /* GDK_ENTER_NOTIFY count. */ -}; - -struct _ETextClass { - GnomeCanvasItemClass parent_class; - - void (* resize) (EText *text); - void (* change) (EText *text); -}; - - -/* Standard Gtk function */ -GtkType e_text_get_type (void); - - -END_GNOME_DECLS - -#endif diff --git a/widgets/meeting-time-sel/.cvsignore b/widgets/meeting-time-sel/.cvsignore deleted file mode 100644 index 21ce3ebb95..0000000000 --- a/widgets/meeting-time-sel/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -test-meeting-time-selector diff --git a/widgets/meeting-time-sel/LICENSE b/widgets/meeting-time-sel/LICENSE deleted file mode 100644 index 9babf4395f..0000000000 --- a/widgets/meeting-time-sel/LICENSE +++ /dev/null @@ -1 +0,0 @@ -This code is licensed under the terms of the GNU GPL diff --git a/widgets/meeting-time-sel/Makefile.am b/widgets/meeting-time-sel/Makefile.am deleted file mode 100644 index efe9900dd8..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 $(GNOMEUI_LIBS) - -test_meeting_time_selector_LDFLAGS = $(GNOME_LIBDIR) - -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 - * - * 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 -#include -#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, ¤t_date, day_x, y, width, height); - else - e_meeting_time_selector_item_paint_day (mts_item, drawable, ¤t_date, day_x, y, width, height); - - day_x += mts_item->mts->day_width; - if (g_date_compare (¤t_date, &last_date) == 0) - break; - g_date_add_days (¤t_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 - * - * 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 - * - * 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 -#include -#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 - * - * 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 - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 - * - * 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 -#include - -#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 - * - * 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 -#include -#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-canvas-utils.c b/widgets/misc/e-canvas-utils.c deleted file mode 100644 index 2b50248124..0000000000 --- a/widgets/misc/e-canvas-utils.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-utils.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "e-canvas-utils.h" - -void -e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy) -{ - double translate[6]; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - art_affine_translate (translate, dx, dy); - - gnome_canvas_item_affine_absolute (item, translate); -} diff --git a/widgets/misc/e-canvas-utils.h b/widgets/misc/e-canvas-utils.h deleted file mode 100644 index 9580f64f96..0000000000 --- a/widgets/misc/e-canvas-utils.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas-utils.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __E_CANVAS_UTILS__ -#define __E_CANVAS_UTILS__ - -#include -void e_canvas_item_move_absolute (GnomeCanvasItem *item, double dx, double dy); - -#endif /* __E_CANVAS_UTILS__ */ diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c deleted file mode 100644 index 850e438386..0000000000 --- a/widgets/misc/e-canvas.c +++ /dev/null @@ -1,301 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-canvas.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-canvas.h" -static void e_canvas_init (ECanvas *card); -static void e_canvas_class_init (ECanvasClass *klass); -static gint e_canvas_key (GtkWidget *widget, - GdkEventKey *event); - -static gint e_canvas_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint e_canvas_focus_out (GtkWidget *widget, - GdkEventFocus *event); - -static int emit_event (GnomeCanvas *canvas, GdkEvent *event); - -static GnomeCanvasClass *parent_class = NULL; - -GtkType -e_canvas_get_type (void) -{ - static GtkType canvas_type = 0; - - if (!canvas_type) - { - static const GtkTypeInfo canvas_info = - { - "ECanvas", - sizeof (ECanvas), - sizeof (ECanvasClass), - (GtkClassInitFunc) e_canvas_class_init, - (GtkObjectInitFunc) e_canvas_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - canvas_type = gtk_type_unique (gnome_canvas_get_type (), &canvas_info); - } - - return canvas_type; -} - -static void -e_canvas_class_init (ECanvasClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasClass *canvas_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass*) klass; - canvas_class = (GnomeCanvasClass *) klass; - widget_class = (GtkWidgetClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_get_type ()); - - widget_class->key_press_event = e_canvas_key; - widget_class->key_release_event = e_canvas_key; - widget_class->focus_in_event = e_canvas_focus_in; - widget_class->focus_out_event = e_canvas_focus_out; -} - -static void -e_canvas_init (ECanvas *canvas) -{ -} - -GtkWidget * -e_canvas_new() -{ - return GTK_WIDGET (gtk_type_new (e_canvas_get_type ())); -} - - -/* Returns whether the item is an inferior of or is equal to the parent. */ -static int -is_descendant (GnomeCanvasItem *item, GnomeCanvasItem *parent) -{ - for (; item; item = item->parent) - if (item == parent) - return TRUE; - - return FALSE; -} - -/* Emits an event for an item in the canvas, be it the current item, grabbed - * item, or focused item, as appropriate. - */ -static int -emit_event (GnomeCanvas *canvas, GdkEvent *event) -{ - GdkEvent ev; - gint finished; - GnomeCanvasItem *item; - GnomeCanvasItem *parent; - guint mask; - - /* Perform checks for grabbed items */ - - if (canvas->grabbed_item && !is_descendant (canvas->current_item, canvas->grabbed_item)) - return FALSE; - - if (canvas->grabbed_item) { - switch (event->type) { - case GDK_ENTER_NOTIFY: - mask = GDK_ENTER_NOTIFY_MASK; - break; - - case GDK_LEAVE_NOTIFY: - mask = GDK_LEAVE_NOTIFY_MASK; - break; - - case GDK_MOTION_NOTIFY: - mask = GDK_POINTER_MOTION_MASK; - break; - - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - mask = GDK_BUTTON_PRESS_MASK; - break; - - case GDK_BUTTON_RELEASE: - mask = GDK_BUTTON_RELEASE_MASK; - break; - - case GDK_KEY_PRESS: - mask = GDK_KEY_PRESS_MASK; - break; - - case GDK_KEY_RELEASE: - mask = GDK_KEY_RELEASE_MASK; - break; - - default: - mask = 0; - break; - } - - if (!(mask & canvas->grabbed_event_mask)) - return FALSE; - } - - /* Convert to world coordinates -- we have two cases because of diferent - * offsets of the fields in the event structures. - */ - - ev = *event; - - switch (ev.type) { - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - gnome_canvas_window_to_world (canvas, - ev.crossing.x, ev.crossing.y, - &ev.crossing.x, &ev.crossing.y); - break; - - case GDK_MOTION_NOTIFY: - case GDK_BUTTON_PRESS: - case GDK_2BUTTON_PRESS: - case GDK_3BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - gnome_canvas_window_to_world (canvas, - ev.motion.x, ev.motion.y, - &ev.motion.x, &ev.motion.y); - break; - - default: - break; - } - - /* Choose where we send the event */ - - item = canvas->current_item; - - if (canvas->focused_item - && ((event->type == GDK_KEY_PRESS) || (event->type == GDK_KEY_RELEASE) || (event->type == GDK_FOCUS_CHANGE))) - item = canvas->focused_item; - - /* The event is propagated up the hierarchy (for if someone connected to - * a group instead of a leaf event), and emission is stopped if a - * handler returns TRUE, just like for GtkWidget events. - */ - - finished = FALSE; - - while (item && !finished) { - gtk_object_ref (GTK_OBJECT (item)); - - gtk_signal_emit_by_name (GTK_OBJECT (item), "event", - &ev, - &finished); - - if (GTK_OBJECT_DESTROYED (item)) - finished = TRUE; - - parent = item->parent; - gtk_object_unref (GTK_OBJECT (item)); - - item = parent; - } - - return finished; -} - -/* Key event handler for the canvas */ -static gint -e_canvas_key (GtkWidget *widget, GdkEventKey *event) -{ - GnomeCanvas *canvas; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - canvas = GNOME_CANVAS (widget); - - return emit_event (canvas, (GdkEvent *) event); -} - - -/** - * e_canvas_item_grab_focus: - * @item: A canvas item. - * - * Makes the specified item take the keyboard focus, so all keyboard events will - * be sent to it. If the canvas widget itself did not have the focus, it grabs - * it as well. - **/ -void -e_canvas_item_grab_focus (GnomeCanvasItem *item) -{ - GnomeCanvasItem *focused_item; - GdkEvent ev; - - g_return_if_fail (item != NULL); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - g_return_if_fail (GTK_WIDGET_CAN_FOCUS (GTK_WIDGET (item->canvas))); - - focused_item = item->canvas->focused_item; - - if (focused_item) { - ev.focus_change.type = GDK_FOCUS_CHANGE; - ev.focus_change.window = GTK_LAYOUT (item->canvas)->bin_window; - ev.focus_change.send_event = FALSE; - ev.focus_change.in = FALSE; - - emit_event (item->canvas, &ev); - } - - item->canvas->focused_item = item; - gtk_widget_grab_focus (GTK_WIDGET (item->canvas)); -} - -/* Focus in handler for the canvas */ -static gint -e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - - canvas = GNOME_CANVAS (widget); - - if (canvas->focused_item) - return emit_event (canvas, (GdkEvent *) event); - else - return FALSE; -} - -/* Focus out handler for the canvas */ -static gint -e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event) -{ - GnomeCanvas *canvas; - - canvas = GNOME_CANVAS (widget); - - if (canvas->focused_item) - return emit_event (canvas, (GdkEvent *) event); - else - return FALSE; -} diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h deleted file mode 100644 index 0ece5ae3b4..0000000000 --- a/widgets/misc/e-canvas.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-canvas.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CANVAS_H__ -#define __E_CANVAS_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ECanvas - A class derived from canvas for the purpose of adding - * evolution specific canvas hacks. - */ - -#define E_CANVAS_TYPE (e_canvas_get_type ()) -#define E_CANVAS(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_TYPE, ECanvas)) -#define E_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass)) -#define E_IS_CANVAS(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_TYPE)) -#define E_IS_CANVAS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_TYPE)) - - -typedef struct _ECanvas ECanvas; -typedef struct _ECanvasClass ECanvasClass; - -struct _ECanvas -{ - GnomeCanvas parent; - - /* item specific fields */ -}; - -struct _ECanvasClass -{ - GnomeCanvasClass parent_class; -}; - - -GtkType e_canvas_get_type (void); -GtkWidget *e_canvas_new (void); - -/* Used to send all of the keystroke events to a specific item as well as - * GDK_FOCUS_CHANGE events. - */ -void e_canvas_item_grab_focus (GnomeCanvasItem *item); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CANVAS_H__ */ diff --git a/widgets/misc/e-colors.c b/widgets/misc/e-colors.c deleted file mode 100644 index ba86538dab..0000000000 --- a/widgets/misc/e-colors.c +++ /dev/null @@ -1,74 +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 -#include -#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, gs_lavender; - -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_alloc_name ("lavender",&gs_lavender); - - color_inited = 1; -} diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h deleted file mode 100644 index 4a2cb74c73..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, gs_lavender; - -#endif /* GNUMERIC_COLOR_H */ diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c deleted file mode 100644 index 597c3c1787..0000000000 --- a/widgets/misc/e-cursors.c +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef GNUMERIC_CURSORS_H -#define GNUMERIC_CURSORS_H - -typedef enum { - GNUMERIC_CURSOR_FAT_CROSS, - GNUMERIC_CURSOR_THIN_CROSS, - GNUMERIC_CURSOR_ARROW, - GNUMERIC_CURSOR_MOVE, - GNUMERIC_CURSOR_ZOOM_IN, - GNUMERIC_CURSOR_ZOOM_OUT, - GNUMERIC_CURSOR_SIZE_X, - GNUMERIC_CURSOR_SIZE_Y, - GNUMERIC_CURSOR_SIZE_TL, - GNUMERIC_CURSOR_SIZE_TR, - GNUMERIC_CURSOR_PRESS, - GNUMERIC_CURSOR_HAND_OPEN, - GNUMERIC_CURSOR_HAND_CLOSED, - GNUMERIC_CURSOR_NUM_CURSORS -} CursorType; - -void cursors_init (void); -void cursors_shutdown (void); - -#define cursor_set(win, c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, cursor_get (c)); \ -} G_STMT_END - -#define cursor_set_widget(w, c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, cursor_get (c)); \ -} G_STMT_END - -GdkCursor *cursor_get (CursorType type); - -#endif /* GNUMERIC_CURSORS_H */ diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h deleted file mode 100644 index 597c3c1787..0000000000 --- a/widgets/misc/e-cursors.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef GNUMERIC_CURSORS_H -#define GNUMERIC_CURSORS_H - -typedef enum { - GNUMERIC_CURSOR_FAT_CROSS, - GNUMERIC_CURSOR_THIN_CROSS, - GNUMERIC_CURSOR_ARROW, - GNUMERIC_CURSOR_MOVE, - GNUMERIC_CURSOR_ZOOM_IN, - GNUMERIC_CURSOR_ZOOM_OUT, - GNUMERIC_CURSOR_SIZE_X, - GNUMERIC_CURSOR_SIZE_Y, - GNUMERIC_CURSOR_SIZE_TL, - GNUMERIC_CURSOR_SIZE_TR, - GNUMERIC_CURSOR_PRESS, - GNUMERIC_CURSOR_HAND_OPEN, - GNUMERIC_CURSOR_HAND_CLOSED, - GNUMERIC_CURSOR_NUM_CURSORS -} CursorType; - -void cursors_init (void); -void cursors_shutdown (void); - -#define cursor_set(win, c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, cursor_get (c)); \ -} G_STMT_END - -#define cursor_set_widget(w, c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, cursor_get (c)); \ -} G_STMT_END - -GdkCursor *cursor_get (CursorType type); - -#endif /* GNUMERIC_CURSORS_H */ diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c deleted file mode 100644 index 9387d5015d..0000000000 --- a/widgets/misc/e-gui-utils.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * GUI utility functions - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 1999 Miguel de Icaza - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include -#include "e-gui-utils.h" - -void -e_notice (GtkWindow *window, const char *type, const char *format, ...) -{ - GtkWidget *dialog; - va_list args; - char *str; - - va_start (args, format); - str = g_strdup_vprintf (format, args); - dialog = gnome_message_box_new (str, type, GNOME_STOCK_BUTTON_OK, NULL); - va_end (args); - g_free (str); - - if (window) - gnome_dialog_set_parent (GNOME_DIALOG (dialog), window); - - gnome_dialog_run (GNOME_DIALOG (dialog)); -} - -static void -kill_popup_menu (GtkWidget *widget, GtkMenu *menu) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - gtk_object_unref (GTK_OBJECT (menu)); -} - -void -e_auto_kill_popup_menu_on_hide (GtkMenu *menu) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - gtk_signal_connect (GTK_OBJECT (menu), "hide", - GTK_SIGNAL_FUNC (kill_popup_menu), menu); -} - -void -e_popup_menu (GtkMenu *menu, GdkEventButton *event) -{ - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - e_auto_kill_popup_menu_on_hide (menu); - gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button, event->time); -} - - diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h deleted file mode 100644 index b5518f032b..0000000000 --- a/widgets/misc/e-gui-utils.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef E_GUI_UTILS_H -#define E_GUI_UTILS_H - -#include -#include - -void e_popup_menu (GtkMenu *menu, GdkEventButton *event); -void e_auto_kill_popup_menu_on_hide (GtkMenu *menu); -void e_notice (GtkWindow *window, const char *type, const char *format, ...); - - -#endif /* E_GUI_UTILS_H */ diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c deleted file mode 100644 index 984e972f0c..0000000000 --- a/widgets/misc/e-reflow.c +++ /dev/null @@ -1,787 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include -#include "e-reflow.h" -#include "e-canvas-utils.h" -#include "e-util.h" -static void e_reflow_init (EReflow *card); -static void e_reflow_class_init (EReflowClass *klass); -static void e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_reflow_realize (GnomeCanvasItem *item); -static void e_reflow_unrealize (GnomeCanvasItem *item); -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags); -static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item); - -static void _update_reflow ( EReflow *reflow ); -static void _resize( GtkObject *object, gpointer data ); -static void _queue_reflow(EReflow *e_reflow); - -#define E_REFLOW_DIVIDER_WIDTH 2 -#define E_REFLOW_BORDER_WIDTH 7 -#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2) - -static GnomeCanvasGroupClass *parent_class = NULL; - -enum { - E_REFLOW_RESIZE, - E_REFLOW_LAST_SIGNAL -}; - -static guint e_reflow_signals[E_REFLOW_LAST_SIGNAL] = { 0 }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_MINIMUM_WIDTH, - ARG_WIDTH, - ARG_HEIGHT -}; - -GtkType -e_reflow_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EReflow", - sizeof (EReflow), - sizeof (EReflowClass), - (GtkClassInitFunc) e_reflow_class_init, - (GtkObjectInitFunc) e_reflow_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (gnome_canvas_group_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_reflow_class_init (EReflowClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - e_reflow_signals[E_REFLOW_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EReflowClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_reflow_signals, E_REFLOW_LAST_SIGNAL); - - gtk_object_add_arg_type ("EReflow::minimum_width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH); - gtk_object_add_arg_type ("EReflow::width", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_WIDTH); - gtk_object_add_arg_type ("EReflow::height", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_HEIGHT); - - object_class->set_arg = e_reflow_set_arg; - object_class->get_arg = e_reflow_get_arg; - /* object_class->destroy = e_reflow_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->event = e_reflow_event; - item_class->realize = e_reflow_realize; - item_class->unrealize = e_reflow_unrealize; - item_class->draw = e_reflow_draw; - item_class->update = e_reflow_update; - item_class->point = e_reflow_point; -} - -static void -e_reflow_init (EReflow *reflow) -{ - /* reflow->card = NULL;*/ - reflow->items = NULL; - reflow->columns = NULL; - reflow->column_width = 150; - - reflow->minimum_width = 10; - reflow->width = 10; - reflow->height = 10; - reflow->idle = 0; - - reflow->column_drag = FALSE; - - reflow->need_height_update = FALSE; - reflow->need_column_resize = FALSE; - - reflow->default_cursor_shown = TRUE; - reflow->arrow_cursor = NULL; - reflow->default_cursor = NULL; -} - -static void -e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EReflow *e_reflow; - - item = GNOME_CANVAS_ITEM (o); - e_reflow = E_REFLOW (o); - - switch (arg_id){ - case ARG_HEIGHT: - e_reflow->height = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - case ARG_MINIMUM_WIDTH: - e_reflow->minimum_width = GTK_VALUE_DOUBLE (*arg); - _queue_reflow(e_reflow); - break; - } -} - -static void -e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (object); - - switch (arg_id) { - case ARG_MINIMUM_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width; - break; - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_reflow->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_reflow->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_reflow_realize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - GnomeCanvasGroup *group; - GList *list; - GtkAdjustment *adjustment; - - e_reflow = E_REFLOW (item); - group = GNOME_CANVAS_GROUP( item ); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); - e_reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); - - for(list = e_reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM(list->data); - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - } - - _queue_reflow( e_reflow ); - - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - - if (!item->canvas->aa) { - } -} - -static void -e_reflow_unrealize (GnomeCanvasItem *item) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - if (!item->canvas->aa) - { - } - - gdk_cursor_destroy (e_reflow->arrow_cursor); - gdk_cursor_destroy (e_reflow->default_cursor); - - g_list_free (e_reflow->items); - g_list_free (e_reflow->columns); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static gint -e_reflow_pick_line (EReflow *e_reflow, double x) -{ - x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER; - return x; -} - -static gboolean -e_reflow_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EReflow *e_reflow; - - e_reflow = E_REFLOW (item); - - switch( event->type ) - { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - GList *list; - for (list = e_reflow->items; list; list = list->next) { - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - item = GNOME_CANVAS_ITEM(list->data); - gnome_canvas_item_set(item, - "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, - NULL); - return 1; - } else { - return 0; - } - } - } - } - break; - case GDK_BUTTON_PRESS: - switch(event->button.button) - { - case 1: - { - GdkEventButton *button = (GdkEventButton *) event; - double n_x; - n_x = button->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x); - e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2; - e_reflow->temp_column_width = e_reflow->column_width; - e_reflow->column_drag = TRUE; - - gnome_canvas_item_grab (item, - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - e_reflow->arrow_cursor, - button->time); - - e_reflow->previous_temp_column_width = -1; - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - return TRUE; - } - } - break; - case 4: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value -= adjustment->step_increment; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - case 5: - { - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - gdouble new_value = adjustment->value; - new_value += adjustment->step_increment; - if ( new_value > adjustment->upper - adjustment->page_size ) - new_value = adjustment->upper - adjustment->page_size; - gtk_adjustment_set_value(adjustment, new_value); - } - break; - } - break; - case GDK_BUTTON_RELEASE: - if (e_reflow->column_drag) { - gdouble old_width = e_reflow->column_width; - GdkEventButton *button = (GdkEventButton *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if ( e_reflow->temp_column_width < 50 ) - e_reflow->temp_column_width = 50; - e_reflow->column_drag = FALSE; - if ( old_width != e_reflow->temp_column_width ) { - gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width)); - e_reflow->column_width = e_reflow->temp_column_width; - adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2; - adjustment->page_increment = adjustment->page_size - adjustment->step_increment; - gtk_adjustment_changed(adjustment); - _queue_reflow(e_reflow); - } else { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - gnome_canvas_item_ungrab (item, button->time); - return TRUE; - } - break; - case GDK_MOTION_NOTIFY: - if (e_reflow->column_drag) { - double old_width = e_reflow->temp_column_width; - GdkEventMotion *motion = (GdkEventMotion *) event; - GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)); - e_reflow->temp_column_width = e_reflow->column_width + - (motion->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value)); - if (e_reflow->temp_column_width < 50) - e_reflow->temp_column_width = 50; - if (old_width != e_reflow->temp_column_width) { - e_reflow->need_column_resize = TRUE; - gnome_canvas_item_request_update(item); - } - return TRUE; - } else { - GdkEventMotion *motion = (GdkEventMotion *) event; - double n_x; - n_x = motion->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } else - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - - } - break; - case GDK_ENTER_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) { - if ( e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor); - e_reflow->default_cursor_shown = FALSE; - } - } - } - break; - case GDK_LEAVE_NOTIFY: - if (!e_reflow->column_drag) { - GdkEventCrossing *crossing = (GdkEventCrossing *) event; - double n_x; - n_x = crossing->x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) { - if ( ! e_reflow->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor); - e_reflow->default_cursor_shown = TRUE; - } - } - } - break; - default: - break; - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event) - return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event); - else - return 0; -} - -void -e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item) -{ - e_reflow->items = g_list_append(e_reflow->items, item); - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - gtk_signal_connect(GTK_OBJECT(item), - "resize", - GTK_SIGNAL_FUNC(_resize), - (gpointer) e_reflow); - gnome_canvas_item_set(item, - "width", (double) e_reflow->column_width, - NULL); - _queue_reflow(e_reflow); - } - -} - -static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - int x_rect, y_rect, width_rect, height_rect; - gdouble running_width; - EReflow *e_reflow = E_REFLOW(item); - int i; - double column_width; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw) - GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height); - column_width = e_reflow->column_width; - running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i = x; - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - NULL, - GTK_WIDGET(item->canvas), - "reflow", - x_rect - x, - y_rect - y, - width_rect, - height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - if (e_reflow->column_drag) { - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - i += start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - x_rect = running_width; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - /* Compute first column to draw. */ - i /= column_width + E_REFLOW_FULL_GUTTER; - running_width += i * (column_width + E_REFLOW_FULL_GUTTER); - - for ( ; i < e_reflow->column_count; i++) { - if ( running_width > x + width ) - break; - x_rect = running_width; - gdk_draw_rectangle(drawable, - GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL], - TRUE, - x_rect - x, - y_rect - y, - width_rect - 1, - height_rect - 1); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags) -{ - EReflow *e_reflow; - double x0, x1, y0, y1; - - e_reflow = E_REFLOW (item); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update) - GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags); - - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x1 < x0 + e_reflow->width ) - x1 = x0 + e_reflow->width; - if ( y1 < y0 + e_reflow->height ) - y1 = y0 + e_reflow->height; - item->x2 = x1; - item->y2 = y1; - - if (e_reflow->need_height_update) { - x0 = item->x1; - y0 = item->y1; - x1 = item->x2; - y1 = item->y2; - if ( x0 > 0 ) - x0 = 0; - if ( y0 > 0 ) - y0 = 0; - if ( x1 < E_REFLOW(item)->width ) - x1 = E_REFLOW(item)->width; - if ( x1 < E_REFLOW(item)->height ) - x1 = E_REFLOW(item)->height; - - gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1); - e_reflow->need_height_update = FALSE; - } else if (e_reflow->need_column_resize) { - int x_rect, y_rect, width_rect, height_rect; - int start_line = e_reflow_pick_line(e_reflow, - gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value); - gdouble running_width; - int i; - double column_width; - - if ( e_reflow->previous_temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->previous_temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - if ( e_reflow->temp_column_width != -1 ) { - running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER); - column_width = e_reflow->temp_column_width; - running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER); - running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - y_rect = E_REFLOW_BORDER_WIDTH; - width_rect = E_REFLOW_DIVIDER_WIDTH; - height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2); - - for ( i = 0; i < e_reflow->column_count; i++) { - x_rect = running_width; - gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect); - running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH; - } - } - - e_reflow->previous_temp_column_width = e_reflow->temp_column_width; - e_reflow->need_column_resize = FALSE; - } -} - -static double -e_reflow_point (GnomeCanvasItem *item, - double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - double distance = 1; - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point) - distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item); - if (*actual_item) - return 0; - - *actual_item = item; - return 0; -#if 0 - if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) { - float n_x; - n_x = x; - n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH; - n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER)); - if (n_x < E_REFLOW_FULL_GUTTER) { - *actual_item = item; - return 0; - } - } - return distance; -#endif -} - -static void -_reflow( EReflow *e_reflow ) -{ - gdouble running_height; - GList *list; - double item_height; - - if (e_reflow->columns) { - g_list_free (e_reflow->columns); - e_reflow->columns = NULL; - } - - e_reflow->column_count = 0; - - if (e_reflow->items == NULL) { - e_reflow->columns = NULL; - e_reflow->column_count = 1; - return; - } - - list = e_reflow->items; - - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count = 1; - - list = g_list_next(list); - - for ( ; list; list = g_list_next(list)) { - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) { - running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH; - e_reflow->columns = g_list_append (e_reflow->columns, list); - e_reflow->column_count ++; - } else { - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - } -} - -static void -_update_reflow( EReflow *e_reflow ) -{ - if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) { - - gdouble old_width; - gdouble running_width; - - _reflow (e_reflow); - - old_width = e_reflow->width; - - running_width = E_REFLOW_BORDER_WIDTH; - - if (e_reflow->items == NULL) { - } else { - GList *list; - GList *next_column; - gdouble item_height; - gdouble running_height; - - running_height = E_REFLOW_BORDER_WIDTH; - - list = e_reflow->items; - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - running_height += item_height + E_REFLOW_BORDER_WIDTH; - next_column = g_list_next(e_reflow->columns); - list = g_list_next(list); - - for( ; list; list = g_list_next(list)) { - gtk_object_set (GTK_OBJECT(list->data), - "width", e_reflow->column_width, - NULL); - gtk_object_get (GTK_OBJECT(list->data), - "height", &item_height, - NULL); - - if (next_column && (next_column->data == list)) { - next_column = g_list_next (next_column); - running_height = E_REFLOW_BORDER_WIDTH; - running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH; - } - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data), - (double) running_width, - (double) running_height); - - running_height += item_height + E_REFLOW_BORDER_WIDTH; - } - - } - e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH; - if ( e_reflow->width < e_reflow->minimum_width ) - e_reflow->width = e_reflow->minimum_width; - if (old_width != e_reflow->width) - gtk_signal_emit_by_name (GTK_OBJECT (e_reflow), "resize"); - } -} - - -static gboolean -_idle_reflow(gpointer data) -{ - EReflow *e_reflow = E_REFLOW(data); - _update_reflow(e_reflow); - e_reflow->need_height_update = TRUE; - gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(e_reflow)); - e_reflow->idle = 0; - return FALSE; -} - -static void -_queue_reflow(EReflow *e_reflow) -{ - if (e_reflow->idle == 0) - e_reflow->idle = g_idle_add(_idle_reflow, e_reflow); -} - -static void -_resize( GtkObject *object, gpointer data ) -{ - _queue_reflow(E_REFLOW(data)); -} diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h deleted file mode 100644 index 3a731474cb..0000000000 --- a/widgets/misc/e-reflow.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-reflow.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_REFLOW_H__ -#define __E_REFLOW_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EReflow - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * minimum_width double RW minimum width of the reflow. width >= minimum_width - * width double R width of the reflow - * height double RW height of the reflow - */ - -#define E_REFLOW_TYPE (e_reflow_get_type ()) -#define E_REFLOW(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_TYPE, EReflow)) -#define E_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass)) -#define E_IS_REFLOW(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_TYPE)) -#define E_IS_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE)) - - -typedef struct _EReflow EReflow; -typedef struct _EReflowClass EReflowClass; - -struct _EReflow -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - /* EBook *book; */ - - GList *items; /* Of type GnomeCanvasItem */ - GList *columns; /* Of type GList pointing to type GnomeCanvasItem (points into items) */ - gint column_count; /* Number of columnns */ - - double minimum_width; - double width; - double height; - - double column_width; - - int idle; - - /* These are all for when the column is being dragged. */ - gboolean column_drag; - gdouble start_x; - gint which_column_dragged; - double temp_column_width; - double previous_temp_column_width; - - guint need_height_update : 1; - guint need_column_resize : 1; - - guint default_cursor_shown : 1; - GdkCursor *arrow_cursor; - GdkCursor *default_cursor; -}; - -struct _EReflowClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EReflow *reflow); -}; - -/* To be added to a reflow, an item must have the arguments "x", "y", - and "width" as Read/Write arguments and "height" as a Read Only - argument. It must also have a "resize" signal. */ -void e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item); -GtkType e_reflow_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_REFLOW_H__ */ diff --git a/widgets/misc/pixmaps/cursor_cross.xpm b/widgets/misc/pixmaps/cursor_cross.xpm deleted file mode 100644 index cf9d0aca33..0000000000 --- a/widgets/misc/pixmaps/cursor_cross.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_cross_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ......+++++...... ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" ......+++++....... ", -" .....+++++....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ........ ", -" ....... ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_closed.xpm b/widgets/misc/pixmaps/cursor_hand_closed.xpm deleted file mode 100644 index 61a6de4b88..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_closed.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_hand_closed_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" .. ", -" ..++... ", -" .+++++++.. ", -" .+++++++++. ", -" ...+++++++++. ", -" .++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_open.xpm b/widgets/misc/pixmaps/cursor_hand_open.xpm deleted file mode 100644 index 048acc8054..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_open.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static char * cursor_hand_open_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" .. ", -" .. .++... ", -" .++..++.++. ", -" .++..++.++. . ", -" .++.++.++..+. ", -" .++.++.++.++. ", -" .. .+++++++.++. ", -" .++..++++++++++. ", -" .+++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_in.xpm b/widgets/misc/pixmaps/cursor_zoom_in.xpm deleted file mode 100644 index 1caf9e3e2a..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_in.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_in_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . ... . ", -" . ... . ", -" . ....... . ", -" . ....... . ", -" . ... . ", -" . ... .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_out.xpm b/widgets/misc/pixmaps/cursor_zoom_out.xpm deleted file mode 100644 index af1b698521..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_out.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static char * cursor_zoom_out_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . . ", -" . . ", -" . ....... . ", -" . ....... . ", -" . . ", -" . .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/shortcut-bar/.cvsignore b/widgets/shortcut-bar/.cvsignore deleted file mode 100644 index 41439d256d..0000000000 --- a/widgets/shortcut-bar/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -*.o -libshortcut-bar.a -Makefile -Makefile.in -.deps -.libs -test-shortcut-bar diff --git a/widgets/shortcut-bar/LICENSE b/widgets/shortcut-bar/LICENSE deleted file mode 100644 index f58649ad9b..0000000000 --- a/widgets/shortcut-bar/LICENSE +++ /dev/null @@ -1 +0,0 @@ -This code is licensed under the terms of the GNU GPL \ No newline at end of file diff --git a/widgets/shortcut-bar/Makefile.am b/widgets/shortcut-bar/Makefile.am deleted file mode 100644 index 54e6af0f5f..0000000000 --- a/widgets/shortcut-bar/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ - -noinst_LIBRARIES = libshortcut-bar.a -noinst_PROGRAMS = test-shortcut-bar - -INCLUDES = \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - $(EXTRA_GNOME_CFLAGS) - -libshortcut_bar_a_SOURCES = \ - e-clipped-label.c \ - e-clipped-label.h \ - e-group-bar.c \ - e-group-bar.h \ - e-icon-bar-bg-item.c \ - e-icon-bar-bg-item.h \ - e-icon-bar.c \ - e-icon-bar.h \ - e-shortcut-bar.c \ - e-shortcut-bar.h \ - e-vscrolled-bar.c \ - e-vscrolled-bar.h - -test_shortcut_bar_SOURCES = \ - test-shortcut-bar.c - -test_shortcut_bar_LDADD = \ - ./libshortcut-bar.a \ - ../e-text/libetext.a \ - ../../e-util/libeutil.a \ - $(EXTRA_GNOME_LIBS) - -test_shortcut_bar_LDFLAGS = \ - `gnome-config --libs gdk_pixbuf gnomecanvaspixbuf` diff --git a/widgets/shortcut-bar/e-clipped-label.c b/widgets/shortcut-bar/e-clipped-label.c deleted file mode 100644 index e6666ae451..0000000000 --- a/widgets/shortcut-bar/e-clipped-label.c +++ /dev/null @@ -1,361 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * This is similar to GtkLabel but clips itself and displays '...' if it - * can't fit inside its allocated area. The intended use is for inside buttons - * that are a fixed size. The GtkLabel would normally display only the middle - * part of the text, which doesn't look very good. This only supports one line - * of text (so no wrapping/justification), without underlined characters. - */ - -#include - -#include -#include -#include - -#include "e-clipped-label.h" - - -static void e_clipped_label_class_init (EClippedLabelClass *class); -static void e_clipped_label_init (EClippedLabel *label); -static void e_clipped_label_size_request (GtkWidget *widget, - GtkRequisition *requisition); -static void e_clipped_label_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gint e_clipped_label_expose (GtkWidget *widget, - GdkEventExpose *event); -static void e_clipped_label_recalc_chars_displayed (EClippedLabel *label); - - -static GtkMiscClass *parent_class; - -/* This is the string to draw when the label is clipped, e.g. '...'. */ -static gchar *e_clipped_label_ellipsis; - -/* Flags used in chars_displayed field. Must be negative. */ -#define E_CLIPPED_LABEL_NEED_RECALC -1 -#define E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL -2 - - -GtkType -e_clipped_label_get_type (void) -{ - static GtkType e_clipped_label_type = 0; - - if (!e_clipped_label_type){ - GtkTypeInfo e_clipped_label_info = { - "EClippedLabel", - sizeof (EClippedLabel), - sizeof (EClippedLabelClass), - (GtkClassInitFunc) e_clipped_label_class_init, - (GtkObjectInitFunc) e_clipped_label_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (GTK_TYPE_MISC); - e_clipped_label_type = gtk_type_unique (GTK_TYPE_MISC, - &e_clipped_label_info); - } - - return e_clipped_label_type; -} - - -static void -e_clipped_label_class_init (EClippedLabelClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - - /* Method override */ - widget_class->size_request = e_clipped_label_size_request; - widget_class->size_allocate = e_clipped_label_size_allocate; - widget_class->expose_event = e_clipped_label_expose; - - e_clipped_label_ellipsis = _("..."); -} - - -static void -e_clipped_label_init (EClippedLabel *label) -{ - GTK_WIDGET_SET_FLAGS (label, GTK_NO_WINDOW); - - label->label = NULL; - label->label_wc = NULL; - label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC; -} - - -/** - * e_clipped_label_new: - * - * @text: The label text. - * @Returns: A new #EClippedLabel. - * - * Creates a new #EClippedLabel with the given text. - **/ -GtkWidget * -e_clipped_label_new (const gchar *text) -{ - GtkWidget *label; - - label = GTK_WIDGET (gtk_type_new (e_clipped_label_get_type ())); - - if (text && *text) - e_clipped_label_set_text (E_CLIPPED_LABEL (label), text); - - return label; -} - - -static void -e_clipped_label_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - EClippedLabel *label; - GdkFont *font; - - g_return_if_fail (E_IS_CLIPPED_LABEL (widget)); - g_return_if_fail (requisition != NULL); - - label = E_CLIPPED_LABEL (widget); - font = widget->style->font; - - requisition->width = 0; - requisition->height = font->ascent + font->descent - + 2 * GTK_MISC (widget)->ypad; -} - - -static void -e_clipped_label_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EClippedLabel *label; - - label = E_CLIPPED_LABEL (widget); - - widget->allocation = *allocation; - - /* Flag that we need to recalculate how many characters to display. */ - label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC; -} - - -static gint -e_clipped_label_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - EClippedLabel *label; - GtkMisc *misc; - gint x, y; - GdkFont *font; - gchar *tmp_str, tmp_ch; - - g_return_val_if_fail (E_IS_CLIPPED_LABEL (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - label = E_CLIPPED_LABEL (widget); - misc = GTK_MISC (widget); - font = widget->style->font; - - /* If the label isn't visible or has no text, just return. */ - if (!GTK_WIDGET_VISIBLE (widget) || !GTK_WIDGET_MAPPED (widget) - || !label->label || (*label->label == '\0')) - return TRUE; - - /* Recalculate the number of characters displayed, if necessary. */ - if (label->chars_displayed == E_CLIPPED_LABEL_NEED_RECALC) - e_clipped_label_recalc_chars_displayed (label); - - /* - * GC Clipping - */ - gdk_gc_set_clip_rectangle (widget->style->white_gc, - &event->area); - gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state], - &event->area); - - y = floor (widget->allocation.y + (gint)misc->ypad - + (((gint)widget->allocation.height - 2 * (gint)misc->ypad - - (gint)font->ascent - font->descent) - * misc->yalign) + 0.5) + font->ascent; - - if (label->chars_displayed == E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL) { - x = floor (widget->allocation.x + (gint)misc->xpad - + (((gint)widget->allocation.width - - (gint)label->label_width - 2 * (gint)misc->xpad) - * misc->xalign) + 0.5); - - gtk_paint_string (widget->style, widget->window, widget->state, - &event->area, widget, "label", - x, y, label->label); - } else { - x = widget->allocation.x + (gint)misc->xpad; - - tmp_ch = label->label_wc[label->chars_displayed]; - label->label_wc[label->chars_displayed] = '\0'; - tmp_str = gdk_wcstombs (label->label_wc); - if (tmp_str) { - gtk_paint_string (widget->style, widget->window, - widget->state, &event->area, - widget, "label", - x, y, tmp_str); - g_free (tmp_str); - } - label->label_wc[label->chars_displayed] = tmp_ch; - - x = widget->allocation.x + (gint)misc->xpad - + label->ellipsis_x; - gtk_paint_string (widget->style, widget->window, widget->state, - &event->area, widget, "label", - x, y, e_clipped_label_ellipsis); - } - - gdk_gc_set_clip_mask (widget->style->white_gc, NULL); - gdk_gc_set_clip_mask (widget->style->fg_gc[widget->state], NULL); - - return TRUE; -} - - -/** - * e_clipped_label_get_text: - * - * @label: An #EClippedLabel. - * @Return: The label text. - * - * Returns the label text, or NULL. - **/ -gchar* -e_clipped_label_get_text (EClippedLabel *label) -{ - g_return_val_if_fail (E_IS_CLIPPED_LABEL (label), NULL); - - return label->label; -} - - -/** - * e_clipped_label_set_text: - * - * @label: An #EClippedLabel. - * @text: The new label text. - * - * Sets the label text. - **/ -void -e_clipped_label_set_text (EClippedLabel *label, - const gchar *text) -{ - gint len; - - g_return_if_fail (E_IS_CLIPPED_LABEL (label)); - - if (label->label != text || !label->label || !text - || strcmp (label->label, text)) { - g_free (label->label); - g_free (label->label_wc); - label->label = NULL; - label->label_wc = NULL; - - if (text) { - label->label = g_strdup (text); - len = strlen (text); - label->label_wc = g_new (GdkWChar, len + 1); - label->wc_len = gdk_mbstowcs (label->label_wc, - label->label, len + 1); - label->label_wc[label->wc_len] = '\0'; - } - - /* Reset the number of characters displayed, so it is - recalculated when needed. */ - label->chars_displayed = E_CLIPPED_LABEL_NEED_RECALC; - - /* We don't queue a resize, since the label should not affect - the widget size, but we queue a draw. */ - gtk_widget_queue_draw (GTK_WIDGET (label)); - } -} - - -static void -e_clipped_label_recalc_chars_displayed (EClippedLabel *label) -{ - GdkFont *font; - gint max_width, width, ch, last_width; - - font = GTK_WIDGET (label)->style->font; - - max_width = GTK_WIDGET (label)->allocation.width - - 2 * GTK_MISC (label)->xpad; - - if (!label->label) { - label->chars_displayed = 0; - return; - } - - /* See if the entire label fits in the allocated width. */ - label->label_width = gdk_string_width (font, label->label); - if (label->label_width <= max_width) { - label->chars_displayed = E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL; - return; - } - - /* Calculate the width of the ellipsis string. */ - max_width -= gdk_string_measure (font, e_clipped_label_ellipsis); - - if (max_width <= 0) { - label->chars_displayed = 0; - label->ellipsis_x = 0; - return; - } - - /* Step through the wide-char label, adding on the widths of the - characters, until we can't fit any more in. */ - width = last_width = 0; - for (ch = 0; ch < label->wc_len; ch++) { - width += gdk_char_width_wc (font, label->label_wc[ch]); - - if (width > max_width) { - label->chars_displayed = ch; - label->ellipsis_x = last_width; - return; - } - - last_width = width; - } - - g_warning ("Clipped label width not exceeded as expected"); - label->chars_displayed = E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL; -} - diff --git a/widgets/shortcut-bar/e-clipped-label.h b/widgets/shortcut-bar/e-clipped-label.h deleted file mode 100644 index a21ceadeca..0000000000 --- a/widgets/shortcut-bar/e-clipped-label.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * This is similar to GtkLabel but clips itself and displays '...' if it - * can't fit inside its allocated area. The intended use is for inside buttons - * that are a fixed size. The GtkLabel would normally display only the middle - * part of the text, which doesn't look very good. This only supports one line - * of text (so no wrapping/justification), without underlined characters. - */ -#ifndef _E_CLIPPED_LABEL_H_ -#define _E_CLIPPED_LABEL_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define E_CLIPPED_LABEL(obj) GTK_CHECK_CAST (obj, e_clipped_label_get_type (), EClippedLabel) -#define E_CLIPPED_LABEL_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_clipped_label_get_type (), EClippedLabelClass) -#define E_IS_CLIPPED_LABEL(obj) GTK_CHECK_TYPE (obj, e_clipped_label_get_type ()) - - -typedef struct _EClippedLabel EClippedLabel; -typedef struct _EClippedLabelClass EClippedLabelClass; - -struct _EClippedLabel -{ - GtkMisc misc; - - gchar *label; - GdkWChar *label_wc; - - /* This is the number of wide characters in the label. */ - gint wc_len; - - /* This is the width of the entire label string, in pixels. */ - gint label_width; - - /* This is the number of characters we can fit in, or - E_CLIPPED_LABEL_NEED_RECALC if it needs to be recalculated, or - E_CLIPPED_LABEL_SHOW_ENTIRE_LABEL to show the entire label. */ - gint chars_displayed; - - /* This is the x position to display the ellipsis string, e.g. '...', - relative to the start of the label. */ - gint ellipsis_x; -}; - -struct _EClippedLabelClass -{ - GtkMiscClass parent_class; -}; - - -GtkType e_clipped_label_get_type (void); -GtkWidget* e_clipped_label_new (const gchar *text); - -gchar* e_clipped_label_get_text (EClippedLabel *label); -void e_clipped_label_set_text (EClippedLabel *label, - const gchar *text); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_CLIPPED_LABEL_H_ */ diff --git a/widgets/shortcut-bar/e-group-bar.c b/widgets/shortcut-bar/e-group-bar.c deleted file mode 100644 index de6c0cbbaf..0000000000 --- a/widgets/shortcut-bar/e-group-bar.c +++ /dev/null @@ -1,1496 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * ShortcutBar displays a vertical bar with a number of Groups, each of which - * contains any number of icons. It is used on the left of the main application - * window so users can easily access items such as folders and files. - */ - -#include - -#include - -#include "e-group-bar.h" - -#define E_GROUP_BAR_SCROLL_TIMEOUT 10 -#define E_GROUP_BAR_MIN_STEP_SIZE 4 - -#define E_GROUP_BAR_AUTO_SHOW_TIMEOUT 300 - - -static void e_group_bar_class_init (EGroupBarClass *class); -static void e_group_bar_init (EGroupBar *group_bar); -static void e_group_bar_destroy (GtkObject *object); -static void e_group_bar_realize (GtkWidget *widget); -static void e_group_bar_unrealize (GtkWidget *widget); -static void e_group_bar_map (GtkWidget *widget); -static void e_group_bar_unmap (GtkWidget *widget); -static void e_group_bar_size_request (GtkWidget *widget, - GtkRequisition *requisition); -static void e_group_bar_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gint e_group_bar_expose (GtkWidget *widget, - GdkEventExpose *event); -static void e_group_bar_draw (GtkWidget *widget, - GdkRectangle *area); -static void e_group_bar_add (GtkContainer *container, - GtkWidget *widget); -static void e_group_bar_remove (GtkContainer *container, - GtkWidget *widget); -static void e_group_bar_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); - -static void e_group_bar_create_group_button_window (EGroupBar *group_bar, - gint group_num); -static void e_group_bar_create_group_child_window (EGroupBar *group_bar, - gint group_num); -static gint e_group_bar_get_group_button_position (EGroupBar *group_bar, - gint group_num); -static gint e_group_bar_sum_button_heights (EGroupBar *group_bar, - gint first, - gint last); -static gint e_group_bar_get_child_height (EGroupBar *group_bar); -static gint e_group_bar_get_group_child_position (EGroupBar *group_bar, - gint group_num); - -static void e_group_bar_on_button_clicked (GtkWidget *group_button, - EGroupBar *group_bar); -static gint e_group_bar_find_button (EGroupBar *group_bar, - GtkWidget *group_button); -static void e_group_bar_start_animation (EGroupBar *group_bar, - gint group_num); -static gboolean e_group_bar_timeout_handler (gpointer data); -static gint e_group_bar_get_increment (EGroupBar *group_bar, - gint window_y, - gint window_target_y); -static gboolean e_group_bar_on_button_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - EGroupBar *group_bar); -static void e_group_bar_on_button_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint time, - EGroupBar *group_bar); -static gboolean e_group_bar_auto_show (gpointer data); -static void e_group_bar_stop_all_animation (EGroupBar *group_bar); - - -static GtkContainerClass *parent_class; - - -GtkType -e_group_bar_get_type (void) -{ - static GtkType e_group_bar_type = 0; - - if (!e_group_bar_type){ - GtkTypeInfo e_group_bar_info = { - "EGroupBar", - sizeof (EGroupBar), - sizeof (EGroupBarClass), - (GtkClassInitFunc) e_group_bar_class_init, - (GtkObjectInitFunc) e_group_bar_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (GTK_TYPE_CONTAINER); - e_group_bar_type = gtk_type_unique (GTK_TYPE_CONTAINER, - &e_group_bar_info); - } - - return e_group_bar_type; -} - - -static void -e_group_bar_class_init (EGroupBarClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - GtkContainerClass *container_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - container_class = (GtkContainerClass *) class; - - /* Method override */ - object_class->destroy = e_group_bar_destroy; - - widget_class->realize = e_group_bar_realize; - widget_class->unrealize = e_group_bar_unrealize; - widget_class->map = e_group_bar_map; - widget_class->unmap = e_group_bar_unmap; - widget_class->size_request = e_group_bar_size_request; - widget_class->size_allocate = e_group_bar_size_allocate; - widget_class->expose_event = e_group_bar_expose; - widget_class->draw = e_group_bar_draw; - - container_class->add = e_group_bar_add; - container_class->remove = e_group_bar_remove; - container_class->forall = e_group_bar_forall; -} - - -static void -e_group_bar_init (EGroupBar *group_bar) -{ - - GTK_WIDGET_UNSET_FLAGS (group_bar, GTK_NO_WINDOW); - - /* We don't want child resizes to propagate up to the parent. */ - gtk_container_set_resize_mode (GTK_CONTAINER (group_bar), - GTK_RESIZE_QUEUE); - - group_bar->children = g_array_new (FALSE, FALSE, - sizeof (EGroupBarChild)); - - group_bar->current_group_num = -1; - group_bar->buttons_homogeneous = TRUE; - group_bar->max_button_height = 0; - group_bar->animation_timeout_id = 0; -} - - -/** - * e_group_bar_new: - * @Returns: a new #EGroupBar. - * - * Creates a new #EGroupBar. - **/ -GtkWidget * -e_group_bar_new (void) -{ - GtkWidget *group_bar; - - group_bar = GTK_WIDGET (gtk_type_new (e_group_bar_get_type ())); - - return group_bar; -} - - -static void -e_group_bar_destroy (GtkObject *object) -{ - EGroupBar *group_bar; - - group_bar = E_GROUP_BAR (object); - - e_group_bar_stop_all_animation (group_bar); - - /* The parent GtkContainer class will automatically destroy all the - child widgets, but it calls gtk_container_foreach() so we must not - destroy our children array until after. */ - GTK_OBJECT_CLASS (parent_class)->destroy (object); - - g_array_free (group_bar->children, TRUE); -} - - -static void -e_group_bar_realize (GtkWidget *widget) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - GdkWindowAttr attributes; - gint attributes_mask; - gint border_width, group_num; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_GROUP_BAR (widget)); - - group_bar = E_GROUP_BAR (widget); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); - - border_width = GTK_CONTAINER (group_bar)->border_width; - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x + border_width; - attributes.y = widget->allocation.y + border_width; - attributes.width = widget->allocation.width - 2 * border_width; - attributes.height = widget->allocation.height - 2 * border_width; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); - attributes.event_mask = gtk_widget_get_events (widget); - attributes.event_mask |= (GDK_EXPOSURE_MASK); - - attributes_mask = GDK_WA_X | GDK_WA_Y - | GDK_WA_VISUAL | GDK_WA_COLORMAP; - - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), - &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, widget); - - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, - GTK_STATE_NORMAL); - - gdk_window_set_back_pixmap (widget->window, NULL, TRUE); - - /* Create windows for all the buttons & group canvases. */ - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - e_group_bar_create_group_button_window (group_bar, group_num); - e_group_bar_create_group_child_window (group_bar, group_num); - } -} - - -static void -e_group_bar_unrealize (GtkWidget *widget) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_GROUP_BAR (widget)); - - group_bar = E_GROUP_BAR (widget); - - /* Destroy the windows for all the buttons & group canvases. */ - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->button_window) { - gdk_window_set_user_data (group->button_window, NULL); - gdk_window_destroy (group->button_window); - group->button_window = NULL; - } - if (group->child_window) { - gdk_window_set_user_data (group->child_window, NULL); - gdk_window_destroy (group->child_window); - group->child_window = NULL; - } - } - - if (GTK_WIDGET_CLASS (parent_class)->unrealize) - (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget); -} - - -static void -e_group_bar_map (GtkWidget *widget) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_GROUP_BAR (widget)); - - group_bar = E_GROUP_BAR (widget); - - GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); - - /* We do this in reverse order, and lower all the child windows, so - the stacking order ends up correct. */ - for (group_num = group_bar->children->len - 1; - group_num >= 0; - group_num--) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->button_window) { - gdk_window_show (group->button_window); - } - - if (group->button - && GTK_WIDGET_VISIBLE (group->button) - && !GTK_WIDGET_MAPPED (group->button)) { - gtk_widget_map (group->button); - } - - if (group->child_window) { - gdk_window_show (group->child_window); - gdk_window_lower (group->child_window); - } - - if (group->child - && GTK_WIDGET_VISIBLE (group->child) - && !GTK_WIDGET_MAPPED (group->child)) - gtk_widget_map (group->child); - } - - gdk_window_show (widget->window); -} - - -static void -e_group_bar_unmap (GtkWidget *widget) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_GROUP_BAR (widget)); - - group_bar = E_GROUP_BAR (widget); - - GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED); - - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->button_window) { - gdk_window_hide (group->button_window); - } - - if (group->button - && GTK_WIDGET_MAPPED (group->button)) - gtk_widget_unmap (group->button); - - if (group->child_window) { - gdk_window_hide (group->child_window); - } - - if (group->child - && GTK_WIDGET_MAPPED (group->child)) - gtk_widget_unmap (group->child); - } - - gdk_window_hide (widget->window); -} - - -static void -e_group_bar_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num, max_child_height; - GtkRequisition child_requisition; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_GROUP_BAR (widget)); - g_return_if_fail (requisition != NULL); - - group_bar = E_GROUP_BAR (widget); - - /* We set the requisition width to the largest requested width of the - child widgets. The requisition height is set to the sum of all the - button heights plus the height of the largest child. */ - requisition->width = 0; - requisition->height = 0; - - /* We have to call size_request on all children, even though we don't - use the results, since some widgets like GtkLabel depend on it. */ - group_bar->max_button_height = 0; - max_child_height = 0; - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->button) { - gtk_widget_size_request (group->button, - &child_requisition); - group->button_height = child_requisition.height; - } else { - group->button_height = 0; - } - - group_bar->max_button_height = MAX (group_bar->max_button_height, group->button_height); - requisition->height += child_requisition.height; - - if (group->child) { - gtk_widget_size_request (group->child, - &child_requisition); - max_child_height = MAX (max_child_height, - child_requisition.height); - requisition->width = MAX (requisition->width, - child_requisition.width); - } - } - - requisition->height += max_child_height; - - /* Add on the standard container border widths. */ - requisition->width += GTK_CONTAINER (widget)->border_width * 2; - requisition->height += GTK_CONTAINER (widget)->border_width * 2; -} - - -static void -e_group_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num, border_width, width, height, child_height, y; - GtkAllocation button_allocation, child_allocation; - - group_bar = E_GROUP_BAR (widget); - - /* All child & button windows and widgets use the same width as the - group bar minus the border width. */ - border_width = GTK_CONTAINER (widget)->border_width; - width = allocation->width - border_width * 2; - height = allocation->height - border_width * 2; - - widget->allocation = *allocation; - if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, - allocation->x + border_width, - allocation->y + border_width, - width, height); - - /* All the child widgets use the same height. */ - child_height = e_group_bar_get_child_height (group_bar); - - /* The buttons are always in the top-left of the button windows, and - all have the same width. The height is calculated for each group. */ - button_allocation.x = 0; - button_allocation.y = 0; - button_allocation.width = width; - - /* The child widgets are always in the top-left of the child windows, - and all have the same width and height. */ - child_allocation.x = 0; - child_allocation.y = 0; - child_allocation.width = width; - child_allocation.height = child_height; - - /* Step through the groups, placing the windows as necessary, and - allocating the areas for the child widgets. Note that if a button - or child window is in the middle of an animation, we just resize it - and update the target position, and let the animation continue. */ - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - /* Calculate the y position of the button, which depends on - the currently selected group and the button heights. */ - y = e_group_bar_get_group_button_position (group_bar, group_num); - button_allocation.height = group_bar->buttons_homogeneous ? group_bar->max_button_height : group->button_height; - - if (GTK_WIDGET_REALIZED (group->button)) { - if (group->button_window_in_animation) { - gdk_window_resize (group->button_window, - width, button_allocation.height); - group->button_window_target_y = y; - } else { - gdk_window_move_resize (group->button_window, - 0, y, width, button_allocation.height); - } - } - gtk_widget_size_allocate (group->button, &button_allocation); - - if (GTK_WIDGET_REALIZED (group->child)) { - if (group->child_window_in_animation) { - gdk_window_resize (group->child_window, - width, child_height); - group->child_window_target_y = y + button_allocation.height; - } else { - gdk_window_move_resize (group->child_window, - 0, y + button_allocation.height, - width, child_height); - } - } - gtk_widget_size_allocate (group->child, &child_allocation); - } -} - - -static gint -e_group_bar_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - GdkEventExpose child_event; - gint group_num; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (E_IS_GROUP_BAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - if (GTK_WIDGET_DRAWABLE (widget)) { - group_bar = E_GROUP_BAR (widget); - - child_event = *event; - - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (event->window == group->button_window - && GTK_WIDGET_DRAWABLE (group->button) - && GTK_WIDGET_NO_WINDOW (group->button) - && gtk_widget_intersect (group->button, &event->area, &child_event.area)) - gtk_widget_event (group->button, (GdkEvent*) &child_event); - - if (event->window == group->child_window - && GTK_WIDGET_DRAWABLE (group->child) - && GTK_WIDGET_NO_WINDOW (group->child) - && gtk_widget_intersect (group->child, &event->area, &child_event.area)) - gtk_widget_event (group->child, (GdkEvent*) &child_event); - } - } - - return FALSE; -} - - -static void -e_group_bar_draw (GtkWidget *widget, - GdkRectangle *area) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_GROUP_BAR (widget)); - - if (GTK_WIDGET_DRAWABLE (widget)) { - group_bar = E_GROUP_BAR (widget); - - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (GTK_WIDGET_DRAWABLE (group->button) - && gtk_widget_intersect (group->button, area, &child_area)) - gtk_widget_draw (group->button, &child_area); - - if (GTK_WIDGET_DRAWABLE (group->child) - && gtk_widget_intersect (group->child, area, &child_area)) - gtk_widget_draw (group->child, &child_area); - } - } -} - - -static void -e_group_bar_add (GtkContainer *container, - GtkWidget *widget) -{ - EGroupBar *group_bar; - GtkWidget *button; - gchar buffer[32]; - - g_return_if_fail (container != NULL); - g_return_if_fail (E_IS_GROUP_BAR (container)); - g_return_if_fail (widget != NULL); - - g_snprintf (buffer, sizeof (buffer), _("Group %i"), - group_bar->children->len + 1); - button = gtk_button_new_with_label (buffer); - gtk_widget_show (button); - - e_group_bar_add_group (group_bar, widget, button, -1); -} - - -static void -e_group_bar_remove (GtkContainer *container, - GtkWidget *widget) -{ - EGroupBar *group_bar; - gint group_num; - - g_return_if_fail (container != NULL); - g_return_if_fail (E_IS_GROUP_BAR (container)); - g_return_if_fail (widget != NULL); - - group_bar = E_GROUP_BAR (container); - - group_num = e_group_bar_get_group_num (group_bar, widget); - e_group_bar_remove_group (group_bar, group_num); -} - - -static void -e_group_bar_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num; - GList *tmp_list; - - g_return_if_fail (container != NULL); - g_return_if_fail (E_IS_GROUP_BAR (container)); - g_return_if_fail (callback != NULL); - - group_bar = E_GROUP_BAR (container); - - /* Note that drag-and-drop does not check the Z-order of widgets, so - we have to iterate through them from top to bottom, or it will - not work properly. We also have to use temporary lists so widgets - can be safely destroyed while iterating. */ - - if (include_internals) { - tmp_list = NULL; - for (group_num = group_bar->children->len - 1; - group_num >= 0; - group_num--) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->button) - tmp_list = g_list_prepend (tmp_list, - group->button); - } - - g_list_foreach (tmp_list, (GFunc) callback, callback_data); - g_list_free (tmp_list); - } - - tmp_list = NULL; - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->child) - tmp_list = g_list_prepend (tmp_list, group->child); - } - g_list_foreach (tmp_list, (GFunc) callback, callback_data); - g_list_free (tmp_list); -} - - -static void -e_group_bar_create_group_button_window (EGroupBar *group_bar, - gint group_num) -{ - EGroupBarChild *group; - GtkWidget *widget; - GdkWindowAttr attributes; - gint attributes_mask; - gint y, height, border_width; - - widget = GTK_WIDGET (group_bar); - - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - y = e_group_bar_get_group_button_position (group_bar, group_num); - height = group_bar->buttons_homogeneous ? group_bar->max_button_height - : group->button_height; - border_width = GTK_CONTAINER (group_bar)->border_width; - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = 0; - attributes.y = y; - attributes.width = widget->allocation.width - 2 * border_width; - attributes.height = height; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); - attributes.event_mask = gtk_widget_get_events (widget); - attributes.event_mask |= (GDK_EXPOSURE_MASK); - - attributes_mask = GDK_WA_X | GDK_WA_Y - | GDK_WA_VISUAL | GDK_WA_COLORMAP; - - group->button_window = gdk_window_new (widget->window, &attributes, - attributes_mask); - gdk_window_set_user_data (group->button_window, widget); - - gtk_widget_set_parent_window (group->button, - group->button_window); - gdk_window_set_back_pixmap (group->button_window, NULL, TRUE); -} - - -static void -e_group_bar_create_group_child_window (EGroupBar *group_bar, - gint group_num) -{ - EGroupBarChild *group; - GtkWidget *widget; - GdkWindowAttr attributes; - gint attributes_mask; - gint y, height, border_width; - - widget = GTK_WIDGET (group_bar); - - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - y = e_group_bar_get_group_button_position (group_bar, group_num); - y += group_bar->buttons_homogeneous ? group_bar->max_button_height - : group->button_height; - height = e_group_bar_get_child_height (group_bar); - border_width = GTK_CONTAINER (group_bar)->border_width; - - attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = 0; - attributes.y = y; - attributes.width = widget->allocation.width - 2 * border_width; - attributes.height = height; - attributes.wclass = GDK_INPUT_OUTPUT; - attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); - attributes.event_mask = gtk_widget_get_events (widget); - attributes.event_mask |= (GDK_EXPOSURE_MASK); - - attributes_mask = GDK_WA_X | GDK_WA_Y - | GDK_WA_VISUAL | GDK_WA_COLORMAP; - - group->child_window = gdk_window_new (widget->window, &attributes, - attributes_mask); - gdk_window_set_user_data (group->child_window, widget); - - gtk_widget_set_parent_window (GTK_WIDGET (group->child), - group->child_window); - gdk_window_set_back_pixmap (group->child_window, NULL, TRUE); -} - - -/* This returns the y position of a group's button within the EGroupBar window. - */ -static gint -e_group_bar_get_group_button_position (EGroupBar *group_bar, - gint group_num) -{ - gint border_width, window_height, y; - - border_width = GTK_CONTAINER (group_bar)->border_width; - window_height = GTK_WIDGET (group_bar)->allocation.height - 2 * border_width; - - if (group_num <= group_bar->current_group_num) - y = e_group_bar_sum_button_heights (group_bar, 0, group_num - 1); - else - y = window_height - e_group_bar_sum_button_heights (group_bar, group_num, group_bar->children->len - 1); - - return y; -} - - -/* This returns the sum of all the buttons from first to last inclusive. */ -static gint -e_group_bar_sum_button_heights (EGroupBar *group_bar, gint first, gint last) -{ - EGroupBarChild *group; - gint height, group_num; - - height = 0; - - if (group_bar->buttons_homogeneous) - return (last - first + 1) * group_bar->max_button_height; - - for (group_num = first; group_num <= last; group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - height += group->button_height; - } - - return height; -} - - -static gint -e_group_bar_get_group_child_position (EGroupBar *group_bar, - gint group_num) -{ - EGroupBarChild *group; - gint y; - - y = e_group_bar_get_group_button_position (group_bar, group_num); - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - y += group_bar->buttons_homogeneous ? group_bar->max_button_height - : group->button_height; - - return y; -} - - -static gint -e_group_bar_get_child_height (EGroupBar *group_bar) -{ - EGroupBarChild *group; - gint group_num; - - /* Start with the allocated height of the EGroupBar, less the border.*/ - group_bar->child_height = GTK_WIDGET (group_bar)->allocation.height; - group_bar->child_height -= 2 * GTK_CONTAINER (group_bar)->border_width; - - /* Now subtract the heights of all the buttons. */ - if (group_bar->buttons_homogeneous) { - group_bar->child_height -= group_bar->children->len * group_bar->max_button_height; - } else { - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - group_bar->child_height -= group->button_height; - } - } - - return group_bar->child_height; -} - - -/* - * Insertion, reordering and deletion of items. - */ - -/** - * e_group_bar_add_group: - * @group_bar: an #EGroupBar. - * @child: the child widget to add. - * @button: the button used to show the child widget. - * @position: the new group's position, or -1 to place it last. - * @Returns: the position of the new group. - * - * Adds a new group to a #EGroupBar at the given position. - **/ -gint -e_group_bar_add_group (EGroupBar *group_bar, - GtkWidget *child, - GtkWidget *button, - gint position) -{ - EGroupBarChild *group, empty_group, *tmp_group; - gint group_num, tmp_group_num; - - g_return_val_if_fail (group_bar != NULL, -1); - g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), -1); - g_return_val_if_fail (child != NULL, -1); - g_return_val_if_fail (button != NULL, -1); - g_return_val_if_fail (GTK_IS_BUTTON (button), -1); - - /* Append an empty group to the children array and get a pointer to - it, so we can use it like a normal group. */ - group_num = group_bar->children->len; - g_array_append_val (group_bar->children, empty_group); - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - /* Initialize the group. */ - group->button = button; - group->button_window = NULL; - group->child = child; - group->child_window = NULL; - group->button_window_in_animation = FALSE; - group->child_window_in_animation = FALSE; - group->button_window_target_y = 0; - group->child_window_target_y = 0; - - /* If we don't have a current group, set it to the first one. */ - if (group_bar->current_group_num == -1) - group_bar->current_group_num = 0; - - /* If the EGroupBar widget is realize, we need to create the child - windows to put the button & child in. */ - if (GTK_WIDGET_REALIZED (group_bar)) { - e_group_bar_create_group_button_window (group_bar, group_num); - e_group_bar_create_group_child_window (group_bar, group_num); - - /* We need to lower all the child windows of the previous - groups, in reverse order, to keep the stacking order - correct. */ - for (tmp_group_num = group_num - 1; - tmp_group_num >= 0; - tmp_group_num--) { - tmp_group = &g_array_index (group_bar->children, - EGroupBarChild, - tmp_group_num); - gdk_window_lower (group->child_window); - } - } - - gtk_widget_set_parent (group->button, GTK_WIDGET (group_bar)); - gtk_widget_set_parent (group->child, GTK_WIDGET (group_bar)); - - if (GTK_WIDGET_REALIZED (group_bar)) { - gtk_widget_realize (group->button); - gtk_widget_realize (group->child); - } - - if (GTK_WIDGET_VISIBLE (group_bar) - && GTK_WIDGET_MAPPED (group_bar)) { - if (group->button - && GTK_WIDGET_VISIBLE (group->button) - && !GTK_WIDGET_MAPPED (group->button)) { - gtk_widget_map (group->button); - gtk_widget_queue_resize (group->button); - } - if (group->child - && GTK_WIDGET_VISIBLE (group->child) - && !GTK_WIDGET_MAPPED (group->child)) { - gtk_widget_map (group->child); - gtk_widget_queue_resize (group->child); - } - } - - gtk_signal_connect (GTK_OBJECT (group->button), "clicked", - GTK_SIGNAL_FUNC (e_group_bar_on_button_clicked), - group_bar); - - gtk_signal_connect (GTK_OBJECT (group->button), "drag_motion", - GTK_SIGNAL_FUNC (e_group_bar_on_button_drag_motion), - group_bar); - gtk_signal_connect (GTK_OBJECT (group->button), "drag_leave", - GTK_SIGNAL_FUNC (e_group_bar_on_button_drag_leave), - group_bar); - - return group_num; -} - - -/** - * e_group_bar_reorder_group: - * @group_bar: an #EGroupBar. - * @group_num: the index of the group to move. - * @new_position: the new position of the group. - * - * Moves a group to a new position within the #EGroupBar. - **/ -void -e_group_bar_reorder_group (EGroupBar *group_bar, - gint group_num, - gint new_position) -{ - g_return_if_fail (E_IS_GROUP_BAR (group_bar)); - -} - - -/** - * e_group_bar_remove_group: - * @group_bar: an #EGroupBar. - * @group_num: the index of the group to remove. - * - * Removes a group from an #EGroupBar. - **/ -void -e_group_bar_remove_group (EGroupBar *group_bar, - gint group_num) -{ - EGroupBarChild *group; - - g_return_if_fail (E_IS_GROUP_BAR (group_bar)); - g_return_if_fail (group_num >= 0); - g_return_if_fail (group_num < group_bar->children->len); - - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - /* Stop any animation. */ - e_group_bar_stop_all_animation (group_bar); - - gtk_widget_unparent (group->child); - if (group->button) - gtk_widget_unparent (group->button); - - if (group->button_window) { - gdk_window_set_user_data (group->button_window, NULL); - gdk_window_destroy (group->button_window); - } - if (group->child_window) { - gdk_window_set_user_data (group->child_window, NULL); - gdk_window_destroy (group->child_window); - } - - g_array_remove_index (group_bar->children, group_num); - - /* Make sure the current group is valid. */ - if (group_bar->current_group_num >= group_bar->children->len) - group_bar->current_group_num = group_bar->children->len - 1; - - gtk_widget_queue_resize (GTK_WIDGET (group_bar)); -} - - -/* - * Getting & setting the current group. - */ - -/** - * e_group_bar_get_current_group_num: - * @group_bar: an #EGroupBar. - * @Returns: the index of the group currently displayed. - * - * Returns the index of the group currently displayed. - **/ -gint -e_group_bar_get_current_group_num (EGroupBar *group_bar) -{ - g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), -1); - - return group_bar->current_group_num; -} - - -/** - * e_group_bar_set_current_group_num: - * @group_bar: an #EGroupBar. - * @Returns: the index of the group to display. - * - * Sets the group to display. - **/ -/* FIXME: animate option? May want to set group without animation. */ -void -e_group_bar_set_current_group_num (EGroupBar *group_bar, - gint group_num) -{ - g_return_if_fail (E_IS_GROUP_BAR (group_bar)); - - /* If that already is the current group, just return. */ - if (group_bar->current_group_num == group_num) - return; - - /* FIXME: Set the target positions of the old current group and the - new current group, map the new group's child window, and create the - animation timeout, if we haven't already got one. */ - - group_bar->current_group_num = group_num; - -} - - -/* - * Getting groups and group numbers. - */ - -/** - * e_group_bar_get_nth_group: - * @group_bar: an #EGroupBar. - * @group_num: the index of the group to get. - * @Returns: the child widget at the given index. - * - * Returns the child widget at the given index. - **/ -GtkWidget* -e_group_bar_get_nth_group (EGroupBar *group_bar, - gint group_num) -{ - EGroupBarChild *group; - - g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), NULL); - g_return_val_if_fail (group_num >= 0, NULL); - g_return_val_if_fail (group_num < group_bar->children->len, NULL); - - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - return group->child; -} - - -/** - * e_group_bar_get_group_num: - * @group_bar: an #EGroupBar. - * @child: the child widget to find. - * @Returns: the index of the group containing the given widget. - * - * Returns the index of the group containing the given child widget. - **/ -gint -e_group_bar_get_group_num (EGroupBar *group_bar, - GtkWidget *child) -{ - EGroupBarChild *group; - gint group_num; - - g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), -1); - g_return_val_if_fail (child != NULL, -1); - - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->child == child) - return group_num; - } - - return -1; -} - - -/** - * e_group_bar_set_group_button_label: - * @group_bar: an #EGroupBar. - * @group_num: the index of the group. - * @label: the label widget to place in the group's button. - * - * Sets the label widget for the given group's button, replacing any existing - * widget in the button. - **/ -void -e_group_bar_set_group_button_label (EGroupBar *group_bar, - gint group_num, - GtkWidget *label) -{ - EGroupBarChild *group; - GtkWidget *button_child; - - g_return_if_fail (E_IS_GROUP_BAR (group_bar)); - g_return_if_fail (group_num >= 0); - g_return_if_fail (group_num < group_bar->children->len); - - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - button_child = GTK_BIN (group->button)->child; - if (button_child) { - gtk_container_remove (GTK_CONTAINER (group->button), - button_child); - } - - if (label) - gtk_container_add (GTK_CONTAINER (group->button), label); -} - - -/* - * Getting & setting the EGroupBar options. - */ - -/** - * e_group_bar_get_buttons_homogeneous: - * @group_bar: an #EGroupBar. - * @Returns: TRUE if the buttons are homoegeneous. - * - * Returns TRUE if the buttons are homogeneous (i.e. all have the same height). - **/ -gboolean -e_group_bar_get_buttons_homogeneous (EGroupBar *group_bar) -{ - g_return_val_if_fail (E_IS_GROUP_BAR (group_bar), TRUE); - - return group_bar->buttons_homogeneous; -} - - -/** - * e_group_bar_set_buttons_homogeneous: - * @group_bar: an #EGroupBar. - * @homogeneous: TRUE if the buttons should be homoegeneous. - * - * Specifies whether the buttons should be homogeneous. When set to TRUE all - * the group buttons will be set to the same height (equal to the largest - * requested height). When set to FALSE the buttons will use their own - * individual requested heights. - **/ -void -e_group_bar_set_buttons_homogeneous (EGroupBar *group_bar, - gboolean homogeneous) -{ - g_return_if_fail (E_IS_GROUP_BAR (group_bar)); - - /* Just return if the setting hasn't changed. */ - if (group_bar->buttons_homogeneous == homogeneous) - return; - - group_bar->buttons_homogeneous = homogeneous; - - /* Update the position & sizes of the buttons. */ - gtk_widget_queue_resize (GTK_WIDGET (group_bar)); -} - - -static void -e_group_bar_on_button_clicked (GtkWidget *group_button, - EGroupBar *group_bar) -{ - gint group_num; - - /* Determine which group button was clicked. */ - group_num = e_group_bar_find_button (group_bar, group_button); - - if (group_num != -1) - e_group_bar_start_animation (group_bar, group_num); -} - - -/* This returns the group containing the given button, or -1 if not found. */ -static gint -e_group_bar_find_button (EGroupBar *group_bar, - GtkWidget *group_button) -{ - EGroupBarChild *group; - gint group_num; - - /* Determine which group button was clicked. */ - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - if (group->button == group_button) - return group_num; - } - - return -1; -} - - -static void -e_group_bar_start_animation (EGroupBar *group_bar, - gint group_num) -{ - EGroupBarChild *group, *old_group; - gint old_group_num, step; - - old_group_num = group_bar->current_group_num; - - /* Return if it is already the current group. */ - if (old_group_num == group_num) - return; - - group_bar->current_group_num = group_num; - - /* Calculate the target y position of the new current group button - and child, and map the child. */ - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - group->button_window_target_y = e_group_bar_get_group_button_position (group_bar, group_num); - group->button_window_in_animation = TRUE; - - group->child_window_target_y = e_group_bar_get_group_child_position (group_bar, group_num); - group->child_window_in_animation = TRUE; - - /* Calculate the target y position of the current group button and - child. */ - old_group = &g_array_index (group_bar->children, - EGroupBarChild, old_group_num); - old_group->button_window_target_y = e_group_bar_get_group_button_position (group_bar, old_group_num); - old_group->button_window_in_animation = TRUE; - - old_group->child_window_target_y = e_group_bar_get_group_child_position (group_bar, old_group_num); - old_group->child_window_in_animation = TRUE; - - /* We also need to animate the buttons in between the old group and the - new group. */ - step = (old_group_num < group_num) ? 1 : -1; - old_group_num += step; - while (old_group_num != group_num) { - old_group = &g_array_index (group_bar->children, - EGroupBarChild, old_group_num); - old_group->button_window_target_y = e_group_bar_get_group_button_position (group_bar, old_group_num); - old_group->button_window_in_animation = TRUE; - - old_group->child_window_target_y = e_group_bar_get_group_child_position (group_bar, old_group_num); - old_group->child_window_in_animation = TRUE; - - old_group_num += step; - } - - /* Add a timeout handler if we haven't already got one. */ - if (group_bar->animation_timeout_id == 0) { - group_bar->animation_timeout_id = g_timeout_add (E_GROUP_BAR_SCROLL_TIMEOUT, e_group_bar_timeout_handler, group_bar); - } -} - - -static gboolean -e_group_bar_timeout_handler (gpointer data) -{ - EGroupBar *group_bar; - EGroupBarChild *group; - gint group_num, button_window_y, child_window_y; - gboolean finished = TRUE; - - g_return_val_if_fail (E_IS_GROUP_BAR (data), FALSE); - - group_bar = E_GROUP_BAR (data); - - GDK_THREADS_ENTER (); - - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - - if (group->button_window_in_animation) { - gdk_window_get_position (group->button_window, NULL, - &button_window_y); - button_window_y += e_group_bar_get_increment (group_bar, button_window_y, group->button_window_target_y); - if (button_window_y == group->button_window_target_y) - group->button_window_in_animation = FALSE; - else - finished = FALSE; - gdk_window_move (group->button_window, - 0, button_window_y); - } - if (group->child_window_in_animation) { - gdk_window_get_position (group->child_window, NULL, - &child_window_y); - child_window_y += e_group_bar_get_increment (group_bar, child_window_y, group->child_window_target_y); - if (child_window_y == group->child_window_target_y) - group->child_window_in_animation = FALSE; - else - finished = FALSE; - gdk_window_move (group->child_window, - 0, child_window_y); - } - - } - - if (finished) - group_bar->animation_timeout_id = 0; - - GDK_THREADS_LEAVE (); - - return !finished; -} - - -static gint -e_group_bar_get_increment (EGroupBar *group_bar, - gint window_y, - gint window_target_y) -{ - gdouble percentage; - gint distance, total_distance, step; - - total_distance = group_bar->child_height; - distance = MIN (abs (window_target_y - window_y), total_distance); - - /* Convert the distance into an angle between -PI/2 and PI/2, so we can - then do a cosine of it. */ - percentage = cos (M_PI * ((gdouble)distance / (gdouble)total_distance) - M_PI / 2); - - /* Now multiply by our maximum step size to get the step size. */ - step = percentage * total_distance / 6; - - /* Add it to the minimum step size, but don't go too far. */ - step = step + E_GROUP_BAR_MIN_STEP_SIZE; - step = MIN (step, distance); - - if (window_target_y > window_y) - return step; - else - return -step; -} - - -static gboolean -e_group_bar_on_button_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time, - EGroupBar *group_bar) -{ - gint group_num; - - if (!group_bar->auto_show_timeout_id) { - group_num = e_group_bar_find_button (group_bar, widget); - if (group_num != -1) { - group_bar->auto_show_timeout_id = gtk_timeout_add (E_GROUP_BAR_AUTO_SHOW_TIMEOUT, e_group_bar_auto_show, group_bar); - group_bar->auto_show_group_num = group_num; - } - } - return TRUE; -} - - -static void -e_group_bar_on_button_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint time, - EGroupBar *group_bar) -{ - if (group_bar->auto_show_timeout_id) { - gtk_timeout_remove (group_bar->auto_show_timeout_id); - group_bar->auto_show_timeout_id = 0; - } -} - - -static gboolean -e_group_bar_auto_show (gpointer data) -{ - EGroupBar *group_bar; - - g_return_val_if_fail (E_IS_GROUP_BAR (data), FALSE); - - group_bar = E_GROUP_BAR (data); - - GDK_THREADS_ENTER (); - - e_group_bar_start_animation (group_bar, - group_bar->auto_show_group_num); - - group_bar->auto_show_timeout_id = 0; - - GDK_THREADS_LEAVE (); - - return FALSE; -} - - -/* This removes all timeouts and sets all 'in_animation' flags to FALSE. */ -static void -e_group_bar_stop_all_animation (EGroupBar *group_bar) -{ - EGroupBarChild *group; - gint group_num; - - if (group_bar->animation_timeout_id) { - g_source_remove (group_bar->animation_timeout_id); - group_bar->animation_timeout_id = 0; - } - if (group_bar->auto_show_timeout_id) { - g_source_remove (group_bar->auto_show_timeout_id); - group_bar->auto_show_timeout_id = 0; - } - - for (group_num = 0; - group_num < group_bar->children->len; - group_num++) { - group = &g_array_index (group_bar->children, - EGroupBarChild, group_num); - group->button_window_in_animation = FALSE; - group->child_window_in_animation = FALSE; - } -} - diff --git a/widgets/shortcut-bar/e-group-bar.h b/widgets/shortcut-bar/e-group-bar.h deleted file mode 100644 index 5c55bb585e..0000000000 --- a/widgets/shortcut-bar/e-group-bar.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ -#ifndef _E_GROUP_BAR_H_ -#define _E_GROUP_BAR_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * EGroupBar displays a vertical bar with a number of Groups, which are viewed - * one at a time by selecting the Group's button. When a different Group is - * selected, it slides into view, and the old Group slides out. - * It is typically used on the left of the main application window so users - * can easily access particular features. - * - * It is implemented like GtkNotebook, i.e. the main widgets are the children - * of the EGroupBar and the button widgets are treated specially like the - * GtkNotebook tab labels. - */ - -/* This contains information on one item. */ -typedef struct _EGroupBarChild EGroupBarChild; -struct _EGroupBarChild -{ - /* This is the button used to select the group, and the window we use - to move it around easily. */ - GtkWidget *button; - GdkWindow *button_window; - gint button_height; - - /* This is the child widget, which can be any widget added by the - application, and the window we use to move it around easily. */ - GtkWidget *child; - GdkWindow *child_window; - - /* These are TRUE if we are currently animating the windows. */ - gboolean button_window_in_animation; - gboolean child_window_in_animation; - - /* These are the target y positions that the windows should eventually - move to, used for animation. If we get a size_allocate we just - update these and the animation can continue as normal. - When a child window reaches its target position, it is unmapped if - if it is not the current group (i.e. it has slid off screen). */ - gint button_window_target_y; - gint child_window_target_y; -}; - - -#define E_GROUP_BAR(obj) GTK_CHECK_CAST (obj, e_group_bar_get_type (), EGroupBar) -#define E_GROUP_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_group_bar_get_type (), EGroupBarClass) -#define E_IS_GROUP_BAR(obj) GTK_CHECK_TYPE (obj, e_group_bar_get_type ()) - - -typedef struct _EGroupBar EGroupBar; -typedef struct _EGroupBarClass EGroupBarClass; - -struct _EGroupBar -{ - GtkContainer container; - - /* This is an array of EGroupBarChild elements. */ - GArray *children; - - /* This is the group currently shown. */ - gint current_group_num; - - /* This is TRUE if all the buttons are allocated the same height. */ - gboolean buttons_homogeneous; - - /* This is the biggest requested height of all the buttons, which we - use for all buttons when buttons_homogeneous is set. */ - gint max_button_height; - - /* This is the height of all the child windows & widgets. */ - gint child_height; - - /* The id of the source function for animation timeouts. If this is - not 0 then we are in the middle of an animation. */ - guint animation_timeout_id; - - /* The id of the source function for automatically showing groups when - the user drags over the group button, and the group to show. */ - guint auto_show_timeout_id; - gint auto_show_group_num; -}; - -struct _EGroupBarClass -{ - GtkContainerClass parent_class; -}; - - -GtkType e_group_bar_get_type (void); -GtkWidget* e_group_bar_new (void); - -/* - * Insertion, reordering and deletion of items. - */ - -/* Adds a new group at the given position. If position is -1 it adds it as - the last group. It returns the group number. */ -gint e_group_bar_add_group (EGroupBar *group_bar, - GtkWidget *child, - GtkWidget *button, - gint position); -void e_group_bar_reorder_group (EGroupBar *group_bar, - gint group_num, - gint new_position); -void e_group_bar_remove_group (EGroupBar *group_bar, - gint group_num); - -/* - * Getting & setting the current group. - */ -gint e_group_bar_get_current_group_num (EGroupBar *group_bar); -void e_group_bar_set_current_group_num (EGroupBar *group_bar, - gint group_num); - -/* - * Getting groups and group numbers. - */ -GtkWidget* e_group_bar_get_nth_group (EGroupBar *group_bar, - gint group_num); -gint e_group_bar_get_group_num (EGroupBar *group_bar, - GtkWidget *child); - -/* - * Setting the group button label. - */ -void e_group_bar_set_group_button_label (EGroupBar *group_bar, - gint group_num, - GtkWidget *label); - -/* - * Getting & setting the EGroupBar options. - */ -gboolean e_group_bar_get_buttons_homogeneous (EGroupBar *group_bar); -void e_group_bar_set_buttons_homogeneous (EGroupBar *group_bar, - gboolean homogeneous); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_GROUP_BAR_H_ */ diff --git a/widgets/shortcut-bar/e-icon-bar-bg-item.c b/widgets/shortcut-bar/e-icon-bar-bg-item.c deleted file mode 100644 index 01ac735d8f..0000000000 --- a/widgets/shortcut-bar/e-icon-bar-bg-item.c +++ /dev/null @@ -1,361 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * EIconBarBgItem - A GnomeCanvasItem which covers the entire EIconBar. - * It paints the rectangles around items when the mouse moves over them, and - * the lines between items when dragging. - */ - -#include "e-icon-bar-bg-item.h" -#include "e-icon-bar.h" - -/* This is the size of the border around the icons, for the shadow. */ -#define E_ICON_BAR_LARGE_ICON_SHADOW_BORDER 2 -#define E_ICON_BAR_SMALL_ICON_SHADOW_BORDER 2 - -/* These are for the horzontal bar when dragging. */ -#define E_ICON_BAR_BG_ITEM_BAR_HEIGHT 1 -#define E_ICON_BAR_BG_ITEM_BAR_OFFSET 2 -#define E_ICON_BAR_BG_ITEM_LARGE_ARROW_HEIGHT 8 -#define E_ICON_BAR_BG_ITEM_SMALL_ARROW_HEIGHT 4 - -static void e_icon_bar_bg_item_class_init (EIconBarBgItemClass *class); -static void e_icon_bar_bg_item_init (EIconBarBgItem *ibitem); - -static void e_icon_bar_bg_item_set_arg (GtkObject *o, GtkArg *arg, - guint arg_id); -static void e_icon_bar_bg_item_update (GnomeCanvasItem *item, - double *affine, - ArtSVP *clip_path, int flags); -static void e_icon_bar_bg_item_draw (GnomeCanvasItem *item, - GdkDrawable *drawable, - int x, int y, - int width, int height); -static double e_icon_bar_bg_item_point (GnomeCanvasItem *item, - double x, double y, - int cx, int cy, - GnomeCanvasItem **actual_item); -static gint e_icon_bar_bg_item_event (GnomeCanvasItem *item, - GdkEvent *event); -static gint e_icon_bar_bg_item_button_press (EIconBarBgItem *ibitem, - GdkEvent *event); -static gint e_icon_bar_bg_item_button_release (EIconBarBgItem *ibitem, - GdkEvent *event); -static gint e_icon_bar_bg_item_motion_notify (EIconBarBgItem *ibitem, - GdkEvent *event); - -static GnomeCanvasItemClass *parent_class; - -/* The arguments we take */ -enum { - ARG_0, - ARG_ICON_BAR -}; - - -GtkType -e_icon_bar_bg_item_get_type (void) -{ - static GtkType e_icon_bar_bg_item_type = 0; - - if (!e_icon_bar_bg_item_type) { - GtkTypeInfo e_icon_bar_bg_item_info = { - "EIconBarBgItem", - sizeof (EIconBarBgItem), - sizeof (EIconBarBgItemClass), - (GtkClassInitFunc) e_icon_bar_bg_item_class_init, - (GtkObjectInitFunc) e_icon_bar_bg_item_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_icon_bar_bg_item_type = gtk_type_unique (gnome_canvas_item_get_type (), &e_icon_bar_bg_item_info); - } - - return e_icon_bar_bg_item_type; -} - - -static void -e_icon_bar_bg_item_class_init (EIconBarBgItemClass *class) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - parent_class = gtk_type_class (gnome_canvas_item_get_type()); - - object_class = (GtkObjectClass *) class; - item_class = (GnomeCanvasItemClass *) class; - - gtk_object_add_arg_type ("EIconBarBgItem::icon_bar", - GTK_TYPE_POINTER, GTK_ARG_WRITABLE, - ARG_ICON_BAR); - - object_class->set_arg = e_icon_bar_bg_item_set_arg; - - /* GnomeCanvasItem method overrides */ - item_class->update = e_icon_bar_bg_item_update; - item_class->draw = e_icon_bar_bg_item_draw; - item_class->point = e_icon_bar_bg_item_point; - item_class->event = e_icon_bar_bg_item_event; -} - - -static void -e_icon_bar_bg_item_init (EIconBarBgItem *ibitem) -{ - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ibitem); - - ibitem->icon_bar = NULL; - - item->x1 = 0; - item->y1 = 0; - item->x2 = 0; - item->y2 = 0; -} - - -static void -e_icon_bar_bg_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EIconBarBgItem *ibitem; - - item = GNOME_CANVAS_ITEM (o); - ibitem = E_ICON_BAR_BG_ITEM (o); - - switch (arg_id){ - case ARG_ICON_BAR: - ibitem->icon_bar = GTK_VALUE_POINTER (*arg); - break; - } -} - - -static void -e_icon_bar_bg_item_update (GnomeCanvasItem *item, - double *affine, - ArtSVP *clip_path, - int flags) -{ - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags); - - /* The grid covers the entire canvas area. */ - item->x1 = 0; - item->y1 = 0; - item->x2 = INT_MAX; - item->y2 = INT_MAX; -} - - -/* - * DRAWING ROUTINES - functions to paint the canvas item. - */ - -static void -e_icon_bar_bg_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - EIconBar *icon_bar; - EIconBarItem *item; - EIconBarBgItem *ibitem; - GtkStyle *style; - GdkGC *gc; - GtkShadowType shadow; - gint item_num, border, bar_x, bar_y, bar_w, i, arrow_height; - - ibitem = E_ICON_BAR_BG_ITEM (canvas_item); - icon_bar = ibitem->icon_bar; - g_return_if_fail (icon_bar != NULL); - style = GTK_WIDGET (icon_bar)->style; - - /* Draw the highlight around the current highlight item. */ - item_num = -1; - if (icon_bar->editing_item_num == -1) { - if (icon_bar->pressed_item_num != -1) { - item_num = icon_bar->pressed_item_num; - if (icon_bar->pressed_item_num == icon_bar->mouse_over_item_num) - shadow = GTK_SHADOW_IN; - else - shadow = GTK_SHADOW_OUT; - } else if (icon_bar->mouse_over_item_num != -1) { - item_num = icon_bar->mouse_over_item_num; - shadow = GTK_SHADOW_OUT; - } - } - - if (item_num != -1) { - item = &g_array_index (icon_bar->items, EIconBarItem, - item_num); - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) - border = E_ICON_BAR_LARGE_ICON_SHADOW_BORDER; - else - border = E_ICON_BAR_SMALL_ICON_SHADOW_BORDER; - - gtk_draw_shadow (style, drawable, GTK_STATE_NORMAL, shadow, - icon_bar->icon_x - border - x, - item->icon_y - border - y, - icon_bar->icon_w + border * 2 - 1, - icon_bar->icon_h + border * 2 - 1); - } - - /* Draw the bar between items when dragging, if needed. */ - if (icon_bar->in_drag && icon_bar->dragging_before_item_num != -1) { - if (icon_bar->dragging_before_item_num < icon_bar->items->len) { - item = &g_array_index (icon_bar->items, EIconBarItem, - icon_bar->dragging_before_item_num); - bar_y = 0; - } else { - /* We need to draw the bar after the last item. */ - item = &g_array_index (icon_bar->items, EIconBarItem, - icon_bar->items->len - 1); - bar_y = item->item_height + icon_bar->spacing; - } - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - bar_y += item->icon_y; - } else { - bar_y += MIN (item->icon_y, item->text_y); - } - bar_y -= y + icon_bar->spacing / 2; - - bar_x = E_ICON_BAR_BG_ITEM_BAR_OFFSET - x; - bar_w = GTK_WIDGET (icon_bar)->allocation.width - 2 * E_ICON_BAR_BG_ITEM_BAR_OFFSET - 1; - - gc = GTK_WIDGET (icon_bar)->style->fg_gc[GTK_STATE_NORMAL]; - - /* Draw the horizontal bar. */ - gdk_draw_rectangle (drawable, gc, TRUE, - bar_x, bar_y, - bar_w, E_ICON_BAR_BG_ITEM_BAR_HEIGHT); - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) - arrow_height = E_ICON_BAR_BG_ITEM_LARGE_ARROW_HEIGHT / 2; - else - arrow_height = E_ICON_BAR_BG_ITEM_SMALL_ARROW_HEIGHT / 2; - - /* Draw the arrows at the end of the lines. We use - gdk_draw_line() to draw a series of vertical lines, since - gdk_draw_polygon() produces odd results. */ - i = 0; - while (arrow_height > 0) { - gdk_draw_line (drawable, gc, - bar_x + i, - bar_y - arrow_height, - bar_x + i, - bar_y + arrow_height); - gdk_draw_line (drawable, gc, - bar_x + bar_w - i - 1, - bar_y - arrow_height, - bar_x + bar_w - i - 1, - bar_y + arrow_height); - arrow_height--; - i++; - } - } -} - - -/* This is supposed to return the nearest item the the point and the distance. - Since we are the only item we just return ourself and 0 for the distance. - This is needed so that we get button/motion events. */ -static double -e_icon_bar_bg_item_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, - GnomeCanvasItem **actual_item) -{ - *actual_item = item; - return 0.0; -} - - -static gint -e_icon_bar_bg_item_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EIconBarBgItem *ibitem; - - ibitem = E_ICON_BAR_BG_ITEM (item); - - switch (event->type) { - case GDK_BUTTON_PRESS: - return e_icon_bar_bg_item_button_press (ibitem, event); - case GDK_BUTTON_RELEASE: - return e_icon_bar_bg_item_button_release (ibitem, event); - case GDK_MOTION_NOTIFY: - return e_icon_bar_bg_item_motion_notify (ibitem, event); - default: - break; - } - - return FALSE; -} - - -static gint -e_icon_bar_bg_item_button_press (EIconBarBgItem *ibitem, - GdkEvent *event) -{ - gint item_num; - - item_num = e_icon_bar_find_item_at_position (ibitem->icon_bar, - event->button.x, - event->button.y, - NULL); - e_icon_bar_item_pressed (ibitem->icon_bar, item_num, event); - return TRUE; -} - - -static gint -e_icon_bar_bg_item_button_release (EIconBarBgItem *ibitem, - GdkEvent *event) -{ - gint item_num; - - item_num = e_icon_bar_find_item_at_position (ibitem->icon_bar, - event->button.x, - event->button.y, - NULL); - e_icon_bar_item_released (ibitem->icon_bar, item_num, event); - return TRUE; -} - - -static gint -e_icon_bar_bg_item_motion_notify (EIconBarBgItem *ibitem, - GdkEvent *event) -{ - gint item_num; - - item_num = e_icon_bar_find_item_at_position (ibitem->icon_bar, - event->motion.x, - event->motion.y, - NULL); - e_icon_bar_item_motion (ibitem->icon_bar, item_num, event); - return TRUE; -} diff --git a/widgets/shortcut-bar/e-icon-bar-bg-item.h b/widgets/shortcut-bar/e-icon-bar-bg-item.h deleted file mode 100644 index f8fa14f299..0000000000 --- a/widgets/shortcut-bar/e-icon-bar-bg-item.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * EIconBarBgItem - A GnomeCanvasItem which covers the entire EIconBar. - * It paints the rectangles around items when the mouse moves over them, and - * the lines between items when dragging. - */ - -#ifndef _E_ICON_BAR_BG_ITEM_H_ -#define _E_ICON_BAR_BG_ITEM_H_ - -#include - -#include "e-icon-bar.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define E_ICON_BAR_BG_ITEM(obj) (GTK_CHECK_CAST((obj), e_icon_bar_bg_item_get_type (), EIconBarBgItem)) -#define E_ICON_BAR_BG_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), e_icon_bar_bg_item_get_type (), EIconBarBgItemClass)) -#define E_IS_ICON_BAR_BG_ITEM(o) (GTK_CHECK_TYPE((o), e_icon_bar_bg_item_get_type ())) - - -typedef struct _EIconBarBgItem EIconBarBgItem; -typedef struct _EIconBarBgItemClass EIconBarBgItemClass; - -struct _EIconBarBgItem -{ - GnomeCanvasItem canvas_item; - - /* The parent EIconBar widget. */ - EIconBar *icon_bar; -}; - - -struct _EIconBarBgItemClass -{ - GnomeCanvasItemClass parent_class; -}; - -GtkType e_icon_bar_bg_item_get_type (void); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_ICON_BAR_BG_ITEM_H_ */ diff --git a/widgets/shortcut-bar/e-icon-bar-text-item.c b/widgets/shortcut-bar/e-icon-bar-text-item.c deleted file mode 100644 index 21c4fd9580..0000000000 --- a/widgets/shortcut-bar/e-icon-bar-text-item.c +++ /dev/null @@ -1,1696 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * Based on gnome-icon-text-item: an editable text block with word wrapping - * for the GNOME canvas. - * - * Copyright (C) 1998, 1999 The Free Software Foundation - * - * Authors: Miguel de Icaza - * Federico Mena - */ - -/* - * EIconBarTextItem - An editable canvas text item for the EIconBar. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "e-icon-bar-text-item.h" - - -/* Margins used to display the information */ -#define MARGIN_X 2 -#define MARGIN_Y 2 - -/* Default fontset to be used if the user specified fontset is not found */ -#define DEFAULT_FONT_NAME "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*," \ - "-*-*-medium-r-normal--10-*-*-*-*-*-*-*,*" - -/* Separators for text layout */ -#define DEFAULT_SEPARATORS " \t-.[]#" - -/* This is the string to draw when the text is clipped, e.g. '...'. */ -static gchar *e_icon_bar_text_item_ellipsis; - -/* Aliases to minimize screen use in my laptop */ -#define ITI(x) E_ICON_BAR_TEXT_ITEM (x) -#define ITI_CLASS(x) E_ICON_BAR_TEXT_ITEM_CLASS (x) -#define IS_ITI(x) E_IS_ICON_BAR_TEXT_ITEM (x) - - -typedef EIconBarTextItem Iti; - -/* Private part of the EIconBarTextItem structure */ -typedef struct { - /* Font */ - GdkFont *font; - - /* Hack: create an offscreen window and place an entry inside it */ - GtkEntry *entry; - GtkWidget *entry_top; - - /* Whether the user pressed the mouse while the item was unselected */ - guint unselected_click : 1; - - /* Whether we need to update the position */ - guint need_pos_update : 1; - - /* Whether we need to update the font */ - guint need_font_update : 1; - - /* Whether we need to update the text */ - guint need_text_update : 1; - - /* Whether we need to update because the editing/selected state changed */ - guint need_state_update : 1; -} ItiPrivate; - -typedef struct _EIconBarTextItemInfoRow EIconBarTextItemInfoRow; - -struct _EIconBarTextItemInfoRow { - gchar *text; - gint width; - GdkWChar *text_wc; /* text in wide characters */ - gint text_length; /* number of characters */ -}; - -struct _EIconBarTextItemInfo { - GList *rows; - GdkFont *font; - gint width; - gint height; - gint baseline_skip; -}; - -static GnomeCanvasItemClass *parent_class; - -enum { - ARG_0, - ARG_XALIGN, - ARG_JUSTIFY, - ARG_MAX_LINES, - ARG_SHOW_ELLIPSIS -}; - -enum { - TEXT_CHANGED, - HEIGHT_CHANGED, - WIDTH_CHANGED, - EDITING_STARTED, - EDITING_STOPPED, - SELECTION_STARTED, - SELECTION_STOPPED, - LAST_SIGNAL -}; - -static guint iti_signals [LAST_SIGNAL] = { 0 }; - -static GdkFont *default_font; - -static void e_icon_bar_text_item_free_info (EIconBarTextItemInfo *ti); -static EIconBarTextItemInfo *e_icon_bar_text_item_layout_text (EIconBarTextItem *iti, GdkFont *font, const gchar *text, const gchar *separators, gint max_width, gboolean confine); -static void e_icon_bar_text_item_paint_text (EIconBarTextItem *iti, - EIconBarTextItemInfo *ti, - GdkDrawable *drawable, - GdkGC *gc, - gint x, - gint y, - GtkJustification just); - - -/* Stops the editing state of an icon text item */ -static void -iti_stop_editing (Iti *iti) -{ - ItiPrivate *priv; - - priv = iti->priv; - - iti->editing = FALSE; - - gtk_widget_destroy (priv->entry_top); - priv->entry = NULL; - priv->entry_top = NULL; - - priv->need_state_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); - - gtk_signal_emit (GTK_OBJECT (iti), iti_signals[EDITING_STOPPED]); -} - -/* Lays out the text in an icon item */ -static void -layout_text (Iti *iti) -{ - ItiPrivate *priv; - char *text; - int old_width, old_height; - int width, height; - - priv = iti->priv; - - /* Save old size */ - - if (iti->ti) { - old_width = iti->ti->width + 2 * MARGIN_X; - old_height = iti->ti->height + 2 * MARGIN_Y; - - e_icon_bar_text_item_free_info (iti->ti); - } else { - old_width = 2 * MARGIN_X; - old_height = 2 * MARGIN_Y; - } - - /* Change the text layout */ - - if (iti->editing) - text = gtk_entry_get_text (priv->entry); - else - text = iti->text; - - iti->ti = e_icon_bar_text_item_layout_text (iti, priv->font, - text, - DEFAULT_SEPARATORS, - iti->width - 2 * MARGIN_X, - TRUE); - - /* Check the sizes and see if we need to emit any signals */ - - width = iti->ti->width + 2 * MARGIN_X; - height = iti->ti->height + 2 * MARGIN_Y; - - if (width != old_width) - gtk_signal_emit (GTK_OBJECT (iti), iti_signals[WIDTH_CHANGED]); - - if (height != old_height) - gtk_signal_emit (GTK_OBJECT (iti), iti_signals[HEIGHT_CHANGED]); -} - -/* Accepts the text in the off-screen entry of an icon text item */ -static void -iti_edition_accept (Iti *iti) -{ - ItiPrivate *priv; - gboolean accept; - - priv = iti->priv; - accept = TRUE; - - gtk_signal_emit (GTK_OBJECT (iti), iti_signals [TEXT_CHANGED], &accept); - - if (iti->editing){ - if (accept) { - if (iti->is_text_allocated) - g_free (iti->text); - - iti->text = g_strdup (gtk_entry_get_text (priv->entry)); - iti->is_text_allocated = 1; - } - - iti_stop_editing (iti); - } - - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); -} - -/* Callback used when the off-screen entry of an icon text item is activated. - * When this happens, we have to accept edition. - */ -static void -iti_entry_activate (GtkWidget *entry, Iti *iti) -{ - iti_edition_accept (iti); -} - -/* Starts the editing state of an icon text item */ -static void -iti_start_editing (Iti *iti) -{ - ItiPrivate *priv; - - priv = iti->priv; - - if (iti->editing) - return; - - /* Trick: The actual edition of the entry takes place in a GtkEntry - * which is placed offscreen. That way we get all of the advantages - * from GtkEntry without duplicating code. Yes, this is a hack. - */ - priv->entry = (GtkEntry *) gtk_entry_new (); - gtk_entry_set_text (priv->entry, iti->text); - gtk_signal_connect (GTK_OBJECT (priv->entry), "activate", - GTK_SIGNAL_FUNC (iti_entry_activate), iti); - - priv->entry_top = gtk_window_new (GTK_WINDOW_POPUP); - gtk_container_add (GTK_CONTAINER (priv->entry_top), GTK_WIDGET (priv->entry)); - gtk_widget_set_uposition (priv->entry_top, 20000, 20000); - gtk_widget_show_all (priv->entry_top); - - gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1); - - iti->editing = TRUE; - - priv->need_text_update = TRUE; - priv->need_state_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); - - gtk_signal_emit (GTK_OBJECT (iti), iti_signals[EDITING_STARTED]); -} - -/* Destroy method handler for the icon text item */ -static void -iti_destroy (GtkObject *object) -{ - Iti *iti; - ItiPrivate *priv; - GnomeCanvasItem *item; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ITI (object)); - - iti = ITI (object); - priv = iti->priv; - item = GNOME_CANVAS_ITEM (object); - - /* FIXME: stop selection and editing */ - - /* Queue redraw of bounding box */ - - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - - /* Free everything */ - - if (iti->fontname) - g_free (iti->fontname); - - if (iti->text && iti->is_text_allocated) - g_free (iti->text); - - if (iti->ti) - e_icon_bar_text_item_free_info (iti->ti); - - if (priv->font) - gdk_font_unref (priv->font); - - if (priv->entry_top) - gtk_widget_destroy (priv->entry_top); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* set_arg handler for the icon text item */ -static void -iti_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - Iti *iti; - GnomeCanvasItem *item; - ItiPrivate *priv; - gfloat xalign; - gint max_lines; - gboolean show_ellipsis; - GtkJustification justification; - - iti = ITI (object); - item = GNOME_CANVAS_ITEM (object); - priv = iti->priv; - - switch (arg_id) { - case ARG_XALIGN: - xalign = GTK_VALUE_FLOAT (*arg); - if (iti->xalign != xalign) { - iti->xalign = xalign; - priv->need_pos_update = TRUE; - gnome_canvas_item_request_update (item); - } - break; - case ARG_JUSTIFY: - justification = GTK_VALUE_ENUM (*arg); - if (iti->justification != justification) { - iti->justification = justification; - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (item); - } - break; - case ARG_MAX_LINES: - max_lines = GTK_VALUE_INT (*arg); - if (iti->max_lines != max_lines) { - iti->max_lines = max_lines; - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (item); - } - break; - case ARG_SHOW_ELLIPSIS: - show_ellipsis = GTK_VALUE_BOOL (*arg); - if (iti->show_ellipsis != show_ellipsis) { - iti->show_ellipsis = show_ellipsis; - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (item); - } - break; - default: - break; - } -} - -static void -iti_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - Iti *iti; - ItiPrivate *priv; - - iti = ITI (object); - priv = iti->priv; - - switch (arg_id) { - case ARG_XALIGN: - GTK_VALUE_FLOAT (*arg) = iti->xalign; - break; - case ARG_JUSTIFY: - GTK_VALUE_ENUM (*arg) = iti->justification; - break; - case ARG_MAX_LINES: - GTK_VALUE_INT (*arg) = iti->max_lines; - break; - case ARG_SHOW_ELLIPSIS: - GTK_VALUE_BOOL (*arg) = iti->show_ellipsis; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/* Loads the default font for icon text items if necessary */ -static GdkFont * -get_default_font (void) -{ - if (!default_font) { - /* FIXME: this is never unref-ed */ - default_font = gdk_fontset_load (DEFAULT_FONT_NAME); - g_assert (default_font != NULL); - } - - return gdk_font_ref (default_font); -} - -/* Recomputes the bounding box of an icon text item */ -static void -recompute_bounding_box (Iti *iti) -{ - GnomeCanvasItem *item; - double affine[6]; - ArtPoint p, q; - int x1, y1, x2, y2; - int width, height; - - item = GNOME_CANVAS_ITEM (iti); - - /* Compute width, height, position */ - - width = iti->ti->width + 2 * MARGIN_X; - height = iti->ti->height + 2 * MARGIN_Y; - - x1 = iti->x + (iti->width - width) * iti->xalign; - y1 = iti->y; - x2 = x1 + width; - y2 = y1 + height; - - /* Translate to world coordinates */ - - gnome_canvas_item_i2w_affine (item, affine); - - p.x = x1; - p.y = y1; - art_affine_point (&q, &p, affine); - item->x1 = q.x; - item->y1 = q.y; - - p.x = x2; - p.y = y2; - art_affine_point (&q, &p, affine); - item->x2 = q.x; - item->y2 = q.y; -} - -/* Update method for the icon text item */ -static void -iti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - Iti *iti; - ItiPrivate *priv; - - iti = ITI (item); - priv = iti->priv; - - if (parent_class->update) - (* parent_class->update) (item, affine, clip_path, flags); - - /* If necessary, queue a redraw of the old bounding box */ - - if ((flags & GNOME_CANVAS_UPDATE_VISIBILITY) - || (flags & GNOME_CANVAS_UPDATE_AFFINE) - || priv->need_pos_update - || priv->need_font_update - || priv->need_text_update) - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - - if (priv->need_text_update) - layout_text (iti); - - /* Compute new bounds */ - - if (priv->need_pos_update - || priv->need_font_update - || priv->need_text_update) - recompute_bounding_box (iti); - - /* Queue redraw */ - - gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2); - - priv->need_pos_update = FALSE; - priv->need_font_update = FALSE; - priv->need_text_update = FALSE; - priv->need_state_update = FALSE; -} - -/* Draw the icon text item's text when it is being edited */ -static void -iti_paint_text (Iti *iti, GdkDrawable *drawable, int x, int y) -{ - ItiPrivate *priv; - EIconBarTextItemInfoRow *row; - EIconBarTextItemInfo *ti; - GtkStyle *style; - GdkGC *fg_gc, *bg_gc; - GdkGC *gc, *bgc, *sgc, *bsgc; - GList *item; - int xpos, len; - - priv = iti->priv; - style = GTK_WIDGET (GNOME_CANVAS_ITEM (iti)->canvas)->style; - - ti = iti->ti; - len = 0; - y += ti->font->ascent; - - /* - * Pointers to all of the GCs we use - */ - gc = style->black_gc; - bgc = style->white_gc; - sgc = style->fg_gc [GTK_STATE_SELECTED]; - bsgc = style->bg_gc [GTK_STATE_SELECTED]; - - for (item = ti->rows; item; item = item->next, len += (row ? row->text_length : 0)) { - GdkWChar *text_wc; - int text_length; - int cursor, offset, i; - int sel_start, sel_end; - - row = item->data; - - if (!row) { - y += ti->baseline_skip; - continue; - } - - text_wc = row->text_wc; - text_length = row->text_length; - - switch (iti->justification) { - case GTK_JUSTIFY_LEFT: - xpos = 0; - break; - - case GTK_JUSTIFY_RIGHT: - xpos = ti->width - row->width; - break; - - case GTK_JUSTIFY_CENTER: - xpos = (ti->width - row->width) / 2; - break; - - default: - /* Anyone care to implement GTK_JUSTIFY_FILL? */ - g_warning ("Justification type %d not supported. Using left-justification.", - (int) iti->justification); - xpos = 0; - } - - sel_start = GTK_EDITABLE (priv->entry)->selection_start_pos - len; - sel_end = GTK_EDITABLE (priv->entry)->selection_end_pos - len; - offset = 0; - cursor = GTK_EDITABLE (priv->entry)->current_pos - len; - - for (i = 0; *text_wc; text_wc++, i++) { - int size, px; - - size = gdk_text_width_wc (ti->font, text_wc, 1); - - if (i >= sel_start && i < sel_end) { - fg_gc = sgc; - bg_gc = bsgc; - } else { - fg_gc = gc; - bg_gc = bgc; - } - - px = x + xpos + offset; - gdk_draw_rectangle (drawable, - bg_gc, - TRUE, - px, - y - ti->font->ascent, - size, ti->baseline_skip); - - gdk_draw_text_wc (drawable, - ti->font, - fg_gc, - px, y, - text_wc, 1); - - if (cursor == i) - gdk_draw_line (drawable, - gc, - px - 1, - y - ti->font->ascent, - px - 1, - y + ti->font->descent - 1); - - offset += size; - } - - if (cursor == i) { - int px = x + xpos + offset; - - gdk_draw_line (drawable, - gc, - px - 1, - y - ti->font->ascent, - px - 1, - y + ti->font->descent - 1); - } - - y += ti->baseline_skip; - } -} - -/* Draw method handler for the icon text item */ -static void -iti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) -{ - Iti *iti; - GtkStyle *style; - int w, h; - int xofs, yofs; - - iti = ITI (item); - - if (iti->ti) { - w = iti->ti->width + 2 * MARGIN_X; - h = iti->ti->height + 2 * MARGIN_Y; - } else { - w = 2 * MARGIN_X; - h = 2 * MARGIN_Y; - } - - xofs = item->x1 - x; - yofs = item->y1 - y; - - style = GTK_WIDGET (item->canvas)->style; - - if (iti->selected && !iti->editing) - gdk_draw_rectangle (drawable, - style->bg_gc[GTK_STATE_SELECTED], - TRUE, - xofs, yofs, - w, h); - - if (iti->editing) { - gdk_draw_rectangle (drawable, - style->white_gc, - TRUE, - xofs + 1, yofs + 1, - w - 2, h - 2); - gdk_draw_rectangle (drawable, - style->black_gc, - FALSE, - xofs, yofs, - w - 1, h - 1); - - iti_paint_text (iti, drawable, xofs + MARGIN_X, yofs + MARGIN_Y); - } else - e_icon_bar_text_item_paint_text (iti, iti->ti, - drawable, - style->fg_gc[(iti->selected - ? GTK_STATE_SELECTED - : GTK_STATE_NORMAL)], - xofs + MARGIN_X, - yofs + MARGIN_Y, - iti->justification); -} - -/* Point method handler for the icon text item */ -static double -iti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item) -{ - double dx, dy; - - *actual_item = item; - - if (cx < item->x1) - dx = item->x1 - cx; - else if (cx > item->x2) - dx = cx - item->x2; - else - dx = 0.0; - - if (cy < item->y1) - dy = item->y1 - cy; - else if (cy > item->y2) - dy = cy - item->y2; - else - dy = 0.0; - - return sqrt (dx * dx + dy * dy); -} - -/* Given X, Y, a mouse position, return a valid index inside the edited text */ -static int -iti_idx_from_x_y (Iti *iti, int x, int y) -{ - ItiPrivate *priv; - EIconBarTextItemInfoRow *row; - int lines; - int line, col, i, idx; - GList *l; - - priv = iti->priv; - - if (iti->ti->rows == NULL) - return 0; - - lines = g_list_length (iti->ti->rows); - line = y / iti->ti->baseline_skip; - - if (line < 0) - line = 0; - else if (lines < line + 1) - line = lines - 1; - - /* Compute the base index for this line */ - for (l = iti->ti->rows, idx = i = 0; i < line; l = l->next, i++) { - row = l->data; - idx += row->text_length; - } - - row = g_list_nth (iti->ti->rows, line)->data; - col = 0; - if (row != NULL) { - int first_char; - int last_char; - - first_char = (iti->ti->width - row->width) / 2; - last_char = first_char + row->width; - - if (x < first_char) { - /* nothing */ - } else if (x > last_char) { - col = row->text_length; - } else { - GdkWChar *s = row->text_wc; - int pos = first_char; - - while (pos < last_char) { - pos += gdk_text_width_wc (iti->ti->font, s, 1); - if (pos > x) - break; - col++; - s++; - } - } - } - - idx += col; - - g_assert (idx <= priv->entry->text_size); - - return idx; -} - -/* Starts the selection state in the icon text item */ -static void -iti_start_selecting (Iti *iti, int idx, guint32 event_time) -{ - ItiPrivate *priv; - GtkEditable *e; - GdkCursor *ibeam; - - priv = iti->priv; - e = GTK_EDITABLE (priv->entry); - - gtk_editable_select_region (e, idx, idx); - gtk_editable_set_position (e, idx); - ibeam = gdk_cursor_new (GDK_XTERM); - gnome_canvas_item_grab (GNOME_CANVAS_ITEM (iti), - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK, - ibeam, event_time); - gdk_cursor_destroy (ibeam); - - gtk_editable_select_region (e, idx, idx); - e->current_pos = e->selection_start_pos; - e->has_selection = TRUE; - iti->selecting = TRUE; - - priv->need_state_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); - - gtk_signal_emit (GTK_OBJECT (iti), iti_signals[SELECTION_STARTED]); -} - -/* Stops the selection state in the icon text item */ -static void -iti_stop_selecting (Iti *iti, guint32 event_time) -{ - ItiPrivate *priv; - GnomeCanvasItem *item; - GtkEditable *e; - - priv = iti->priv; - item = GNOME_CANVAS_ITEM (iti); - e = GTK_EDITABLE (priv->entry); - - gnome_canvas_item_ungrab (item, event_time); - e->has_selection = FALSE; - iti->selecting = FALSE; - - priv->need_state_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); - gtk_signal_emit (GTK_OBJECT (iti), iti_signals[SELECTION_STOPPED]); -} - -/* Handles selection range changes on the icon text item */ -static void -iti_selection_motion (Iti *iti, int idx) -{ - ItiPrivate *priv; - GtkEditable *e; - - priv = iti->priv; - e = GTK_EDITABLE (priv->entry); - - if (idx < e->current_pos) { - e->selection_start_pos = idx; - e->selection_end_pos = e->current_pos; - } else { - e->selection_start_pos = e->current_pos; - e->selection_end_pos = idx; - } - - priv->need_state_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); -} - -/* Event handler for icon text items */ -static gint -iti_event (GnomeCanvasItem *item, GdkEvent *event) -{ - Iti *iti; - ItiPrivate *priv; - int idx; - double x, y; - - iti = ITI (item); - priv = iti->priv; - - switch (event->type) { - case GDK_KEY_PRESS: - if (!iti->editing) - break; - - if (event->key.keyval == GDK_Escape) - iti_stop_editing (iti); - else - gtk_widget_event (GTK_WIDGET (priv->entry), event); - - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (item); - return TRUE; - - case GDK_BUTTON_PRESS: - if (!iti->editing) - break; - - if (iti->editing && event->button.button == 1) { - x = event->button.x - (item->x1 + MARGIN_X); - y = event->button.y - (item->y1 + MARGIN_Y); - idx = iti_idx_from_x_y (iti, x, y); - - iti_start_selecting (iti, idx, event->button.time); - } - - return TRUE; - - case GDK_MOTION_NOTIFY: - if (!iti->selecting) - break; - - x = event->motion.x - (item->x1 + MARGIN_X); - y = event->motion.y - (item->y1 + MARGIN_Y); - idx = iti_idx_from_x_y (iti, x, y); - iti_selection_motion (iti, idx); - return TRUE; - - case GDK_BUTTON_RELEASE: - if (iti->selecting && event->button.button == 1) - iti_stop_selecting (iti, event->button.time); - else - break; - - return TRUE; - - default: - break; - } - - return FALSE; -} - -/* Bounds method handler for the icon text item */ -static void -iti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - Iti *iti; - ItiPrivate *priv; - int width, height; - - iti = ITI (item); - priv = iti->priv; - - if (priv->need_text_update) { - layout_text (iti); - priv->need_text_update = FALSE; - } - - if (iti->ti) { - width = iti->ti->width + 2 * MARGIN_X; - height = iti->ti->height + 2 * MARGIN_Y; - } else { - width = 2 * MARGIN_X; - height = 2 * MARGIN_Y; - } - - *x1 = iti->x + (iti->width - width) * iti->xalign; - *y1 = iti->y; - *x2 = *x1 + width; - *y2 = *y1 + height; -} - -/* Class initialization function for the icon text item */ -static void -iti_class_init (EIconBarTextItemClass *text_item_class) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass *) text_item_class; - item_class = (GnomeCanvasItemClass *) text_item_class; - - parent_class = gtk_type_class (gnome_canvas_item_get_type ()); - - gtk_object_add_arg_type ("EIconBarTextItem::xalign", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_XALIGN); - gtk_object_add_arg_type ("EIconBarTextItem::justify", GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFY); - gtk_object_add_arg_type ("EIconBarTextItem::max_lines", GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES); - gtk_object_add_arg_type ("EIconBarTextItem::show_ellipsis", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SHOW_ELLIPSIS); - - iti_signals [TEXT_CHANGED] = - gtk_signal_new ( - "text_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarTextItemClass, text_changed), - gtk_marshal_BOOL__NONE, - GTK_TYPE_BOOL, 0); - - iti_signals [HEIGHT_CHANGED] = - gtk_signal_new ( - "height_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarTextItemClass, height_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - iti_signals [WIDTH_CHANGED] = - gtk_signal_new ( - "width_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarTextItemClass, width_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - iti_signals[EDITING_STARTED] = - gtk_signal_new ( - "editing_started", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarTextItemClass, editing_started), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - iti_signals[EDITING_STOPPED] = - gtk_signal_new ( - "editing_stopped", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarTextItemClass, editing_stopped), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - iti_signals[SELECTION_STARTED] = - gtk_signal_new ( - "selection_started", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarTextItemClass, selection_started), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - iti_signals[SELECTION_STOPPED] = - gtk_signal_new ( - "selection_stopped", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarTextItemClass, selection_stopped), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, iti_signals, LAST_SIGNAL); - - object_class->destroy = iti_destroy; - object_class->get_arg = iti_get_arg; - object_class->set_arg = iti_set_arg; - - item_class->update = iti_update; - item_class->draw = iti_draw; - item_class->point = iti_point; - item_class->bounds = iti_bounds; - item_class->event = iti_event; - - e_icon_bar_text_item_ellipsis = _("..."); -} - -/* Object initialization function for the icon text item */ -static void -iti_init (EIconBarTextItem *iti) -{ - ItiPrivate *priv; - - priv = g_new0 (ItiPrivate, 1); - iti->priv = priv; - - iti->xalign = 0.5; - iti->justification = GTK_JUSTIFY_CENTER; - iti->max_lines = -1; - iti->show_ellipsis = TRUE; -} - -/** - * e_icon_bar_text_item_configure: - * @iti: An #EIconBarTextItem. - * @x: X position in which to place the item. - * @y: Y position in which to place the item. - * @width: Maximum width allowed for this item, to be used for word wrapping. - * @fontname: Name of the fontset that should be used to display the text. - * @text: Text that is going to be displayed. - * @is_static: Whether @text points to a static string or not. - * - * This routine is used to configure an #EIconBarTextItem. - * - * @x and @y specify the coordinates where the item is placed in the canvas. - * The @x coordinate should be the leftmost position that the item can - * assume at any one time, that is, the left margin of the column in which the - * icon is to be placed. The @y coordinate specifies the top of the item. - * - * @width is the maximum width allowed for this icon text item. The coordinates - * define the upper-left corner of an item with maximum width; this may - * actually be outside the bounding box of the item if the text is narrower - * than the maximum width. - * - * If @is_static is true, it means that there is no need for the item to - * allocate memory for the string (it is a guarantee that the text is allocated - * by the caller and it will not be deallocated during the lifetime of this - * item). This is an optimization to reduce memory usage for large icon sets. - */ -void -e_icon_bar_text_item_configure (EIconBarTextItem *iti, int x, int y, - int width, const char *fontname, - const char *text, - gboolean is_static) -{ - ItiPrivate *priv; - - g_return_if_fail (iti != NULL); - g_return_if_fail (IS_ITI (iti)); - g_return_if_fail (width > 2 * MARGIN_X); - g_return_if_fail (text != NULL); - - priv = iti->priv; - - iti->x = x; - iti->y = y; - iti->width = width; - - if (iti->text && iti->is_text_allocated) - g_free (iti->text); - - iti->is_text_allocated = !is_static; - - /* This cast is to shut up the compiler */ - if (is_static) - iti->text = (char *) text; - else - iti->text = g_strdup (text); - - if (iti->fontname) - g_free (iti->fontname); - - iti->fontname = g_strdup (fontname ? fontname : DEFAULT_FONT_NAME); - - if (priv->font) - gdk_font_unref (priv->font); - - priv->font = NULL; - if (fontname) - priv->font = gdk_fontset_load (iti->fontname); - if (!priv->font) - priv->font = get_default_font (); - - /* Request update */ - - priv->need_pos_update = TRUE; - priv->need_font_update = TRUE; - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); -} - -/** - * e_icon_bar_text_item_set_width: - * @iti: An #EIconBarTextItem. - * @width: Maximum width allowed for this item, to be used for word wrapping. - * - * This routine is used to set the maximum width of an #EIconBarTextItem. - */ -void -e_icon_bar_text_item_set_width (EIconBarTextItem *iti, int width) -{ - ItiPrivate *priv; - - g_return_if_fail (iti != NULL); - g_return_if_fail (IS_ITI (iti)); - g_return_if_fail (width > 2 * MARGIN_X); - - priv = iti->priv; - - if (iti->width == width) - return; - - iti->width = width; - - /* Request update */ - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); -} - -/** - * e_icon_bar_text_item_setxy: - * @iti: An #EIconBarTextItem. - * @x: X position. - * @y: Y position. - * - * Sets the coordinates at which the #EIconBarTextItem should be placed. - * - * See also: e_icon_bar_text_item_configure(). - */ -void -e_icon_bar_text_item_setxy (EIconBarTextItem *iti, int x, int y) -{ - ItiPrivate *priv; - - g_return_if_fail (iti != NULL); - g_return_if_fail (IS_ITI (iti)); - - priv = iti->priv; - - iti->x = x; - iti->y = y; - - priv->need_pos_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); -} - -/** - * e_icon_bar_text_item_select: - * @iti: An #EIconBarTextItem. - * @sel: Whether the item should be displayed as selected. - * - * This function is used to control whether an icon text item is displayed as - * selected or not. Mouse events are ignored by the item when it is unselected; - * when the user clicks on a selected icon text item, it will start the text - * editing process. - */ -void -e_icon_bar_text_item_select (EIconBarTextItem *iti, int sel) -{ - ItiPrivate *priv; - - g_return_if_fail (iti != NULL); - g_return_if_fail (IS_ITI (iti)); - - priv = iti->priv; - - if (!iti->selected == !sel) - return; - - iti->selected = sel ? TRUE : FALSE; - - if (!iti->selected && iti->editing) - iti_edition_accept (iti); - - priv->need_state_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); -} - -/** - * e_icon_bar_text_item_get_text: - * @iti: An #EIconBarTextItem. - * - * Returns the current text. The client should not free this string, as it is - * internal to the #EIconBarTextItem. - */ -char * -e_icon_bar_text_item_get_text (EIconBarTextItem *iti) -{ - ItiPrivate *priv; - - g_return_val_if_fail (iti != NULL, NULL); - g_return_val_if_fail (IS_ITI (iti), NULL); - - priv = iti->priv; - - if (iti->editing) - return gtk_entry_get_text (priv->entry); - else - return iti->text; -} - - -/** - * e_icon_bar_text_item_set_text: - * @iti: An #EIconBarTextItem. - * @text: Text that is going to be displayed. - * @is_static: Whether @text points to a static string or not. - * - * If @is_static is true, it means that there is no need for the item to - * allocate memory for the string (it is a guarantee that the text is allocated - * by the caller and it will not be deallocated during the lifetime of this - * item). This is an optimization to reduce memory usage for large icon sets. - */ -void -e_icon_bar_text_item_set_text (EIconBarTextItem *iti, const char *text, - gboolean is_static) -{ - ItiPrivate *priv; - - g_return_if_fail (iti != NULL); - g_return_if_fail (IS_ITI (iti)); - g_return_if_fail (text != NULL); - - priv = iti->priv; - - if (iti->text && iti->is_text_allocated) - g_free (iti->text); - - iti->is_text_allocated = !is_static; - - /* This cast is to shut up the compiler */ - if (is_static) - iti->text = (char *) text; - else - iti->text = g_strdup (text); - - /* Request update */ - - priv->need_text_update = TRUE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (iti)); -} - - -/** - * e_icon_bar_text_item_start_editing: - * @iti: An #EIconBarTextItem. - * - * Starts the editing state of an #EIconBarTextItem. - **/ -void -e_icon_bar_text_item_start_editing (EIconBarTextItem *iti) -{ - g_return_if_fail (iti != NULL); - g_return_if_fail (IS_ITI (iti)); - - if (iti->editing) - return; - - iti->selected = TRUE; /* Ensure that we are selected */ - gnome_canvas_item_grab_focus (GNOME_CANVAS_ITEM (iti)); - iti_start_editing (iti); -} - -/** - * e_icon_bar_text_item_stop_editing: - * @iti: An #EIconBarTextItem. - * @accept: Whether to accept the current text or to discard it. - * - * Terminates the editing state of an icon text item. The @accept argument - * controls whether the item's current text should be accepted or discarded. - * If it is discarded, then the icon's original text will be restored. - **/ -void -e_icon_bar_text_item_stop_editing (EIconBarTextItem *iti, - gboolean accept) -{ - g_return_if_fail (iti != NULL); - g_return_if_fail (IS_ITI (iti)); - - if (!iti->editing) - return; - - if (accept) - iti_edition_accept (iti); - else - iti_stop_editing (iti); -} - - -/** - * e_icon_bar_text_item_get_type: - * - * Registers the &EIconBarTextItem class if necessary, and returns the type ID - * associated to it. - * - * Return value: the type ID of the #EIconBarTextItem class. - **/ -GtkType -e_icon_bar_text_item_get_type (void) -{ - static GtkType iti_type = 0; - - if (!iti_type) { - static const GtkTypeInfo iti_info = { - "EIconBarTextItem", - sizeof (EIconBarTextItem), - sizeof (EIconBarTextItemClass), - (GtkClassInitFunc) iti_class_init, - (GtkObjectInitFunc) iti_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - iti_type = gtk_type_unique (gnome_canvas_item_get_type (), &iti_info); - } - - return iti_type; -} - - -static void -free_row (gpointer data, gpointer user_data) -{ - EIconBarTextItemInfoRow *row; - - if (data) { - row = data; - g_free (row->text); - g_free (row->text_wc); - g_free (row); - } -} - -/* - * e_icon_bar_text_item_free_info: - * @ti: An icon text info structure. - * - * Frees a &EIconBarTextItemInfo structure. You should call this instead of - * freeing the structure yourself. - */ -static void -e_icon_bar_text_item_free_info (EIconBarTextItemInfo *ti) -{ - g_list_foreach (ti->rows, free_row, NULL); - g_list_free (ti->rows); - g_free (ti); -} - -/* - * e_icon_bar_text_item_layout_text: - * @font: Name of the font that will be used to render the text. - * @text: Text to be formatted. - * @separators: Separators used for word wrapping, can be NULL. - * @max_width: Width in pixels to be used for word wrapping. - * @confine: Whether it is mandatory to wrap at @max_width. - * - * Creates a new &EIconBarTextItemInfo structure by wrapping the specified - * text. If non-NULL, the @separators argument defines a set of characters - * to be used as word delimiters for performing word wrapping. If it is - * NULL, then only spaces will be used as word delimiters. - * - * The @max_width argument is used to specify the width at which word - * wrapping will be performed. If there is a very long word that does not - * fit in a single line, the @confine argument can be used to specify - * whether the word should be unconditionally split to fit or whether - * the maximum width should be increased as necessary. - * - * Return value: A newly-created &EIconBarTextItemInfo structure. - */ -static EIconBarTextItemInfo * -e_icon_bar_text_item_layout_text (EIconBarTextItem *iti, GdkFont *font, - const gchar *text, const gchar *separators, - gint max_width, gboolean confine) -{ - EIconBarTextItemInfo *ti; - EIconBarTextItemInfoRow *row; - GdkWChar *row_end; - GdkWChar *s, *word_start, *word_end, *old_word_end; - GdkWChar *sub_text; - int i, w_len, w; - GdkWChar *text_wc, *text_iter, *separators_wc; - int text_len_wc, separators_len_wc; - gboolean restrict_lines; - int lines; - - g_return_val_if_fail (font != NULL, NULL); - g_return_val_if_fail (text != NULL, NULL); - - if (!separators) - separators = " "; - - text_wc = g_new (GdkWChar, strlen (text) + 1); - text_len_wc = gdk_mbstowcs (text_wc, text, strlen (text)); - if (text_len_wc < 0) text_len_wc = 0; - text_wc[text_len_wc] = 0; - - separators_wc = g_new (GdkWChar, strlen (separators) + 1); - separators_len_wc = gdk_mbstowcs (separators_wc, separators, strlen (separators)); - if (separators_len_wc < 0) separators_len_wc = 0; - separators_wc[separators_len_wc] = 0; - - ti = g_new (EIconBarTextItemInfo, 1); - - ti->rows = NULL; - ti->font = font; - ti->width = 0; - ti->height = 0; - ti->baseline_skip = font->ascent + font->descent; - - word_end = NULL; - - if (!iti->editing && iti->max_lines != -1) - restrict_lines = TRUE; - else - restrict_lines = FALSE; - - text_iter = text_wc; - lines = 0; - while (*text_iter) { - /* If we are restricting the height, and this is the last line, - and we are displaying the ellipsis, then subtract the width - of the ellipsis from our max_width. */ - if (restrict_lines && lines == iti->max_lines - 1 - && iti->show_ellipsis) { - max_width -= gdk_string_measure (font, e_icon_bar_text_item_ellipsis); - } - - for (row_end = text_iter; *row_end != 0 && *row_end != '\n'; row_end++); - - /* Accumulate words from this row until they don't fit in the max_width */ - - s = text_iter; - - while (s < row_end) { - word_start = s; - old_word_end = word_end; - for (word_end = word_start; *word_end; word_end++) { - GdkWChar *p; - for (p = separators_wc; *p; p++) { - if (*word_end == *p) - goto found; - } - } - found: - if (word_end < row_end) - word_end++; - - if (gdk_text_width_wc (font, text_iter, word_end - text_iter) > max_width) { - if (word_start == text_iter - || (restrict_lines - && lines == iti->max_lines - 1)) { - if (confine) { - /* We must force-split the word. Look for a proper - * place to do it. - */ - - w_len = word_end - text_iter; - - for (i = 1; i < w_len; i++) { - w = gdk_text_width_wc (font, text_iter, i); - if (w > max_width) { - if (i == 1) - /* Shit, not even a single character fits */ - max_width = w; - else - break; - } - } - - /* Create sub-row with the chars that fit */ - - sub_text = g_new (GdkWChar, i); - memcpy (sub_text, text_iter, (i - 1) * sizeof (GdkWChar)); - sub_text[i - 1] = 0; - - row = g_new (EIconBarTextItemInfoRow, 1); - row->text_wc = sub_text; - row->text_length = i - 1; - row->width = gdk_text_width_wc (font, sub_text, i - 1); - row->text = gdk_wcstombs(sub_text); - if (row->text == NULL) - row->text = g_strdup(""); - - ti->rows = g_list_append (ti->rows, row); - - if (row->width > ti->width) - ti->width = row->width; - - ti->height += ti->baseline_skip; - - /* Bump the text pointer */ - - text_iter += i - 1; - s = text_iter; - - lines++; - if (restrict_lines - && lines >= iti->max_lines) - break; - - continue; - } else - max_width = gdk_text_width_wc (font, word_start, word_end - word_start); - - continue; /* Retry split */ - } else { - word_end = old_word_end; /* Restore to region that does fit */ - break; /* Stop the loop because we found something that doesn't fit */ - } - } - - s = word_end; - } - - if (restrict_lines && lines >= iti->max_lines) - break; - - /* Append row */ - - if (text_iter == row_end) { - /* We are on a newline, so append an empty row */ - - ti->rows = g_list_append (ti->rows, NULL); - ti->height += ti->baseline_skip; - - /* Next! */ - - text_iter = row_end + 1; - - lines++; - if (restrict_lines && lines >= iti->max_lines) - break; - - } else { - /* Create subrow and append it to the list */ - - int sub_len; - sub_len = word_end - text_iter; - - sub_text = g_new (GdkWChar, sub_len + 1); - memcpy (sub_text, text_iter, sub_len * sizeof (GdkWChar)); - sub_text[sub_len] = 0; - - row = g_new (EIconBarTextItemInfoRow, 1); - row->text_wc = sub_text; - row->text_length = sub_len; - row->width = gdk_text_width_wc (font, sub_text, sub_len); - row->text = gdk_wcstombs(sub_text); - if (row->text == NULL) - row->text = g_strdup(""); - - ti->rows = g_list_append (ti->rows, row); - - if (row->width > ti->width) - ti->width = row->width; - - ti->height += ti->baseline_skip; - - /* Next! */ - - text_iter = word_end; - - lines++; - if (restrict_lines && lines >= iti->max_lines) - break; - } - } - - /* Check if we've had to clip the text. */ - iti->is_clipped = *text_iter ? TRUE : FALSE; - - g_free (text_wc); - g_free (separators_wc); - return ti; -} - -/* - * e_icon_bar_text_item_paint_text: - * @ti: An icon text info structure. - * @drawable: Target drawable. - * @gc: GC used to render the string. - * @x: Left coordinate for text. - * @y: Upper coordinate for text. - * @just: Justification for text. - * - * Paints the formatted text in the icon text info structure onto a drawable. - * This is just a sample implementation; applications can choose to use other - * rendering functions. - */ -static void -e_icon_bar_text_item_paint_text (EIconBarTextItem *iti, - EIconBarTextItemInfo *ti, - GdkDrawable *drawable, GdkGC *gc, - gint x, gint y, GtkJustification just) -{ - GList *item; - EIconBarTextItemInfoRow *row; - int xpos, line, width; - gboolean show_ellipsis; - - g_return_if_fail (ti != NULL); - g_return_if_fail (drawable != NULL); - g_return_if_fail (gc != NULL); - - y += ti->font->ascent; - - for (item = ti->rows, line = 1; item; item = item->next, line++) { - - if (item->data) { - row = item->data; - width = row->width; - } - - /* If this is the last line, and the text has been clipped, - and show_ellipsis is TRUE, display '...' */ - if (line == iti->max_lines && iti->is_clipped) { - show_ellipsis = TRUE; - width += gdk_string_measure (ti->font, e_icon_bar_text_item_ellipsis); - } else { - show_ellipsis = FALSE; - } - - switch (just) { - case GTK_JUSTIFY_LEFT: - xpos = 0; - break; - - case GTK_JUSTIFY_RIGHT: - xpos = ti->width - width; - break; - - case GTK_JUSTIFY_CENTER: - xpos = (ti->width - width) / 2; - break; - - default: - /* Anyone care to implement GTK_JUSTIFY_FILL? */ - g_warning ("Justification type %d not supported. Using left-justification.", - (int) just); - xpos = 0; - } - - if (item->data) - gdk_draw_text_wc (drawable, ti->font, gc, x + xpos, y, row->text_wc, row->text_length); - - if (show_ellipsis) - gdk_draw_string (drawable, ti->font, gc, - x + xpos + row->width, y, - e_icon_bar_text_item_ellipsis); - - y += ti->baseline_skip; - } -} diff --git a/widgets/shortcut-bar/e-icon-bar-text-item.h b/widgets/shortcut-bar/e-icon-bar-text-item.h deleted file mode 100644 index ef621a4454..0000000000 --- a/widgets/shortcut-bar/e-icon-bar-text-item.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * Based on gnome-icon-text-item: an editable text block with word wrapping - * for the GNOME canvas. - * - * Copyright (C) 1998, 1999 The Free Software Foundation - * - * Authors: Miguel de Icaza - * Federico Mena - */ - -/* - * EIconBarTextItem - An editable canvas text item for the EIconBar. - */ - -#ifndef _E_ICON_BAR_TEXT_ITEM_H_ -#define _E_ICON_BAR_TEXT_ITEM_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -#define E_ICON_BAR_TEXT_ITEM(obj) (GTK_CHECK_CAST((obj), \ - e_icon_bar_text_item_get_type (), EIconBarTextItem)) -#define E_ICON_BAR_TEXT_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k),\ - e_icon_bar_text_item_get_type ())) -#define E_IS_ICON_BAR_TEXT_ITEM(o) (GTK_CHECK_TYPE((o), \ - e_icon_bar_text_item_get_type ())) - -typedef struct _EIconBarTextItemInfo EIconBarTextItemInfo; - -typedef struct { - GnomeCanvasItem canvas_item; - - /* Size and maximum allowed width */ - int x, y; - int width; - - /* Font name */ - char *fontname; - - /* Private data */ - gpointer priv; /* was GtkEntry *entry */ - - /* Actual text */ - char *text; - - /* Text layout information */ - EIconBarTextItemInfo *ti; - - /* Whether the text is being edited */ - unsigned int editing : 1; - - /* Whether the text item is selected */ - unsigned int selected : 1; - - /* Whether the user is select-dragging a block of text */ - unsigned int selecting : 1; - - /* Whether the text is editable */ - unsigned int is_editable : 1; - - /* Whether the text is allocated by us (FALSE if allocated by the client) */ - unsigned int is_text_allocated : 1; - - - /* The horizontal alignment of the text (default 0.5). */ - gfloat xalign; - - /* The justification of the text (default is centered). */ - GtkJustification justification; - - /* The max number of lines of text shown, or -1 for all (default). */ - gint max_lines; - - /* If '...' is displayed if the text doesn't all fit (default TRUE). */ - gboolean show_ellipsis; - - /* This is TRUE if we couldn't fit all the text in. */ - gboolean is_clipped; -} EIconBarTextItem; - -typedef struct { - GnomeCanvasItemClass parent_class; - - /* Signals we emit */ - int (* text_changed) (EIconBarTextItem *iti); - void (* height_changed) (EIconBarTextItem *iti); - void (* width_changed) (EIconBarTextItem *iti); - void (* editing_started) (EIconBarTextItem *iti); - void (* editing_stopped) (EIconBarTextItem *iti); - void (* selection_started) (EIconBarTextItem *iti); - void (* selection_stopped) (EIconBarTextItem *iti); -} EIconBarTextItemClass; - -GtkType e_icon_bar_text_item_get_type (void); - -void e_icon_bar_text_item_configure (EIconBarTextItem *iti, - int x, - int y, - int width, - const char *fontname, - const char *text, - gboolean is_static); - -void e_icon_bar_text_item_set_width (EIconBarTextItem *iti, - int width); - -void e_icon_bar_text_item_setxy (EIconBarTextItem *iti, - int x, - int y); - -void e_icon_bar_text_item_select (EIconBarTextItem *iti, - int sel); - -char* e_icon_bar_text_item_get_text (EIconBarTextItem *iti); -void e_icon_bar_text_item_set_text (EIconBarTextItem *iti, - const char *text, - gboolean is_static); - -void e_icon_bar_text_item_start_editing (EIconBarTextItem *iti); -void e_icon_bar_text_item_stop_editing (EIconBarTextItem *iti, - gboolean accept); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_ICON_BAR_TEXT_ITEM_H_ */ - diff --git a/widgets/shortcut-bar/e-icon-bar.c b/widgets/shortcut-bar/e-icon-bar.c deleted file mode 100644 index 9a34892218..0000000000 --- a/widgets/shortcut-bar/e-icon-bar.c +++ /dev/null @@ -1,1527 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * EIconBar is a subclass of ECanvas for displaying a vertical column of - * icons and descriptions. It provides 2 views - large icons and small icons. - */ - -#include -#include -#include -#include "e-icon-bar.h" -#include "e-icon-bar-bg-item.h" -#include "../e-text/e-text.h" - -/* These are the offsets of the icons & text in both views. Note that the - shadow around icons is drawn in the space between items (as is the - horizontal bar when dragging). */ -#define E_ICON_BAR_LARGE_ICON_SPACING 8 /* Spacing between items. */ -#define E_ICON_BAR_LARGE_ICON_WIDTH 48 -#define E_ICON_BAR_LARGE_ICON_HEIGHT 48 -#define E_ICON_BAR_LARGE_ICON_TEXT_X 4 -#define E_ICON_BAR_LARGE_ICON_TEXT_Y (E_ICON_BAR_LARGE_ICON_HEIGHT + 4) - -#define E_ICON_BAR_SMALL_ICON_SPACING 4 /* Spacing between items. */ -#define E_ICON_BAR_SMALL_ICON_WIDTH 24 -#define E_ICON_BAR_SMALL_ICON_HEIGHT 24 -#define E_ICON_BAR_SMALL_ICON_X 4 -#define E_ICON_BAR_SMALL_ICON_TEXT_X (E_ICON_BAR_SMALL_ICON_WIDTH + 6) - -/* The space we leave at the top or bottom of the bar when position an item - while it is being edited. This is used since the EIconBar may be in a - EScrolledBar which may show buttons at the top or bottom. */ -#define E_ICON_BAR_V_SPACE 22 - -/* The number of pixels the mouse has to be moved with the button down before - we start a drag. */ -#define E_ICON_BAR_DRAG_START_OFFSET 4 - -/* This is the area at the top & bottom of the bar where we auto-scroll if the - mouse goes into during a drag-and-drop operation. */ -#define E_ICON_BAR_DRAG_AUTO_SCROLL_OFFSET 16 - -/* This is the time between each auto-scroll, when dragging. */ -#define E_ICON_BAR_SCROLL_TIMEOUT 30 - -/* This is the number of timeouts we skip before we start scrolling. */ -#define E_ICON_BAR_SCROLL_DELAY 12 - - -static void e_icon_bar_class_init (EIconBarClass *class); -static void e_icon_bar_init (EIconBar *icon_bar); -static void e_icon_bar_destroy (GtkObject *object); -static void e_icon_bar_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gint e_icon_bar_leave_notify_event (GtkWidget *widget, - GdkEventCrossing *event); -static gint e_icon_bar_focus_in (GtkWidget *widget, - GdkEventFocus *event); -static gint e_icon_bar_focus_out (GtkWidget *widget, - GdkEventFocus *event); -static gint e_icon_bar_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time); -static void e_icon_bar_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint time); -static void e_icon_bar_set_dragging_before_item (EIconBar *icon_bar, - gint before_item); -static gboolean e_icon_bar_timeout_handler (gpointer data); - -static void e_icon_bar_recalc_common_positions (EIconBar *icon_bar); -static gint e_icon_bar_recalc_item_positions (EIconBar *icon_bar); -static void e_icon_bar_on_text_resized (GnomeCanvasItem *text_item, - EIconBar *icon_bar); -static gint e_icon_bar_find_item (EIconBar *icon_bar, - GnomeCanvasItem *text_item); -static gboolean e_icon_bar_on_item_event (GnomeCanvasItem *item, - GdkEvent *event, - EIconBar *icon_bar); - -static gboolean e_icon_bar_large_icons_intersects (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y); -static gboolean e_icon_bar_large_icons_is_before (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y); -static gboolean e_icon_bar_small_icons_intersects (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y); -static gboolean e_icon_bar_small_icons_is_before (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y); -static void e_icon_bar_on_editing_started (EIconBar *icon_bar, - GnomeCanvasItem *item); -static void e_icon_bar_on_editing_stopped (EIconBar *icon_bar, - GnomeCanvasItem *item); -static void e_icon_bar_ensure_edited_item_visible (EIconBar *icon_bar); -static void e_icon_bar_update_highlight (EIconBar *icon_bar); - -enum -{ - ITEM_SELECTED, - ITEM_DRAGGED, - LAST_SIGNAL -}; - -static guint e_icon_bar_signals[LAST_SIGNAL] = {0}; - -static ECanvasClass *parent_class; - - -GtkType -e_icon_bar_get_type (void) -{ - static GtkType e_icon_bar_type = 0; - - if (!e_icon_bar_type){ - GtkTypeInfo e_icon_bar_info = { - "EIconBar", - sizeof (EIconBar), - sizeof (EIconBarClass), - (GtkClassInitFunc) e_icon_bar_class_init, - (GtkObjectInitFunc) e_icon_bar_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (e_canvas_get_type ()); - e_icon_bar_type = gtk_type_unique (e_canvas_get_type (), - &e_icon_bar_info); - } - - return e_icon_bar_type; -} - - -static void -e_icon_bar_class_init (EIconBarClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - - e_icon_bar_signals[ITEM_SELECTED] = - gtk_signal_new ("item_selected", - GTK_RUN_LAST | GTK_RUN_ACTION, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarClass, - selected_item), - gtk_marshal_NONE__POINTER_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_GDK_EVENT, - GTK_TYPE_INT); - e_icon_bar_signals[ITEM_DRAGGED] = - gtk_signal_new ("item_dragged", - GTK_RUN_LAST | GTK_RUN_ACTION, - object_class->type, - GTK_SIGNAL_OFFSET (EIconBarClass, - dragged_item), - gtk_marshal_NONE__POINTER_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_GDK_EVENT, - GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, e_icon_bar_signals, - LAST_SIGNAL); - - /* Method override */ - object_class->destroy = e_icon_bar_destroy; - - widget_class->size_allocate = e_icon_bar_size_allocate; - widget_class->leave_notify_event = e_icon_bar_leave_notify_event; - widget_class->focus_in_event = e_icon_bar_focus_in; - widget_class->focus_out_event = e_icon_bar_focus_out; - widget_class->drag_motion = e_icon_bar_drag_motion; - widget_class->drag_leave = e_icon_bar_drag_leave; - - class->selected_item = NULL; -} - - -static void -e_icon_bar_init (EIconBar *icon_bar) -{ - GdkColormap *colormap; - gboolean success[E_ICON_BAR_COLOR_LAST]; - gint nfailed; - - icon_bar->view_type = E_ICON_BAR_LARGE_ICONS; - icon_bar->items = g_array_new (FALSE, FALSE, sizeof (EIconBarItem)); - icon_bar->pressed_item_num = -1; - icon_bar->mouse_over_item_num = -1; - icon_bar->editing_item_num = -1; - icon_bar->edit_rect_item = NULL; - icon_bar->in_drag = FALSE; - icon_bar->dragging_before_item_num = -1; - icon_bar->icon_x = 0; - icon_bar->icon_w = 0; - icon_bar->icon_h = 0; - icon_bar->text_x = 0; - icon_bar->text_w = 5; - icon_bar->auto_scroll_timeout_id = 0; - - /* Create the background item in the canvas, which handles selections - and drag-and-drop. */ - gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root), - e_icon_bar_bg_item_get_type (), - "EIconBarBgItem::icon_bar", icon_bar, - NULL); - - colormap = gtk_widget_get_colormap (GTK_WIDGET (icon_bar)); - - icon_bar->colors[E_ICON_BAR_COLOR_TEXT].red = 65535; - icon_bar->colors[E_ICON_BAR_COLOR_TEXT].green = 65535; - icon_bar->colors[E_ICON_BAR_COLOR_TEXT].blue = 65535; - - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_TEXT].red = 0; - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_TEXT].green = 0; - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_TEXT].blue = 0; - - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT].red = 65535; - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT].green = 65535; - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT].blue = 65535; - - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT_OUTLINE].red = 0; - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT_OUTLINE].green = 0; - icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT_OUTLINE].blue = 0; - - nfailed = gdk_colormap_alloc_colors (colormap, icon_bar->colors, - E_ICON_BAR_COLOR_LAST, FALSE, - TRUE, success); - if (nfailed) - g_warning ("Failed to allocate all colors"); -} - - -/** - * e_icon_bar_new: - * @Returns: A new #EIconBar. - * - * Creates a new #EIconBar. - **/ -GtkWidget * -e_icon_bar_new (void) -{ - GtkWidget *icon_bar; - - icon_bar = GTK_WIDGET (gtk_type_new (e_icon_bar_get_type ())); -#if 0 - GNOME_CANVAS(icon_bar)->aa = 1; -#endif - return icon_bar; -} - - -static void -e_icon_bar_destroy (GtkObject *object) -{ - EIconBar *icon_bar; - - icon_bar = E_ICON_BAR (object); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); - - g_array_free (icon_bar->items, TRUE); - - if (icon_bar->auto_scroll_timeout_id != 0) { - gtk_timeout_remove (icon_bar->auto_scroll_timeout_id); - icon_bar->auto_scroll_timeout_id = 0; - } -} - - -static void -e_icon_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation) -{ - EIconBar *icon_bar; - gint canvas_width, canvas_height, height; -#if 0 - g_print ("In e_icon_bar_size_allocate\n"); -#endif - icon_bar = E_ICON_BAR (widget); - - GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation); - - canvas_width = GTK_WIDGET (icon_bar)->allocation.width; - canvas_height = GTK_WIDGET (icon_bar)->allocation.height; - - /* Reset the y position and widths of all the items to the width of - the canvas, and reset the button labels, so they fit. */ - e_icon_bar_recalc_common_positions (icon_bar); - height = e_icon_bar_recalc_item_positions (icon_bar); - - gnome_canvas_set_scroll_region (GNOME_CANVAS (widget), - 0, 0, canvas_width, - MAX (height, canvas_height - 1)); - - /* If we are editing an item, make sure it is visible. */ - e_icon_bar_ensure_edited_item_visible (icon_bar); - - GTK_LAYOUT (widget)->vadjustment->step_increment = 16; - - e_icon_bar_update_highlight (icon_bar); -} - - -/* This sets all the item positions which are the same for all items in the - group. */ -static void -e_icon_bar_recalc_common_positions (EIconBar *icon_bar) -{ - gint canvas_width; - - canvas_width = GTK_WIDGET (icon_bar)->allocation.width; - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - icon_bar->icon_x = (canvas_width - E_ICON_BAR_LARGE_ICON_WIDTH) / 2; - icon_bar->icon_w = E_ICON_BAR_LARGE_ICON_WIDTH; - icon_bar->icon_h = E_ICON_BAR_LARGE_ICON_HEIGHT; - - icon_bar->text_x = E_ICON_BAR_LARGE_ICON_TEXT_X; - icon_bar->text_w = MAX (canvas_width - (E_ICON_BAR_LARGE_ICON_TEXT_X * 2), 5); - - icon_bar->spacing = E_ICON_BAR_LARGE_ICON_SPACING; - } else { - icon_bar->icon_x = E_ICON_BAR_SMALL_ICON_X; - icon_bar->icon_w = E_ICON_BAR_SMALL_ICON_WIDTH; - icon_bar->icon_h = E_ICON_BAR_SMALL_ICON_HEIGHT; - - icon_bar->text_x = E_ICON_BAR_SMALL_ICON_TEXT_X; - icon_bar->text_w = MAX (canvas_width - E_ICON_BAR_SMALL_ICON_TEXT_X, 5); - - icon_bar->spacing = E_ICON_BAR_SMALL_ICON_SPACING; - } -} - - -/* This recalculates the positions of all the items, according to the current - view type and the height of the text items. */ -static gint -e_icon_bar_recalc_item_positions (EIconBar *icon_bar) -{ - EIconBarItem *item; - gint y, item_num, text_h; - gdouble x1, y1, x2, y2, text_x; - GtkJustification justify; - GtkAnchorType anchor; - gint max_lines; - GdkFont *font; - gboolean line_wrap; - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - justify = GTK_JUSTIFY_CENTER; - anchor = GTK_ANCHOR_N; - max_lines = 2; - text_x = icon_bar->text_x + (icon_bar->text_w / 2); - line_wrap = TRUE; - } else { - justify = GTK_JUSTIFY_LEFT; - anchor = GTK_ANCHOR_NW; - max_lines = 1; - text_x = icon_bar->text_x; - font = GTK_WIDGET (icon_bar)->style->font; - text_h = font->ascent + font->descent; - line_wrap = FALSE; - } - - /* Now step through the items, setting the y positions. */ - y = icon_bar->spacing; - for (item_num = 0; item_num < icon_bar->items->len; item_num++) { - item = &g_array_index (icon_bar->items, - EIconBarItem, item_num); - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - item->icon_y = y; - item->text_y = y + E_ICON_BAR_LARGE_ICON_TEXT_Y; - } else { - item->text_height = text_h; - item->item_height = MAX (text_h, E_ICON_BAR_SMALL_ICON_HEIGHT); - item->icon_y = y + (item->item_height - E_ICON_BAR_SMALL_ICON_HEIGHT) / 2; - item->text_y = y + (item->item_height - item->text_height) / 2; - } - - gnome_canvas_item_set (item->text, - "clip_width", (gdouble) (icon_bar->text_w), - "justification", justify, - "anchor", anchor, - "max_lines", max_lines, - "line_wrap", line_wrap, - "x", text_x, - "y", (gdouble) item->text_y, - NULL); - - /* Get the text item's height. */ - gnome_canvas_item_get_bounds (item->text, &x1, &y1, &x2, &y2); - item->text_x = x1; - item->text_width = x2 - x1; - item->text_height = y2 - y1; - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - item->item_height = E_ICON_BAR_LARGE_ICON_TEXT_Y - + item->text_height; - } - - gnome_canvas_item_set (item->image, - "GnomeCanvasPixbuf::x", (gdouble)icon_bar->icon_x, - "GnomeCanvasPixbuf::y", (gdouble)item->icon_y, - "GnomeCanvasPixbuf::width_set", TRUE, - "GnomeCanvasPixbuf::height_set", TRUE, - "GnomeCanvasPixbuf::width", (gdouble)icon_bar->icon_w, - "GnomeCanvasPixbuf::height", (gdouble)icon_bar->icon_h, - NULL); - - y += item->item_height + icon_bar->spacing; - } - - return y; -} - - -static gint -e_icon_bar_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event) -{ - EIconBar *icon_bar; - - icon_bar = E_ICON_BAR (widget); - - GTK_WIDGET_CLASS (parent_class)->leave_notify_event (widget, event); - - /* Make sure no items are highlighted. */ - e_icon_bar_item_motion (icon_bar, -1, NULL); - - return FALSE; -} - - -static gint -e_icon_bar_focus_in (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (E_IS_ICON_BAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_CLASS (parent_class)->focus_in_event (widget, event); - GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); - return FALSE; -} - - -static gint -e_icon_bar_focus_out (GtkWidget *widget, - GdkEventFocus *event) -{ - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (E_IS_ICON_BAR (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - - GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, event); - GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS); - return FALSE; -} - - -/** - * e_icon_bar_set_view_type: - * @icon_bar: An #EIconBar. - * @view_type: The new view type, %E_ICON_BAR_LARGE_ICONS or - * %E_ICON_BAR_SMALL_ICONS. - * - * Sets the view type of the #EIconBar. - **/ -void -e_icon_bar_set_view_type (EIconBar *icon_bar, - EIconBarViewType view_type) -{ - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - - if (icon_bar->view_type == view_type) - return; - - icon_bar->view_type = view_type; - - /* Queue a resize of the canvas, so everything is put in the right - positions based on the new view type. */ - gtk_widget_queue_resize (GTK_WIDGET (icon_bar)); -} - - -/** - * e_icon_bar_add_item: - * @icon_bar: An #EIconBar. - * @image: the new item's icon. - * @text: the new item's text. - * @position: the position to place the new item, or -1 to place it last. - * - * Adds an item to the #EIconBar at the given position. - **/ -gint -e_icon_bar_add_item (EIconBar *icon_bar, - GdkPixbuf *image, - gchar *text, - gint position) -{ - EIconBarItem item; - GtkJustification justify; - GtkAnchorType anchor; - gint max_lines, retval; - GtkStyle *style; - GdkFont *font; - gdouble text_x, clip_height; - - g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), -1); - g_return_val_if_fail (text != NULL, -1); - g_return_val_if_fail (position >= -1, -1); - g_return_val_if_fail (position <= (gint)icon_bar->items->len, -1); - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - justify = GTK_JUSTIFY_CENTER; - anchor = GTK_ANCHOR_N; - max_lines = 2; - text_x = icon_bar->text_x + (icon_bar->text_w / 2); - } else { - justify = GTK_JUSTIFY_LEFT; - anchor = GTK_ANCHOR_NW; - max_lines = 1; - text_x = icon_bar->text_x; - } - - gtk_widget_ensure_style (GTK_WIDGET (icon_bar)); - style = GTK_WIDGET (icon_bar)->style; - font = style->font; - clip_height = max_lines * (font->ascent + font->descent); - item.text = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root), - e_text_get_type (), - "font_gdk", font, - "fill_color_gdk", &icon_bar->colors[E_ICON_BAR_COLOR_TEXT], - "use_ellipsis", TRUE, - "anchor", anchor, - "editable", TRUE, - "justification", justify, - "line_wrap", TRUE, - "max_lines", max_lines, - "x", text_x, - "y", (gdouble) 0, - "clip", TRUE, - "clip_width", (gdouble) (icon_bar->text_w), - "clip_height", clip_height, - "text", text, - NULL); - - gtk_signal_connect (GTK_OBJECT (item.text), "resize", - GTK_SIGNAL_FUNC (e_icon_bar_on_text_resized), - icon_bar); - gtk_signal_connect (GTK_OBJECT (item.text), "event", - GTK_SIGNAL_FUNC (e_icon_bar_on_item_event), - icon_bar); - - item.image = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root), - gnome_canvas_pixbuf_get_type (), - "GnomeCanvasPixbuf::pixbuf", image, - "GnomeCanvasPixbuf::width", (gdouble) icon_bar->icon_w, - "GnomeCanvasPixbuf::height", (gdouble) icon_bar->icon_h, - NULL); - gtk_signal_connect (GTK_OBJECT (item.image), "event", - GTK_SIGNAL_FUNC (e_icon_bar_on_item_event), - icon_bar); - - item.data = NULL; - item.destroy = NULL; - - if (position == -1) { - g_array_append_val (icon_bar->items, item); - retval = icon_bar->items->len - 1; - } else { - g_array_insert_val (icon_bar->items, position, item); - retval = position; - - /* FIXME: Should possibly update other indices. */ - if (icon_bar->dragged_item_num >= position) - icon_bar->dragged_item_num++; - } - - gtk_widget_queue_resize (GTK_WIDGET (icon_bar)); - - return retval; -} - - -/** - * e_icon_bar_reorder_item: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item to move. - * @new_position: The new position of the item, which is used after the item - * has been removed from its current position. If @new_position is -1, the item - * is placed last. - * - * Moves an item to a new position within the #EIconBar. - **/ -void -e_icon_bar_reorder_item (EIconBar *icon_bar, - gint item_num, - gint new_position) -{ - EIconBarItem tmp_item; - - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - g_return_if_fail (item_num >= 0); - g_return_if_fail (item_num < icon_bar->items->len); - g_return_if_fail (new_position >= -1); - g_return_if_fail (new_position < icon_bar->items->len); - - tmp_item = g_array_index (icon_bar->items, EIconBarItem, item_num); - g_array_remove_index (icon_bar->items, item_num); - - if (new_position == -1) - g_array_append_val (icon_bar->items, tmp_item); - else - g_array_insert_val (icon_bar->items, new_position, tmp_item); - - gtk_widget_queue_resize (GTK_WIDGET (icon_bar)); -} - - -/** - * e_icon_bar_remove_item: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item to remove. - * - * Removes an item from the #EIconBar. - **/ -void -e_icon_bar_remove_item (EIconBar *icon_bar, - gint item_num) -{ - EIconBarItem *item; - - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - g_return_if_fail (item_num >= 0); - g_return_if_fail (item_num < icon_bar->items->len); - - item = &g_array_index (icon_bar->items, EIconBarItem, item_num); - - if (item->destroy) - item->destroy (item->data); - - gtk_object_destroy (GTK_OBJECT (item->text)); - gtk_object_destroy (GTK_OBJECT (item->image)); - - g_array_remove_index (icon_bar->items, item_num); - - gtk_widget_queue_resize (GTK_WIDGET (icon_bar)); -} - - -/** - * e_icon_bar_get_item_image: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * @Returns: The icon of the given item. - * - * Returns the icon used for the given item. - **/ -GdkPixbuf * -e_icon_bar_get_item_image (EIconBar *icon_bar, - gint item_num) -{ - EIconBarItem *item; - GdkPixbuf *image = NULL; - - g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), NULL); - g_return_val_if_fail (item_num >= 0, NULL); - g_return_val_if_fail (item_num < icon_bar->items->len, NULL); - - item = &g_array_index (icon_bar->items, EIconBarItem, item_num); - gtk_object_get (GTK_OBJECT (item->image), - "GnomeCanvasPixbuf::pixbuf", &image, - NULL); - return image; -} - - -/** - * e_icon_bar_set_item_image: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * @image: The new icon to use for the given item. - * - * Sets the icon to use for the given item. - **/ -void -e_icon_bar_set_item_image (EIconBar *icon_bar, - gint item_num, - GdkPixbuf *image) -{ - EIconBarItem *item; - - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - g_return_if_fail (item_num >= 0); - g_return_if_fail (item_num < icon_bar->items->len); - - item = &g_array_index (icon_bar->items, EIconBarItem, item_num); - gnome_canvas_item_set (item->image, - "GnomeCanvasPixbuf::pixbuf", image, - NULL); -} - - -/** - * e_icon_bar_get_item_text: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * @Returns: The text of the given item. - * - * Returns the text of the given item. This should be freed when no longer - * needed. - **/ -gchar* -e_icon_bar_get_item_text (EIconBar *icon_bar, - gint item_num) -{ - EIconBarItem *item; - gchar *text; - - g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), NULL); - g_return_val_if_fail (item_num >= 0, NULL); - g_return_val_if_fail (item_num < icon_bar->items->len, NULL); - - item = &g_array_index (icon_bar->items, EIconBarItem, item_num); - gtk_object_get (GTK_OBJECT (item->text), - "EText::text", &text, - NULL); - - return text; -} - - -/** - * e_icon_bar_set_item_text: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * @text: The new text for the given item. - * - * Sets the text of the given item. - **/ -void -e_icon_bar_set_item_text (EIconBar *icon_bar, - gint item_num, - gchar *text) -{ - EIconBarItem *item; - - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - g_return_if_fail (item_num >= 0); - g_return_if_fail (item_num < icon_bar->items->len); - - item = &g_array_index (icon_bar->items, EIconBarItem, item_num); - gnome_canvas_item_set (item->text, - "EText::text", text, - NULL); -} - - -/** - * e_icon_bar_get_item_data: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * @Returns: The user data associated with the given item. - * - * Returns the user data associated with the given item. - **/ -gpointer -e_icon_bar_get_item_data (EIconBar *icon_bar, - gint item_num) -{ - EIconBarItem *item; - - g_return_val_if_fail (E_IS_ICON_BAR (icon_bar), NULL); - g_return_val_if_fail (item_num >= 0, NULL); - g_return_val_if_fail (item_num < icon_bar->items->len, NULL); - - item = &g_array_index (icon_bar->items, EIconBarItem, item_num); - return item->data; -} - - -/** - * e_icon_bar_set_item_data: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * @data: The user data to set for the given item. - * - * Sets the user data of the given item. - **/ -void -e_icon_bar_set_item_data (EIconBar *icon_bar, - gint item_num, - gpointer data) -{ - e_icon_bar_set_item_data_full (icon_bar, item_num, data, NULL); -} - - -/** - * e_icon_bar_set_item_data_full: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * @data: The user data to set for the given item. - * @destroy: The function to free @data when the item is destroyed. - * - * Sets the user data of the given item, and the function to free the data - * when the item is destroyed. - **/ -void -e_icon_bar_set_item_data_full (EIconBar *icon_bar, - gint item_num, - gpointer data, - GtkDestroyNotify destroy) -{ - EIconBarItem *item; - - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - g_return_if_fail (item_num >= 0); - g_return_if_fail (item_num < icon_bar->items->len); - - item = &g_array_index (icon_bar->items, EIconBarItem, item_num); - - if (item->destroy) - item->destroy (item->data); - - item->data = data; - item->destroy = destroy; -} - - -static void -e_icon_bar_on_text_resized (GnomeCanvasItem *text_item, - EIconBar *icon_bar) -{ -#if 0 - g_print ("In e_icon_bar_on_text_resized\n"); -#endif - gtk_widget_queue_resize (GTK_WIDGET (icon_bar)); -} - - -/* This returns the index of the given item, or -1 if it isn't found. */ -static gint -e_icon_bar_find_item (EIconBar *icon_bar, - GnomeCanvasItem *canvas_item) -{ - EIconBarItem *item; - gint item_num; - - for (item_num = 0; item_num < icon_bar->items->len; item_num++) { - item = &g_array_index (icon_bar->items, - EIconBarItem, item_num); - - if (item->text == canvas_item || item->image == canvas_item) { - return item_num; - } - } - - return -1; -} - - -/* When an item has a grab, it will get all events, so we need to use the - position to find the real item. */ -static gboolean -e_icon_bar_on_item_event (GnomeCanvasItem *item, - GdkEvent *event, - EIconBar *icon_bar) -{ - gint item_num; - - switch (event->type) { - case GDK_BUTTON_PRESS: - item_num = e_icon_bar_find_item_at_position (icon_bar, - event->button.x, - event->button.y, - NULL); - /* If the item is not being edited, we handle the event and - stop the signal so the text editing isn't started. */ - if (icon_bar->editing_item_num == -1 - || icon_bar->editing_item_num != item_num) { - e_icon_bar_item_pressed (icon_bar, item_num, event); - gtk_signal_emit_stop_by_name (GTK_OBJECT (item), - "event"); - return TRUE; - } - break; - case GDK_BUTTON_RELEASE: - item_num = e_icon_bar_find_item_at_position (icon_bar, - event->button.x, - event->button.y, - NULL); - /* If the item is not being edited, we handle the event and - stop the signal so the text editing isn't started. */ - if (icon_bar->editing_item_num == -1 - || icon_bar->editing_item_num != item_num) { - e_icon_bar_item_released (icon_bar, item_num, event); - gtk_signal_emit_stop_by_name (GTK_OBJECT (item), - "event"); - return TRUE; - } - break; - case GDK_MOTION_NOTIFY: - item_num = e_icon_bar_find_item_at_position (icon_bar, - event->motion.x, - event->motion.y, - NULL); - e_icon_bar_item_motion (icon_bar, item_num, event); - return TRUE; - case GDK_FOCUS_CHANGE: - if (event->focus_change.in) - e_icon_bar_on_editing_started (icon_bar, item); - else - e_icon_bar_on_editing_stopped (icon_bar, item); - - return FALSE; - default: - break; - } - - return FALSE; -} - - -void -e_icon_bar_item_pressed (EIconBar *icon_bar, - gint item_num, - GdkEvent *event) -{ - gint button; - - /* If we are editing an item, and a different item (or anywhere outside - an item) is clicked, stop the edit. If the item being edited is - clicked we just return, since the user may be selecting text. */ - if (icon_bar->editing_item_num != -1) { - if (icon_bar->editing_item_num != item_num) { - e_icon_bar_stop_editing_item (icon_bar, TRUE); - } - return; - } - - button = event->button.button; - - if (button == 1 && item_num != -1) { - icon_bar->pressed_item_num = item_num; - icon_bar->pressed_x = event->button.x; - icon_bar->pressed_y = event->button.y; - gtk_widget_queue_draw (GTK_WIDGET (icon_bar)); - } else if (button == 3) { - gtk_signal_emit (GTK_OBJECT (icon_bar), - e_icon_bar_signals[ITEM_SELECTED], - event, item_num); - } -} - - -void -e_icon_bar_item_released (EIconBar *icon_bar, - gint item_num, - GdkEvent *event) -{ - gint button; - - /* If we are editing an item, just return. */ - if (icon_bar->editing_item_num != -1) - return; - - button = event->button.button; - - if (button == 1) { - if (icon_bar->pressed_item_num != -1 - && icon_bar->pressed_item_num == icon_bar->mouse_over_item_num) { - gtk_signal_emit (GTK_OBJECT (icon_bar), - e_icon_bar_signals[ITEM_SELECTED], - event, item_num); - } - - icon_bar->pressed_item_num = -1; - gtk_widget_queue_draw (GTK_WIDGET (icon_bar)); - } -} - - -void -e_icon_bar_item_motion (EIconBar *icon_bar, - gint item_num, - GdkEvent *event) -{ - gboolean need_redraw = TRUE; - - if (event && event->motion.state & GDK_BUTTON1_MASK - && icon_bar->pressed_item_num != -1) { - if (abs (event->motion.x - icon_bar->pressed_x) > E_ICON_BAR_DRAG_START_OFFSET - || abs (event->motion.y - icon_bar->pressed_y) > E_ICON_BAR_DRAG_START_OFFSET) { - icon_bar->dragged_item_num = icon_bar->pressed_item_num; - gtk_signal_emit (GTK_OBJECT (icon_bar), - e_icon_bar_signals[ITEM_DRAGGED], - event, icon_bar->dragged_item_num); - - /* Don't show the button as pressed while dragging. */ - icon_bar->pressed_item_num = -1; - gtk_widget_queue_draw (GTK_WIDGET (icon_bar)); - } - - return; - } - - if (icon_bar->mouse_over_item_num == item_num) - return; - - /* If we are editing an item, items aren't highlighted so we don't - need a redraw. Also if an item is pressed, we only need a redraw if - item_num or the old mouse_over_item_num is the pressed item. */ - if (icon_bar->editing_item_num != -1) { - need_redraw = FALSE; - } else if (icon_bar->pressed_item_num != -1) { - if (icon_bar->pressed_item_num != item_num - && icon_bar->pressed_item_num != icon_bar->mouse_over_item_num) - need_redraw = FALSE; - } - - icon_bar->mouse_over_item_num = item_num; - - if (need_redraw) - gtk_widget_queue_draw (GTK_WIDGET (icon_bar)); -} - - -/* This returns the index of the item at the given position on the EIconBar, - or -1 if no item is found. If before_item is not NULL, it returns the - item which the mouse is before, or -1 (for dragging). */ -gint -e_icon_bar_find_item_at_position (EIconBar *icon_bar, - gint x, - gint y, - gint *before_item) -{ - EIconBarItem *item = NULL; - gint item_num; - - if (before_item) - *before_item = -1; - - for (item_num = 0; item_num < icon_bar->items->len; item_num++) { - item = &g_array_index (icon_bar->items, - EIconBarItem, item_num); - - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - if (e_icon_bar_large_icons_intersects (icon_bar, item, - x, y)) - return item_num; - - if (before_item - && e_icon_bar_large_icons_is_before (icon_bar, - item, x, y)) { - *before_item = item_num; - return -1; - } - } else { - if (e_icon_bar_small_icons_intersects (icon_bar, item, - x, y)) - return item_num; - - if (before_item - && e_icon_bar_small_icons_is_before (icon_bar, - item, x, y)) { - *before_item = item_num; - return -1; - } - - } - - } - - /* If the mouse is below all the items, but inside the items' width, - and before_item is not NULL, we set it to the number of items, so - the dropped item would be added at the end. Note that this assumes - that the item variable points to the last item in the EIconBar. */ - if (before_item) { - if (icon_bar->view_type == E_ICON_BAR_LARGE_ICONS) { - if (x < icon_bar->text_x - || x >= icon_bar->text_x + icon_bar->text_w) - return -1; - - if (item == NULL - || y > item->icon_y + item->item_height) - *before_item = icon_bar->items->len; - } else { - if (x < icon_bar->icon_x - || x >= icon_bar->text_x + icon_bar->text_w) - return -1; - - if (item == NULL) { - *before_item = icon_bar->items->len; - } else { - gint max_y; - max_y = MAX (item->icon_y + icon_bar->icon_h, - item->text_y + item->text_height); - if (y > max_y) - *before_item = icon_bar->items->len; - } - } - } - - return -1; -} - - -static gboolean -e_icon_bar_large_icons_intersects (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y) -{ - if (y < item->icon_y || y >= item->text_y + item->text_height) - return FALSE; - - if (y < item->icon_y + icon_bar->icon_h) { - if (x < icon_bar->icon_x - || x >= icon_bar->icon_x + icon_bar->icon_w) - return FALSE; - } else { - if (x < item->text_x - || x >= item->text_x + item->text_width) - return FALSE; - } - - return TRUE; -} - - -static gboolean -e_icon_bar_large_icons_is_before (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y) -{ - if (y < item->icon_y - icon_bar->spacing - || y >= item->icon_y) - return FALSE; - - if (x < icon_bar->text_x || x >= icon_bar->text_x + icon_bar->text_w) - return FALSE; - - return TRUE; -} - - -static gboolean -e_icon_bar_small_icons_intersects (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y) -{ - gint min_y, max_y; - - min_y = MIN (item->icon_y, item->text_y); - max_y = MAX (item->icon_y + icon_bar->icon_h, - item->text_y + item->text_height); - - if (y < min_y || y >= max_y) - return FALSE; - - if (x < icon_bar->icon_x || x >= item->text_x + item->text_width) - return FALSE; - - return TRUE; -} - - -static gboolean -e_icon_bar_small_icons_is_before (EIconBar *icon_bar, - EIconBarItem *item, - gint x, - gint y) -{ - gint min_y, max_y; - - max_y = MIN (item->icon_y, item->text_y); - min_y = max_y - icon_bar->spacing; - - if (y < min_y || y >= max_y) - return FALSE; - - if (x < icon_bar->icon_x || x >= icon_bar->text_x + icon_bar->text_w) - return FALSE; - - return TRUE; -} - - -/** - * e_icon_bar_start_editing_item: - * @icon_bar: An #EIconBar. - * @item_num: The index of the item. - * - * Turns the item into an editable text field so the user can rename it. - * Editing is stopped automatically when the user hits 'Return' or clicks - * outside the item. It can also be stopped explicitly by calling - * e_icon_bar_stop_editing_item(). - **/ -void -e_icon_bar_start_editing_item (EIconBar *icon_bar, - gint item_num) -{ - EIconBarItem *item; - - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - g_return_if_fail (item_num >= 0); - g_return_if_fail (item_num < icon_bar->items->len); - - item = &g_array_index (icon_bar->items, - EIconBarItem, item_num); - e_canvas_item_grab_focus (item->text); -} - - -/** - * e_icon_bar_stop_editing_item: - * @icon_bar: An #EIconBar. - * @accept: TRUE if the changes should be accepted, FALSE if the text should be - * changed back to its state before the editing started. - * - * Stops the editing of the items, if any were being edited. - **/ -void -e_icon_bar_stop_editing_item (EIconBar *icon_bar, - gboolean accept) -{ - EIconBarItem *item; - GtkWidget *toplevel; - - g_return_if_fail (E_IS_ICON_BAR (icon_bar)); - - if (icon_bar->editing_item_num != -1) { - item = &g_array_index (icon_bar->items, EIconBarItem, - icon_bar->editing_item_num); - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (icon_bar)); - if (toplevel && GTK_IS_WINDOW (toplevel)) - gtk_window_set_focus (GTK_WINDOW (toplevel), NULL); - } -} - - -static void -e_icon_bar_on_editing_started (EIconBar *icon_bar, - GnomeCanvasItem *item) -{ - gint item_num; - gdouble x1, y1, x2, y2; - - item_num = e_icon_bar_find_item (icon_bar, item); - g_return_if_fail (item_num != -1); - - /* Turn off any highlighted item. */ - e_icon_bar_item_motion (icon_bar, -1, NULL); - - icon_bar->editing_item_num = item_num; - - e_icon_bar_ensure_edited_item_visible (icon_bar); - - /* Set the fg & bg colors. */ - gnome_canvas_item_set (item, - "fill_color_gdk", &icon_bar->colors[E_ICON_BAR_COLOR_EDITING_TEXT], - NULL); - - /* Create the edit rect if necessary. */ - if (!icon_bar->edit_rect_item) { - icon_bar->edit_rect_item = - gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (icon_bar)->root), - gnome_canvas_rect_get_type(), - "fill_color_gdk", &icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT], - "outline_color_gdk", &icon_bar->colors[E_ICON_BAR_COLOR_EDITING_RECT_OUTLINE], - NULL); - } - - gnome_canvas_item_get_bounds (item, &x1, &y1, &x2, &y2); - gnome_canvas_item_set (icon_bar->edit_rect_item, - "x1", x1 - 1, - "y1", y1 - 1, - "x2", x2 + 1, - "y2", y2 + 1, - NULL); - gnome_canvas_item_show (icon_bar->edit_rect_item); - - /* Make sure the text item is on top. */ - gnome_canvas_item_raise_to_top (item); -} - - -static void -e_icon_bar_on_editing_stopped (EIconBar *icon_bar, - GnomeCanvasItem *item) -{ - gint item_num; - - item_num = e_icon_bar_find_item (icon_bar, item); - g_return_if_fail (item_num != -1); - - icon_bar->editing_item_num = -1; - - e_icon_bar_update_highlight (icon_bar); - - /* Reset the fg & bg colors. */ - gnome_canvas_item_set (item, - "fill_color_gdk", &icon_bar->colors[E_ICON_BAR_COLOR_TEXT], - NULL); - - if (icon_bar->edit_rect_item) { - gnome_canvas_item_hide (icon_bar->edit_rect_item); - } -} - - -static void -e_icon_bar_ensure_edited_item_visible (EIconBar *icon_bar) -{ - EIconBarItem *item; - gint scroll_x, scroll_y, min_scroll_y, max_scroll_y, new_scroll_y; - - if (icon_bar->editing_item_num == -1) - return; - - item = &g_array_index (icon_bar->items, - EIconBarItem, icon_bar->editing_item_num); - gnome_canvas_get_scroll_offsets (GNOME_CANVAS (icon_bar), - &scroll_x, &scroll_y); - - /* The minimum scroll y position is with the text right on the bottom - of the display. */ - min_scroll_y = item->text_y + item->text_height + E_ICON_BAR_V_SPACE - - GTK_WIDGET (icon_bar)->allocation.height; - /* The maximum scroll y position is with the text at the top. */ - max_scroll_y = item->text_y - E_ICON_BAR_V_SPACE; - - new_scroll_y = MAX (scroll_y, min_scroll_y); - new_scroll_y = MIN (new_scroll_y, max_scroll_y); - - if (new_scroll_y != scroll_y) - gnome_canvas_scroll_to (GNOME_CANVAS (icon_bar), - scroll_x, new_scroll_y); -} - - -/* This gets the mouse position and updates the highlight if necessary. - It is called after items are added/deleted/scrolled/edited. */ -static void -e_icon_bar_update_highlight (EIconBar *icon_bar) -{ - GtkWidget *widget; - gint x, y, item_num; - - widget = GTK_WIDGET (icon_bar); - - if (!widget->window) - return; - - gdk_window_get_pointer (widget->window, &x, &y, NULL); - - if (x < 0 || y < 0 - || x > widget->allocation.width || y > widget->allocation.height) - return; - - item_num = e_icon_bar_find_item_at_position (icon_bar, x, y, NULL); - e_icon_bar_item_motion (icon_bar, item_num, NULL); -} - - -static gint -e_icon_bar_drag_motion (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - guint time) -{ - EIconBar *icon_bar; - gint item_num, before_item, scroll_x, scroll_y; - - g_return_val_if_fail (E_IS_ICON_BAR (widget), FALSE); - - icon_bar = E_ICON_BAR (widget); - - icon_bar->in_drag = TRUE; - - /* Check if the mouse is over or between items, and if so highlight. */ - gnome_canvas_get_scroll_offsets (GNOME_CANVAS (icon_bar), - &scroll_x, &scroll_y); - item_num = e_icon_bar_find_item_at_position (icon_bar, - x + scroll_x, - y + scroll_y, - &before_item); - e_icon_bar_item_motion (icon_bar, item_num, NULL); - e_icon_bar_set_dragging_before_item (icon_bar, before_item); - - /* Check if the mouse is at the top or bottom of the bar, and if it is - scroll up/down. */ - if (y < E_ICON_BAR_DRAG_AUTO_SCROLL_OFFSET) - icon_bar->scrolling_up = TRUE; - else if (y >= widget->allocation.height - E_ICON_BAR_DRAG_AUTO_SCROLL_OFFSET) - icon_bar->scrolling_up = FALSE; - else { - if (icon_bar->auto_scroll_timeout_id != 0) { - gtk_timeout_remove (icon_bar->auto_scroll_timeout_id); - icon_bar->auto_scroll_timeout_id = 0; - } - return FALSE; - } - - if (icon_bar->auto_scroll_timeout_id == 0) { - icon_bar->auto_scroll_timeout_id = g_timeout_add (E_ICON_BAR_SCROLL_TIMEOUT, e_icon_bar_timeout_handler, icon_bar); - icon_bar->auto_scroll_delay = E_ICON_BAR_SCROLL_DELAY; - } - - return FALSE; -} - - -static void -e_icon_bar_drag_leave (GtkWidget *widget, - GdkDragContext *context, - guint time) -{ - EIconBar *icon_bar; - - g_return_if_fail (E_IS_ICON_BAR (widget)); - - icon_bar = E_ICON_BAR (widget); - - icon_bar->in_drag = FALSE; - - if (icon_bar->auto_scroll_timeout_id != 0) { - gtk_timeout_remove (icon_bar->auto_scroll_timeout_id); - icon_bar->auto_scroll_timeout_id = 0; - } - - if (icon_bar->mouse_over_item_num != -1) { - icon_bar->mouse_over_item_num = -1; - gtk_widget_queue_draw (GTK_WIDGET (icon_bar)); - } -} - - -static void -e_icon_bar_set_dragging_before_item (EIconBar *icon_bar, - gint before_item) -{ - if (icon_bar->dragging_before_item_num == before_item) - return; - - icon_bar->dragging_before_item_num = before_item; - - gtk_widget_queue_draw (GTK_WIDGET (icon_bar)); -} - - -static gboolean -e_icon_bar_timeout_handler (gpointer data) -{ - EIconBar *icon_bar; - gint scroll_x, scroll_y, new_scroll_y; - GtkAdjustment *adj; - - g_return_val_if_fail (E_IS_ICON_BAR (data), FALSE); - - icon_bar = E_ICON_BAR (data); - - GDK_THREADS_ENTER (); - - if (icon_bar->auto_scroll_delay > 0) { - icon_bar->auto_scroll_delay--; - GDK_THREADS_LEAVE (); - return TRUE; - } - - gnome_canvas_get_scroll_offsets (GNOME_CANVAS (icon_bar), - &scroll_x, &scroll_y); - - adj = GTK_LAYOUT (icon_bar)->vadjustment; - - if (icon_bar->scrolling_up) - new_scroll_y = MAX (scroll_y - adj->step_increment, 0); - else - new_scroll_y = MIN (scroll_y + adj->step_increment, - adj->upper - adj->page_size); - - if (new_scroll_y != scroll_y) - gnome_canvas_scroll_to (GNOME_CANVAS (icon_bar), - scroll_x, new_scroll_y); - - GDK_THREADS_LEAVE (); - return TRUE; -} diff --git a/widgets/shortcut-bar/e-icon-bar.h b/widgets/shortcut-bar/e-icon-bar.h deleted file mode 100644 index 61c5f4dacc..0000000000 --- a/widgets/shortcut-bar/e-icon-bar.h +++ /dev/null @@ -1,240 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ -#ifndef _E_ICON_BAR_H_ -#define _E_ICON_BAR_H_ - -#include -#include -#include "../../e-util/e-canvas.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * EIconBar is a subclass of GnomeCanvas for displaying a vertical column of - * icons and descriptions. It provides 2 views - large icons and small icons. - */ - - -/* This contains information on one item. */ -typedef struct _EIconBarItem EIconBarItem; -struct _EIconBarItem -{ - GnomeCanvasItem *text; - GnomeCanvasItem *image; - - /* This is user data attached to the item, e.g. a URL. */ - gpointer data; - GtkDestroyNotify destroy; - - /* This is the height of the item. */ - gint item_height; - - /* This is the actual x, width and height of the text, rather than - the maximum allowed area. */ - gint text_x; - gint text_width; - gint text_height; - - gint icon_y, text_y; -}; - - -/* These are the view types. Defaults to LARGE_ICONS. */ -typedef enum -{ - E_ICON_BAR_LARGE_ICONS, - E_ICON_BAR_SMALL_ICONS -} EIconBarViewType; - - -/* These index our colors array. */ -typedef enum -{ - E_ICON_BAR_COLOR_TEXT, - E_ICON_BAR_COLOR_EDITING_TEXT, - E_ICON_BAR_COLOR_EDITING_RECT, - E_ICON_BAR_COLOR_EDITING_RECT_OUTLINE, - - E_ICON_BAR_COLOR_LAST -} EIconBarColors; - - -#define E_ICON_BAR(obj) GTK_CHECK_CAST (obj, e_icon_bar_get_type (), EIconBar) -#define E_ICON_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_icon_bar_get_type (), EIconBarClass) -#define E_IS_ICON_BAR(obj) GTK_CHECK_TYPE (obj, e_icon_bar_get_type ()) - - -typedef struct _EIconBar EIconBar; -typedef struct _EIconBarClass EIconBarClass; - -struct _EIconBar -{ - ECanvas canvas; - - /* This specifies if we are using large icons or small icons. */ - EIconBarViewType view_type; - - /* This is an array of EIconBarItem elements. */ - GArray *items; - - /* This is the index of the item which has been pressed, or -1. - It will be shown as pressed in while the mouse is over it. */ - gint pressed_item_num; - - /* This is the coordinates of where the button was pressed. If the - mouse moves a certain distance with the button still pressed, we - start a drag. */ - gint pressed_x; - gint pressed_y; - - /* This is the index of the item the mouse is currently over, or -1. - It will be highlighted unless one of the items is pressed. */ - gint mouse_over_item_num; - - /* This is the item that we are currently editing, or -1. */ - gint editing_item_num; - - /* This is a GnomeCanvasRect which is placed around the edited item. */ - GnomeCanvasItem *edit_rect_item; - - /* This is the index of the item which is being dragged, or -1. - If the drag results in a move it will be deleted. */ - gint dragged_item_num; - - /* This is TRUE if we are dragging over this EIconBar. */ - gboolean in_drag; - - /* This is used in drag-and-drop to indicate the item which the mouse - is currently before, e.g. if it is 1 then a dropped item would be - inserted between items 0 and 1. It ranges from 0 to the number of - items, or is -1 when the mouse is not dragging between items. */ - gint dragging_before_item_num; - - /* These are the common positions of all the items in the EIconBar. */ - gint icon_x, icon_w, icon_h, text_x, text_w, spacing; - - /* This is the source id of our auto-scroll timeout handler, used when - in the middle of drag-and-drop operations. */ - gint auto_scroll_timeout_id; - gint auto_scroll_delay; - gboolean scrolling_up; - - /* Colors for drawing. */ - GdkColor colors[E_ICON_BAR_COLOR_LAST]; -}; - -struct _EIconBarClass -{ - ECanvasClass parent_class; - - void (*selected_item) (EIconBar *icon_bar, - GdkEvent *event, - gint item_num); - void (*dragged_item) (EIconBar *icon_bar, - GdkEvent *event, - gint item_num); -}; - - -GtkType e_icon_bar_get_type (void); -GtkWidget* e_icon_bar_new (void); - -/* Sets the view type. */ -void e_icon_bar_set_view_type (EIconBar *icon_bar, - EIconBarViewType view_type); - -/* Adds a new item to a group at the given position. If position is -1 it is - added at the end. It returns the index of the item. */ -gint e_icon_bar_add_item (EIconBar *icon_bar, - GdkPixbuf *image, - gchar *text, - gint position); - -/* Reorders an item. Note that position refers to the new position to add the - item after removing it from its current position. If position is -1 it is - moved to the end of the bar. */ -void e_icon_bar_reorder_item (EIconBar *icon_bar, - gint item_num, - gint new_position); -void e_icon_bar_remove_item (EIconBar *icon_bar, - gint item_num); - -GdkPixbuf * e_icon_bar_get_item_image (EIconBar *icon_bar, - gint item_num); -void e_icon_bar_set_item_image (EIconBar *icon_bar, - gint item_num, - GdkPixbuf *image); - -gchar* e_icon_bar_get_item_text (EIconBar *icon_bar, - gint item_num); -void e_icon_bar_set_item_text (EIconBar *icon_bar, - gint item_num, - gchar *text); - -gpointer e_icon_bar_get_item_data (EIconBar *icon_bar, - gint item_num); -void e_icon_bar_set_item_data (EIconBar *icon_bar, - gint item_num, - gpointer data); -void e_icon_bar_set_item_data_full (EIconBar *icon_bar, - gint item_num, - gpointer data, - GtkDestroyNotify destroy); - -void e_icon_bar_start_editing_item (EIconBar *icon_bar, - gint item_num); -void e_icon_bar_stop_editing_item (EIconBar *icon_bar, - gboolean accept); - - - -/* - * INTERNAL FUNCTIONS - for use by EIconBarBgItem. - */ - -/* This returns the index of the item at the given position on the EIconBar, - or -1 if no item is found. If before_item is not NULL, it returns the - item which the mouse is before, or -1 (this is used for dragging). */ -gint e_icon_bar_find_item_at_position (EIconBar *icon_bar, - gint x, - gint y, - gint *before_item); - -void e_icon_bar_item_pressed (EIconBar *icon_bar, - gint item_num, - GdkEvent *event); -void e_icon_bar_item_released (EIconBar *icon_bar, - gint item_num, - GdkEvent *event); -void e_icon_bar_item_motion (EIconBar *icon_bar, - gint item_num, - GdkEvent *event); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_ICON_BAR_H_ */ diff --git a/widgets/shortcut-bar/e-shortcut-bar.c b/widgets/shortcut-bar/e-shortcut-bar.c deleted file mode 100644 index 431b9c1934..0000000000 --- a/widgets/shortcut-bar/e-shortcut-bar.c +++ /dev/null @@ -1,562 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * ShortcutBar displays a vertical bar with a number of Groups, each of which - * contains any number of icons. It is used on the left of the main application - * window so users can easily access items such as folders and files. - */ - -#include -#include - -#include "e-shortcut-bar.h" -#include "e-clipped-label.h" -#include "e-vscrolled-bar.h" - -/* Drag and Drop stuff. */ -enum { - TARGET_SHORTCUT -}; -static GtkTargetEntry target_table[] = { - { "E-SHORTCUT", 0, TARGET_SHORTCUT } -}; -static guint n_targets = sizeof(target_table) / sizeof(target_table[0]); - -typedef struct _EShortcutBarBuiltinType EShortcutBarBuiltinType; -struct _EShortcutBarBuiltinType { - gchar *name; - gchar *filename; - GdkPixbuf *image; -}; - -EShortcutBarBuiltinType e_shortcut_bar_builtin_types[] = { - { "folder:", "gnome-word.png", NULL }, - { "calendar:", "gnome-calendar.png", NULL }, - { "todo:", "gnome-cromagnon.png", NULL }, - { "contacts:", "gnome-ccthemes.png", NULL } -}; -static gint e_shortcut_bar_num_builtin_types = sizeof (e_shortcut_bar_builtin_types) / sizeof (EShortcutBarBuiltinType); - -gboolean e_shortcut_bar_default_type_image_loaded = FALSE; -GdkPixbuf *e_shortcut_bar_default_type_image = NULL; -gchar *e_shortcut_bar_default_type_filename = "gnome-balsa2.png"; - -static void e_shortcut_bar_class_init (EShortcutBarClass *class); -static void e_shortcut_bar_init (EShortcutBar *shortcut_bar); -static void e_shortcut_bar_destroy (GtkObject *object); -static void e_shortcut_bar_set_canvas_style (EShortcutBar *shortcut_bar, - GtkWidget *canvas); -static void e_shortcut_bar_item_selected (EIconBar *icon_bar, - GdkEvent *event, - gint item_num, - EShortcutBar *shortcut_bar); -static void e_shortcut_bar_item_dragged (EIconBar *icon_bar, - GdkEvent *event, - gint item_num, - EShortcutBar *shortcut_bar); -static void e_shortcut_bar_on_drag_data_get (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - EShortcutBar *shortcut_bar); -static void e_shortcut_bar_on_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint time, - EShortcutBar *shortcut_bar); -static void e_shortcut_bar_on_drag_data_delete (GtkWidget *widget, - GdkDragContext *context, - EShortcutBar *shortcut_bar); -static void e_shortcut_bar_stop_editing (GtkWidget *button, - EShortcutBar *shortcut_bar); -static GdkPixbuf* e_shortcut_bar_get_image_from_url (EShortcutBar *shortcut_bar, - gchar *item_url); -static GdkPixbuf* e_shortcut_bar_load_image (gchar *filename); - - -enum -{ - ITEM_SELECTED, - LAST_SIGNAL -}; - -static guint e_shortcut_bar_signals[LAST_SIGNAL] = {0}; - -static EGroupBarClass *parent_class; - - -GtkType -e_shortcut_bar_get_type (void) -{ - static GtkType e_shortcut_bar_type = 0; - - if (!e_shortcut_bar_type){ - GtkTypeInfo e_shortcut_bar_info = { - "EShortcutBar", - sizeof (EShortcutBar), - sizeof (EShortcutBarClass), - (GtkClassInitFunc) e_shortcut_bar_class_init, - (GtkObjectInitFunc) e_shortcut_bar_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (e_group_bar_get_type ()); - e_shortcut_bar_type = gtk_type_unique (e_group_bar_get_type (), - &e_shortcut_bar_info); - } - - return e_shortcut_bar_type; -} - - -static void -e_shortcut_bar_class_init (EShortcutBarClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - - e_shortcut_bar_signals[ITEM_SELECTED] = - gtk_signal_new ("item_selected", - GTK_RUN_LAST | GTK_RUN_ACTION, - object_class->type, - GTK_SIGNAL_OFFSET (EShortcutBarClass, - selected_item), - gtk_marshal_NONE__POINTER_INT_INT, - GTK_TYPE_NONE, 3, GTK_TYPE_GDK_EVENT, - GTK_TYPE_INT, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, e_shortcut_bar_signals, - LAST_SIGNAL); - - /* Method override */ - object_class->destroy = e_shortcut_bar_destroy; -} - - -static void -e_shortcut_bar_init (EShortcutBar *shortcut_bar) -{ - shortcut_bar->groups = g_array_new (FALSE, FALSE, - sizeof (EShortcutBarGroup)); -} - - -GtkWidget * -e_shortcut_bar_new (void) -{ - GtkWidget *shortcut_bar; - - shortcut_bar = GTK_WIDGET (gtk_type_new (e_shortcut_bar_get_type ())); - - return shortcut_bar; -} - - -static void -e_shortcut_bar_destroy (GtkObject *object) -{ - EShortcutBar *shortcut_bar; - - shortcut_bar = E_SHORTCUT_BAR (object); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); - - g_array_free (shortcut_bar->groups, TRUE); -} - - -gint -e_shortcut_bar_add_group (EShortcutBar *shortcut_bar, gchar *group_name) -{ - EShortcutBarGroup *group, tmp_group; - gint group_num; - GtkWidget *button, *label; - - g_return_val_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar), -1); - g_return_val_if_fail (group_name != NULL, -1); - - group_num = shortcut_bar->groups->len; - g_array_append_val (shortcut_bar->groups, tmp_group); - - group = &g_array_index (shortcut_bar->groups, - EShortcutBarGroup, group_num); - - group->vscrolled_bar = e_vscrolled_bar_new (NULL); - gtk_widget_show (group->vscrolled_bar); - gtk_signal_connect (GTK_OBJECT (E_VSCROLLED_BAR (group->vscrolled_bar)->up_button), "pressed", GTK_SIGNAL_FUNC (e_shortcut_bar_stop_editing), shortcut_bar); - gtk_signal_connect (GTK_OBJECT (E_VSCROLLED_BAR (group->vscrolled_bar)->down_button), "pressed", GTK_SIGNAL_FUNC (e_shortcut_bar_stop_editing), shortcut_bar); - - group->icon_bar = e_icon_bar_new (); - gtk_widget_show (group->icon_bar); - gtk_container_add (GTK_CONTAINER (group->vscrolled_bar), - group->icon_bar); - gtk_signal_connect (GTK_OBJECT (group->icon_bar), "item_selected", - GTK_SIGNAL_FUNC (e_shortcut_bar_item_selected), - shortcut_bar); - gtk_signal_connect (GTK_OBJECT (group->icon_bar), "item_dragged", - GTK_SIGNAL_FUNC (e_shortcut_bar_item_dragged), - shortcut_bar); - gtk_signal_connect (GTK_OBJECT (group->icon_bar), "drag_data_get", - GTK_SIGNAL_FUNC (e_shortcut_bar_on_drag_data_get), - shortcut_bar); - gtk_signal_connect (GTK_OBJECT (group->icon_bar), "drag_data_received", - GTK_SIGNAL_FUNC (e_shortcut_bar_on_drag_data_received), - shortcut_bar); - gtk_signal_connect (GTK_OBJECT (group->icon_bar), "drag_data_delete", - GTK_SIGNAL_FUNC (e_shortcut_bar_on_drag_data_delete), - shortcut_bar); - - e_shortcut_bar_set_canvas_style (shortcut_bar, group->icon_bar); - - button = gtk_button_new (); - label = e_clipped_label_new (group_name); - gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); - gtk_widget_show (label); - gtk_container_add (GTK_CONTAINER (button), label); - gtk_widget_show (button); - gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC (e_shortcut_bar_stop_editing), - shortcut_bar); - - gtk_drag_dest_set (GTK_WIDGET (group->icon_bar), - GTK_DEST_DEFAULT_ALL, - target_table, n_targets, - GDK_ACTION_COPY | GDK_ACTION_MOVE); - gtk_drag_dest_set (GTK_WIDGET (button), - GTK_DEST_DEFAULT_ALL, - target_table, n_targets, - GDK_ACTION_COPY | GDK_ACTION_MOVE); - - e_group_bar_add_group (E_GROUP_BAR (shortcut_bar), - group->vscrolled_bar, button, -1); - - - return group_num; -} - - -void -e_shortcut_bar_remove_group (EShortcutBar *shortcut_bar, - gint group_num) -{ - e_group_bar_remove_group (E_GROUP_BAR (shortcut_bar), group_num); - g_array_remove_index (shortcut_bar->groups, group_num); -} - - -gint -e_shortcut_bar_add_item (EShortcutBar *shortcut_bar, gint group_num, - gchar *item_url, gchar *item_name) -{ - EShortcutBarGroup *group; - GdkPixbuf *image; - gint item_num; - - g_return_val_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar), -1); - g_return_val_if_fail (group_num >= 0, -1); - g_return_val_if_fail (group_num < shortcut_bar->groups->len, -1); - g_return_val_if_fail (item_url != NULL, -1); - g_return_val_if_fail (item_name != NULL, -1); - - image = e_shortcut_bar_get_image_from_url (shortcut_bar, item_url); - group = &g_array_index (shortcut_bar->groups, - EShortcutBarGroup, group_num); - - item_num = e_icon_bar_add_item (E_ICON_BAR (group->icon_bar), - image, item_name, -1); - e_icon_bar_set_item_data_full (E_ICON_BAR (group->icon_bar), item_num, - g_strdup (item_url), g_free); - return item_num; -} - - -void -e_shortcut_bar_remove_item (EShortcutBar *shortcut_bar, - gint group_num, - gint item_num) -{ - EShortcutBarGroup *group; - - g_return_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar)); - g_return_if_fail (group_num >= 0); - g_return_if_fail (group_num < shortcut_bar->groups->len); - - group = &g_array_index (shortcut_bar->groups, - EShortcutBarGroup, group_num); - - e_icon_bar_remove_item (E_ICON_BAR (group->icon_bar), item_num); -} - - -static void -e_shortcut_bar_set_canvas_style (EShortcutBar *shortcut_bar, - GtkWidget *canvas) -{ - GtkRcStyle *rc_style; - - rc_style = gtk_rc_style_new (); - - rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_FG | GTK_RC_BG; - rc_style->fg[GTK_STATE_NORMAL].red = 65535; - rc_style->fg[GTK_STATE_NORMAL].green = 65535; - rc_style->fg[GTK_STATE_NORMAL].blue = 65535; - - rc_style->bg[GTK_STATE_NORMAL].red = 32512; - rc_style->bg[GTK_STATE_NORMAL].green = 32512; - rc_style->bg[GTK_STATE_NORMAL].blue = 32512; - - gtk_widget_modify_style (GTK_WIDGET (canvas), rc_style); - gtk_rc_style_unref (rc_style); -} - - -void -e_shortcut_bar_set_view_type (EShortcutBar *shortcut_bar, - gint group_num, - EIconBarViewType view_type) -{ - EShortcutBarGroup *group; - - g_return_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar)); - g_return_if_fail (group_num >= 0); - g_return_if_fail (group_num < shortcut_bar->groups->len); - - group = &g_array_index (shortcut_bar->groups, - EShortcutBarGroup, group_num); - - e_icon_bar_set_view_type (E_ICON_BAR (group->icon_bar), view_type); -} - - -static void -e_shortcut_bar_item_selected (EIconBar *icon_bar, - GdkEvent *event, - gint item_num, - EShortcutBar *shortcut_bar) -{ - gint group_num; - - group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar), - GTK_WIDGET (icon_bar)->parent); - - gtk_signal_emit (GTK_OBJECT (shortcut_bar), - e_shortcut_bar_signals[ITEM_SELECTED], - event, group_num, item_num); -} - - -static void -e_shortcut_bar_item_dragged (EIconBar *icon_bar, - GdkEvent *event, - gint item_num, - EShortcutBar *shortcut_bar) -{ - GtkTargetList *target_list; - gint group_num; - - group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar), - GTK_WIDGET (icon_bar)->parent); - - /* FIXME: free both somewhere - drag_end? */ - shortcut_bar->dragged_url = g_strdup (e_icon_bar_get_item_data (icon_bar, item_num)); - shortcut_bar->dragged_name = e_icon_bar_get_item_text (icon_bar, item_num); - - target_list = gtk_target_list_new (target_table, n_targets); - gtk_drag_begin (GTK_WIDGET (icon_bar), target_list, - GDK_ACTION_COPY | GDK_ACTION_MOVE, - 1, event); - gtk_target_list_unref (target_list); -} - - -static void -e_shortcut_bar_on_drag_data_get (GtkWidget *widget, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint time, - EShortcutBar *shortcut_bar) -{ - gchar *data; - - if (info == TARGET_SHORTCUT) { - data = g_strdup_printf ("%s%c%s", shortcut_bar->dragged_name, - '\0', shortcut_bar->dragged_url); - gtk_selection_data_set (selection_data, selection_data->target, - 8, data, - strlen (shortcut_bar->dragged_name) - + strlen (shortcut_bar->dragged_url) - + 2); - g_free (data); - } -} - - -static void -e_shortcut_bar_on_drag_data_received (GtkWidget *widget, - GdkDragContext *context, - gint x, - gint y, - GtkSelectionData *data, - guint info, - guint time, - EShortcutBar *shortcut_bar) -{ - EShortcutBarGroup *group; - gchar *item_name, *item_url; - EIconBar *icon_bar; - GdkPixbuf *image; - gint group_num, item_num; - - icon_bar = E_ICON_BAR (widget); - - if ((data->length >= 0) && (data->format == 8) - && icon_bar->dragging_before_item_num != -1) { - item_name = data->data; - item_url = item_name + strlen (item_name) + 1; - - image = e_shortcut_bar_get_image_from_url (shortcut_bar, - item_url); - - group_num = e_group_bar_get_group_num (E_GROUP_BAR (shortcut_bar), - GTK_WIDGET (icon_bar)->parent); - group = &g_array_index (shortcut_bar->groups, - EShortcutBarGroup, group_num); - - item_num = e_icon_bar_add_item (E_ICON_BAR (group->icon_bar), image, item_name, icon_bar->dragging_before_item_num); - e_icon_bar_set_item_data_full (E_ICON_BAR (group->icon_bar), - item_num, g_strdup (item_url), - g_free); - - gtk_drag_finish (context, TRUE, TRUE, time); - return; - } - - gtk_drag_finish (context, FALSE, FALSE, time); -} - - -static void -e_shortcut_bar_on_drag_data_delete (GtkWidget *widget, - GdkDragContext *context, - EShortcutBar *shortcut_bar) -{ - EIconBar *icon_bar; - - icon_bar = E_ICON_BAR (widget); - - e_icon_bar_remove_item (icon_bar, icon_bar->dragged_item_num); -} - - -void -e_shortcut_bar_start_editing_item (EShortcutBar *shortcut_bar, - gint group_num, - gint item_num) -{ - EShortcutBarGroup *group; - - g_return_if_fail (E_IS_SHORTCUT_BAR (shortcut_bar)); - g_return_if_fail (group_num >= 0); - g_return_if_fail (group_num < shortcut_bar->groups->len); - - group = &g_array_index (shortcut_bar->groups, - EShortcutBarGroup, group_num); - - e_icon_bar_start_editing_item (E_ICON_BAR (group->icon_bar), item_num); -} - - -/* We stop editing any item when a scroll button is pressed. */ -static void -e_shortcut_bar_stop_editing (GtkWidget *button, - EShortcutBar *shortcut_bar) -{ - EShortcutBarGroup *group; - gint group_num; - - for (group_num = 0; - group_num < shortcut_bar->groups->len; - group_num++) { - group = &g_array_index (shortcut_bar->groups, - EShortcutBarGroup, group_num); - e_icon_bar_stop_editing_item (E_ICON_BAR (group->icon_bar), - TRUE); - } -} - - -static GdkPixbuf * -e_shortcut_bar_get_image_from_url (EShortcutBar *shortcut_bar, - gchar *item_url) -{ - gchar *method_terminator; - gint method_len, i; - - method_terminator = strchr (item_url, ':'); - if (method_terminator) { - method_len = method_terminator - item_url + 1; - - /* Check if it is a builtin type. */ - for (i = 0; i < e_shortcut_bar_num_builtin_types; i++) { - if (!strncmp (item_url, e_shortcut_bar_builtin_types[i].name, method_len)) { - if (!e_shortcut_bar_builtin_types[i].image) - e_shortcut_bar_builtin_types[i].image = e_shortcut_bar_load_image (e_shortcut_bar_builtin_types[i].filename); - return e_shortcut_bar_builtin_types[i].image; - } - } - } - - if (!e_shortcut_bar_default_type_image_loaded) { - e_shortcut_bar_default_type_image_loaded = TRUE; - e_shortcut_bar_default_type_image = e_shortcut_bar_load_image (e_shortcut_bar_default_type_filename); - } - return e_shortcut_bar_default_type_image; -} - - -static GdkPixbuf * -e_shortcut_bar_load_image (gchar *filename) -{ - gchar *pathname; - GdkPixbuf *image = NULL; - - pathname = gnome_pixmap_file (filename); - if (pathname) - image = gdk_pixbuf_new_from_file (pathname); - else - g_warning ("Couldn't find pixmap: %s", filename); - - return image; -} diff --git a/widgets/shortcut-bar/e-shortcut-bar.h b/widgets/shortcut-bar/e-shortcut-bar.h deleted file mode 100644 index ff7702f869..0000000000 --- a/widgets/shortcut-bar/e-shortcut-bar.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ -#ifndef _E_SHORTCUT_BAR_H_ -#define _E_SHORTCUT_BAR_H_ - -#include "e-group-bar.h" -#include "e-icon-bar.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * EShortcutBar displays a vertical bar with a number of Groups, each of which - * contains any number of icons. It is used on the left of the main application - * window so users can easily access items such as folders and files. - */ - - -/* This contains information on one group. */ -typedef struct _EShortcutBarGroup EShortcutBarGroup; -struct _EShortcutBarGroup -{ - /* This is the EVScrolledBar which scrolls the group. */ - GtkWidget *vscrolled_bar; - - /* This is the icon bar containing the child items. */ - GtkWidget *icon_bar; -}; - - -#define E_SHORTCUT_BAR(obj) GTK_CHECK_CAST (obj, e_shortcut_bar_get_type (), EShortcutBar) -#define E_SHORTCUT_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_shortcut_bar_get_type (), EShortcutBarClass) -#define E_IS_SHORTCUT_BAR(obj) GTK_CHECK_TYPE (obj, e_shortcut_bar_get_type ()) - - -typedef struct _EShortcutBar EShortcutBar; -typedef struct _EShortcutBarClass EShortcutBarClass; - -struct _EShortcutBar -{ - EGroupBar group_bar; - - /* This is an array of EShortcutBarGroup elements. */ - GArray *groups; - - gchar *dragged_url; - gchar *dragged_name; -}; - -struct _EShortcutBarClass -{ - EGroupBarClass parent_class; - - void (*selected_item) (EShortcutBar *shortcut_bar, - GdkEvent *event, - gint group_num, - gint item_num); -}; - - -GtkType e_shortcut_bar_get_type (void); -GtkWidget* e_shortcut_bar_new (void); - -/* Adds a new group, returning the index. */ -gint e_shortcut_bar_add_group (EShortcutBar *shortcut_bar, - gchar *group_name); -void e_shortcut_bar_remove_group (EShortcutBar *shortcut_bar, - gint group_num); - -/* Sets the view type for the group. */ -void e_shortcut_bar_set_view_type (EShortcutBar *shortcut_bar, - gint group_num, - EIconBarViewType view_type); - -/* Adds a new item to a group, returning the index within the group. */ -gint e_shortcut_bar_add_item (EShortcutBar *shortcut_bar, - gint group_num, - gchar *item_url, - gchar *item_name); - -void e_shortcut_bar_start_editing_item (EShortcutBar *shortcut_bar, - gint group_num, - gint item_num); -void e_shortcut_bar_remove_item (EShortcutBar *shortcut_bar, - gint group_num, - gint item_num); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_SHORTCUT_BAR_H_ */ diff --git a/widgets/shortcut-bar/e-vscrolled-bar.c b/widgets/shortcut-bar/e-vscrolled-bar.c deleted file mode 100644 index af23b38a21..0000000000 --- a/widgets/shortcut-bar/e-vscrolled-bar.c +++ /dev/null @@ -1,668 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * EVScrolledBar is like GtkScrolledWindow but only scrolls the child widget - * vertically. It is intended for scrolling narrow vertical bars. - */ - -#include -#include -#include - -#include "e-vscrolled-bar.h" - -/* These are the offsets of the up & down buttons from the right and top/bottom - of the widget. */ -#define E_VSCROLLED_BAR_BUTTON_X_OFFSET 2 -#define E_VSCROLLED_BAR_BUTTON_Y_OFFSET 2 - -/* This is the time between scrolls. */ -#define E_VSCROLLED_BAR_SCROLL_TIMEOUT 20 - -static void e_vscrolled_bar_class_init (EVScrolledBarClass *class); -static void e_vscrolled_bar_init (EVScrolledBar *vscrolled_bar); -static void e_vscrolled_bar_destroy (GtkObject *object); -static void e_vscrolled_bar_finalize (GtkObject *object); -static void e_vscrolled_bar_map (GtkWidget *widget); -static void e_vscrolled_bar_unmap (GtkWidget *widget); -static void e_vscrolled_bar_size_request (GtkWidget *widget, - GtkRequisition *requisition); -static void e_vscrolled_bar_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static void e_vscrolled_bar_draw (GtkWidget *widget, - GdkRectangle *area); -static void e_vscrolled_bar_add (GtkContainer *container, - GtkWidget *child); -static void e_vscrolled_bar_remove (GtkContainer *container, - GtkWidget *child); -static void e_vscrolled_bar_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data); -static void e_vscrolled_bar_adjustment_changed (GtkAdjustment *adjustment, - gpointer data); -static void e_vscrolled_bar_button_pressed (GtkWidget *button, - EVScrolledBar *vscrolled_bar); -static void e_vscrolled_bar_button_released (GtkWidget *button, - EVScrolledBar *vscrolled_bar); -static void e_vscrolled_bar_button_clicked (GtkWidget *button, - EVScrolledBar *vscrolled_bar); -static gboolean e_vscrolled_bar_timeout_handler (gpointer data); - - -static GtkBinClass *parent_class; - - -GtkType -e_vscrolled_bar_get_type (void) -{ - static GtkType e_vscrolled_bar_type = 0; - - if (!e_vscrolled_bar_type) { - GtkTypeInfo e_vscrolled_bar_info = { - "EVScrolledBar", - sizeof (EVScrolledBar), - sizeof (EVScrolledBarClass), - (GtkClassInitFunc) e_vscrolled_bar_class_init, - (GtkObjectInitFunc) e_vscrolled_bar_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - parent_class = gtk_type_class (GTK_TYPE_BIN); - e_vscrolled_bar_type = gtk_type_unique (GTK_TYPE_BIN, - &e_vscrolled_bar_info); - } - - return e_vscrolled_bar_type; -} - - -static void -e_vscrolled_bar_class_init (EVScrolledBarClass *class) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - GtkContainerClass *container_class; - - object_class = (GtkObjectClass *) class; - widget_class = (GtkWidgetClass *) class; - container_class = (GtkContainerClass *) class; - - /* Method override */ - object_class->destroy = e_vscrolled_bar_destroy; - object_class->finalize = e_vscrolled_bar_finalize; - - widget_class->map = e_vscrolled_bar_map; - widget_class->unmap = e_vscrolled_bar_unmap; - widget_class->size_request = e_vscrolled_bar_size_request; - widget_class->size_allocate = e_vscrolled_bar_size_allocate; - widget_class->draw = e_vscrolled_bar_draw; - - container_class->add = e_vscrolled_bar_add; - container_class->remove = e_vscrolled_bar_remove; - container_class->forall = e_vscrolled_bar_forall; -} - - -static void -e_vscrolled_bar_init (EVScrolledBar *vscrolled_bar) -{ - GtkWidget *arrow; - - GTK_WIDGET_SET_FLAGS (vscrolled_bar, GTK_NO_WINDOW); - - gtk_container_set_resize_mode (GTK_CONTAINER (vscrolled_bar), - GTK_RESIZE_QUEUE); - - gtk_widget_push_composite_child (); - - vscrolled_bar->up_button = gtk_button_new (); - gtk_widget_set_composite_name (vscrolled_bar->up_button, - "up_button"); - gtk_widget_set_parent (vscrolled_bar->up_button, - GTK_WIDGET (vscrolled_bar)); - arrow = gtk_arrow_new (GTK_ARROW_UP, GTK_SHADOW_OUT); - gtk_misc_set_padding (GTK_MISC (arrow), 1, 1); - gtk_widget_show (arrow); - gtk_container_add (GTK_CONTAINER (vscrolled_bar->up_button), arrow); - gtk_widget_show (vscrolled_bar->up_button); - gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->up_button), "pressed", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_pressed), vscrolled_bar); - gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->up_button), "released", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_released), vscrolled_bar); - gtk_signal_connect (GTK_OBJECT (vscrolled_bar->up_button), "clicked", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_clicked), vscrolled_bar); - - vscrolled_bar->down_button = gtk_button_new (); - gtk_widget_set_composite_name (vscrolled_bar->up_button, - "down_button"); - gtk_widget_set_parent (vscrolled_bar->down_button, - GTK_WIDGET (vscrolled_bar)); - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_OUT); - gtk_misc_set_padding (GTK_MISC (arrow), 1, 1); - gtk_widget_show (arrow); - gtk_container_add (GTK_CONTAINER (vscrolled_bar->down_button), arrow); - gtk_widget_show (vscrolled_bar->down_button); - gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->down_button), "pressed", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_pressed), vscrolled_bar); - gtk_signal_connect_after (GTK_OBJECT (vscrolled_bar->down_button), "released", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_released), vscrolled_bar); - gtk_signal_connect (GTK_OBJECT (vscrolled_bar->down_button), "clicked", GTK_SIGNAL_FUNC (e_vscrolled_bar_button_clicked), vscrolled_bar); - - gtk_widget_pop_composite_child (); - - vscrolled_bar->adjustment = NULL; - vscrolled_bar->timeout_id = 0; - vscrolled_bar->scrolling_up = FALSE; - vscrolled_bar->min_distance = -1.0; - vscrolled_bar->button_pressed = FALSE; -} - - -/** - * e_vscrolled_bar_new: - * - * @adjustment: The #GtkAdjustment to use for scrolling, or NULL. - * @Return: A new #EVScrolledBar. - * - * Creates a new #EVScrolledBar with the given adjustment. - **/ -GtkWidget * -e_vscrolled_bar_new (GtkAdjustment *adjustment) -{ - GtkWidget *vscrolled_bar; - - vscrolled_bar = GTK_WIDGET (gtk_type_new (e_vscrolled_bar_get_type ())); - e_vscrolled_bar_set_adjustment (E_VSCROLLED_BAR (vscrolled_bar), - adjustment); - - return vscrolled_bar; -} - - -static void -e_vscrolled_bar_destroy (GtkObject *object) -{ - EVScrolledBar *vscrolled_bar; - - vscrolled_bar = E_VSCROLLED_BAR (object); - - if (vscrolled_bar->timeout_id) { - g_source_remove (vscrolled_bar->timeout_id); - vscrolled_bar->timeout_id = 0; - } - - gtk_widget_unparent (vscrolled_bar->up_button); - gtk_widget_unparent (vscrolled_bar->down_button); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - - -static void -e_vscrolled_bar_finalize (GtkObject *object) -{ - EVScrolledBar *vscrolled_bar; - - vscrolled_bar = E_VSCROLLED_BAR (object); - - gtk_object_unref (GTK_OBJECT (vscrolled_bar->adjustment)); - - GTK_OBJECT_CLASS (parent_class)->finalize (object); -} - - -static void -e_vscrolled_bar_map (GtkWidget *widget) -{ - EVScrolledBar *vscrolled_bar; - GtkAdjustment *adjustment; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (widget)); - - vscrolled_bar = E_VSCROLLED_BAR (widget); - - /* chain parent class handler to map self and child */ - GTK_WIDGET_CLASS (parent_class)->map (widget); - - adjustment = vscrolled_bar->adjustment; - - if (GTK_WIDGET_VISIBLE (vscrolled_bar->up_button) - && adjustment->value != adjustment->lower - && !GTK_WIDGET_MAPPED (vscrolled_bar->up_button)) - gtk_widget_map (vscrolled_bar->up_button); - - if (GTK_WIDGET_VISIBLE (vscrolled_bar->down_button) - && adjustment->value < adjustment->upper - adjustment->page_size - && !GTK_WIDGET_MAPPED (vscrolled_bar->down_button)) - gtk_widget_map (vscrolled_bar->down_button); -} - - -static void -e_vscrolled_bar_unmap (GtkWidget *widget) -{ - EVScrolledBar *vscrolled_bar; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (widget)); - - vscrolled_bar = E_VSCROLLED_BAR (widget); - - /* chain parent class handler to unmap self and child */ - GTK_WIDGET_CLASS (parent_class)->unmap (widget); - - if (GTK_WIDGET_MAPPED (vscrolled_bar->up_button)) - gtk_widget_unmap (vscrolled_bar->up_button); - - if (GTK_WIDGET_MAPPED (vscrolled_bar->down_button)) - gtk_widget_unmap (vscrolled_bar->down_button); -} - - -static void -e_vscrolled_bar_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - EVScrolledBar *vscrolled_bar; - GtkBin *bin; - GtkRequisition child_requisition; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (widget)); - g_return_if_fail (requisition != NULL); - - vscrolled_bar = E_VSCROLLED_BAR (widget); - bin = GTK_BIN (widget); - - requisition->width = 0; - requisition->height = 0; - - /* We just return the requisition of the child widget, plus the - border width. */ - if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { - gtk_widget_size_request (bin->child, &child_requisition); - *requisition = child_requisition; - } - - /* We remember the requested heights of the up & down buttons. */ - gtk_widget_size_request (vscrolled_bar->up_button, - &child_requisition); - vscrolled_bar->up_button_width = child_requisition.width; - vscrolled_bar->up_button_height = child_requisition.height; - - gtk_widget_size_request (vscrolled_bar->down_button, - &child_requisition); - vscrolled_bar->down_button_width = child_requisition.width; - vscrolled_bar->down_button_height = child_requisition.height; - - /* Add on the standard container border widths. */ - requisition->width += GTK_CONTAINER (widget)->border_width * 2; - requisition->height += GTK_CONTAINER (widget)->border_width * 2; -} - - -static void -e_vscrolled_bar_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - EVScrolledBar *vscrolled_bar; - GtkBin *bin; - GtkAllocation button_allocation, child_allocation; - gint border_width; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (widget)); - g_return_if_fail (allocation != NULL); - - vscrolled_bar = E_VSCROLLED_BAR (widget); - bin = GTK_BIN (widget); - - widget->allocation = *allocation; - - border_width = GTK_CONTAINER (widget)->border_width; - - child_allocation.x = border_width; - child_allocation.y = border_width; - child_allocation.width = allocation->width - 2 * border_width; - child_allocation.height = allocation->height - 2 * border_width; - gtk_widget_size_allocate (bin->child, &child_allocation); - - button_allocation.x = allocation->width - border_width - - vscrolled_bar->up_button_width - - E_VSCROLLED_BAR_BUTTON_X_OFFSET; - button_allocation.y = border_width + E_VSCROLLED_BAR_BUTTON_Y_OFFSET; - button_allocation.width = vscrolled_bar->up_button_width; - button_allocation.height = vscrolled_bar->up_button_height; - gtk_widget_size_allocate (vscrolled_bar->up_button, - &button_allocation); - - button_allocation.x = allocation->width - border_width - - vscrolled_bar->down_button_width - - E_VSCROLLED_BAR_BUTTON_X_OFFSET; - button_allocation.y = allocation->height - border_width - - vscrolled_bar->down_button_height - - E_VSCROLLED_BAR_BUTTON_Y_OFFSET; - button_allocation.width = vscrolled_bar->down_button_width; - button_allocation.height = vscrolled_bar->down_button_height; - gtk_widget_size_allocate (vscrolled_bar->down_button, - &button_allocation); -} - - -static void -e_vscrolled_bar_draw (GtkWidget *widget, - GdkRectangle *area) -{ - EVScrolledBar *vscrolled_bar; - GtkBin *bin; - GdkRectangle child_area; - - g_return_if_fail (widget != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (widget)); - g_return_if_fail (area != NULL); - - vscrolled_bar = E_VSCROLLED_BAR (widget); - bin = GTK_BIN (widget); - - if (bin->child && GTK_WIDGET_VISIBLE (bin->child) && - gtk_widget_intersect (bin->child, area, &child_area)) - gtk_widget_draw (bin->child, &child_area); - - if (GTK_WIDGET_DRAWABLE (vscrolled_bar->up_button) && - gtk_widget_intersect (vscrolled_bar->up_button, area, &child_area)) - gtk_widget_draw (vscrolled_bar->up_button, &child_area); - - if (GTK_WIDGET_DRAWABLE (vscrolled_bar->down_button) && - gtk_widget_intersect (vscrolled_bar->down_button, area, &child_area)) - gtk_widget_draw (vscrolled_bar->down_button, &child_area); -} - - -static void -e_vscrolled_bar_add (GtkContainer *container, - GtkWidget *child) -{ - EVScrolledBar *vscrolled_bar; - GtkBin *bin; - - g_return_if_fail (container != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (container)); - - vscrolled_bar = E_VSCROLLED_BAR (container); - bin = GTK_BIN (container); - - g_return_if_fail (bin->child == NULL); - - bin->child = child; - gtk_widget_set_parent (child, GTK_WIDGET (bin)); - - gtk_widget_set_scroll_adjustments (child, NULL, - vscrolled_bar->adjustment); - - if (GTK_WIDGET_REALIZED (child->parent)) - gtk_widget_realize (child); - - if (GTK_WIDGET_VISIBLE (child->parent) && GTK_WIDGET_VISIBLE (child)) { - if (GTK_WIDGET_MAPPED (child->parent)) - gtk_widget_map (child); - - gtk_widget_queue_resize (child); - } -} - - -static void -e_vscrolled_bar_remove (GtkContainer *container, - GtkWidget *child) -{ - g_return_if_fail (container != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (container)); - g_return_if_fail (child != NULL); - g_return_if_fail (GTK_BIN (container)->child == child); - - gtk_widget_set_scroll_adjustments (child, NULL, NULL); - - /* chain parent class handler to remove child */ - GTK_CONTAINER_CLASS (parent_class)->remove (container, child); -} - - -static void -e_vscrolled_bar_forall (GtkContainer *container, - gboolean include_internals, - GtkCallback callback, - gpointer callback_data) -{ - g_return_if_fail (container != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (container)); - g_return_if_fail (callback != NULL); - - GTK_CONTAINER_CLASS (parent_class)->forall (container, - include_internals, - callback, - callback_data); - if (include_internals) { - EVScrolledBar *vscrolled_bar; - - vscrolled_bar = E_VSCROLLED_BAR (container); - - if (vscrolled_bar->up_button) - callback (vscrolled_bar->up_button, callback_data); - if (vscrolled_bar->down_button) - callback (vscrolled_bar->down_button, callback_data); - } -} - - -/** - * e_vscrolled_bar_get_adjustment: - * - * @vscrolled_bar: An #EVScrolledBar. - * @Return: The #GtkAdjustment used for scrolling @vscrolled_bar. - * - * Returns the #GtkAdjustment used for scrolling the #EVscrolledBar. - **/ -GtkAdjustment* -e_vscrolled_bar_get_adjustment (EVScrolledBar *vscrolled_bar) -{ - g_return_val_if_fail (vscrolled_bar != NULL, NULL); - g_return_val_if_fail (E_IS_VSCROLLED_BAR (vscrolled_bar), NULL); - - return vscrolled_bar->adjustment; -} - - -/** - * e_vscrolled_bar_set_adjustment: - * - * @vscrolled_bar: An #EVScrolledBar. - * @adjustment: The #GtkAdjustment to use for scrolling @vscrolled_bar. - * - * Sets the #GtkAdjustment to use for scrolling the #EVscrolledBar. - **/ -void -e_vscrolled_bar_set_adjustment (EVScrolledBar *vscrolled_bar, - GtkAdjustment *adjustment) -{ - g_return_if_fail (vscrolled_bar != NULL); - g_return_if_fail (E_IS_VSCROLLED_BAR (vscrolled_bar)); - - if (adjustment) - g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); - else - adjustment = (GtkAdjustment*) gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL); - - if (vscrolled_bar->adjustment == adjustment) - return; - - if (vscrolled_bar->adjustment) { - gtk_signal_disconnect_by_func (GTK_OBJECT (vscrolled_bar->adjustment), - GTK_SIGNAL_FUNC (e_vscrolled_bar_adjustment_changed), - vscrolled_bar); - gtk_object_unref (GTK_OBJECT (vscrolled_bar->adjustment)); - } - - vscrolled_bar->adjustment = adjustment; - gtk_object_ref (GTK_OBJECT (vscrolled_bar->adjustment)); - gtk_object_sink (GTK_OBJECT (vscrolled_bar->adjustment)); - - /* I've used connect_after here to avoid a problem when using a - GnomeCanvas as the child widget. When just using connect it would - leave a blank space when one of the buttons is hidden. We want - the GtkLayout to handle the scrolling before we hide any buttons. */ - gtk_signal_connect_after (GTK_OBJECT (adjustment), "changed", - GTK_SIGNAL_FUNC (e_vscrolled_bar_adjustment_changed), - vscrolled_bar); - gtk_signal_connect_after (GTK_OBJECT (adjustment), "value_changed", - GTK_SIGNAL_FUNC (e_vscrolled_bar_adjustment_changed), - vscrolled_bar); - - e_vscrolled_bar_adjustment_changed (adjustment, vscrolled_bar); - - if (GTK_BIN (vscrolled_bar)->child) - gtk_widget_set_scroll_adjustments (GTK_BIN (vscrolled_bar)->child, NULL, adjustment); -} - - -static void -e_vscrolled_bar_adjustment_changed (GtkAdjustment *adjustment, - gpointer data) -{ - EVScrolledBar *vscrolled_bar; - - g_return_if_fail (adjustment != NULL); - g_return_if_fail (data != NULL); -#if 0 - g_print ("Adjustment changed to: %g\n", adjustment->value); -#endif - vscrolled_bar = E_VSCROLLED_BAR (data); - - if (!GTK_WIDGET_MAPPED (vscrolled_bar)) - return; - - /* If the adjustment value is not 0, show the up button. */ - if (adjustment->value != adjustment->lower) { - gtk_widget_map (vscrolled_bar->up_button); - gdk_window_raise (vscrolled_bar->up_button->window); - } else { - gtk_widget_unmap (vscrolled_bar->up_button); - } - - /* If the adjustment value is less than the maximum value, show the - down button. */ - if (adjustment->value < adjustment->upper - adjustment->page_size) { - gtk_widget_map (vscrolled_bar->down_button); - gdk_window_raise (vscrolled_bar->down_button->window); - } else { - gtk_widget_unmap (vscrolled_bar->down_button); - } -} - - -static void -e_vscrolled_bar_button_pressed (GtkWidget *button, - EVScrolledBar *vscrolled_bar) -{ - if (vscrolled_bar->timeout_id != 0) - g_source_remove (vscrolled_bar->timeout_id); - - vscrolled_bar->timeout_id = g_timeout_add (E_VSCROLLED_BAR_SCROLL_TIMEOUT, e_vscrolled_bar_timeout_handler, vscrolled_bar); - vscrolled_bar->scrolling_up = (button == vscrolled_bar->up_button) ? TRUE : FALSE; - vscrolled_bar->min_distance = vscrolled_bar->adjustment->page_size / 4; - vscrolled_bar->button_pressed = TRUE; - - e_vscrolled_bar_timeout_handler (vscrolled_bar); -} - - -static void -e_vscrolled_bar_button_released (GtkWidget *button, - EVScrolledBar *vscrolled_bar) -{ - vscrolled_bar->button_pressed = FALSE; -} - - -/* This will be called when the user hits the space key to activate the button. - It will also be called just before button_released() is called, but since - we already handle that we simply return if the button is pressed. */ -static void -e_vscrolled_bar_button_clicked (GtkWidget *button, - EVScrolledBar *vscrolled_bar) -{ - if (vscrolled_bar->button_pressed) - return; - - /* We act as if the button is pressed and released immediately. */ - e_vscrolled_bar_button_pressed (button, vscrolled_bar); - vscrolled_bar->button_pressed = FALSE; -} - - -static gboolean -e_vscrolled_bar_timeout_handler (gpointer data) -{ - EVScrolledBar *vscrolled_bar; - GtkAdjustment *adjustment; - gfloat new_value; - gboolean retval = TRUE; - - vscrolled_bar = E_VSCROLLED_BAR (data); - adjustment = vscrolled_bar->adjustment; - - GDK_THREADS_ENTER (); - - /* Check if the user has released the button and we have already - scrolled the minimum distance. */ - if (vscrolled_bar->button_pressed == FALSE - && vscrolled_bar->min_distance <= 0) { - GDK_THREADS_LEAVE (); - return FALSE; - } - - vscrolled_bar->min_distance -= adjustment->step_increment; - - if (vscrolled_bar->scrolling_up) { - new_value = adjustment->value - adjustment->step_increment; - if (new_value <= adjustment->lower) { - new_value = adjustment->lower; - retval = FALSE; - } - } else { - new_value = adjustment->value + adjustment->step_increment; - if (new_value >= adjustment->upper - adjustment->page_size) { - new_value = adjustment->upper - adjustment->page_size; - retval = FALSE; - } - } - - if (adjustment->value != new_value) { - adjustment->value = new_value; - gtk_signal_emit_by_name (GTK_OBJECT (adjustment), - "value_changed"); - } - - GDK_THREADS_LEAVE (); - return retval; -} diff --git a/widgets/shortcut-bar/e-vscrolled-bar.h b/widgets/shortcut-bar/e-vscrolled-bar.h deleted file mode 100644 index 0f4c8bfcec..0000000000 --- a/widgets/shortcut-bar/e-vscrolled-bar.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ -#ifndef _E_VSCROLLED_BAR_H_ -#define _E_VSCROLLED_BAR_H_ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * EVScrolledBar is like GtkScrolledWindow but only scrolls the child widget - * vertically. It is intended for scrolling narrow vertical bars. - */ - - -#define E_VSCROLLED_BAR(obj) GTK_CHECK_CAST (obj, e_vscrolled_bar_get_type (), EVScrolledBar) -#define E_VSCROLLED_BAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_vscrolled_bar_get_type (), EVScrolledBarClass) -#define E_IS_VSCROLLED_BAR(obj) GTK_CHECK_TYPE (obj, e_vscrolled_bar_get_type ()) - - -typedef struct _EVScrolledBar EVScrolledBar; -typedef struct _EVScrolledBarClass EVScrolledBarClass; - -struct _EVScrolledBar -{ - GtkBin bin; - - GtkWidget *up_button; - GtkWidget *down_button; - - GtkAdjustment *adjustment; - - gint up_button_width; - gint up_button_height; - gint down_button_width; - gint down_button_height; - - /* The GTK+ event source ID of our timeout handler. */ - gint timeout_id; - - /* TRUE if we are scrolling up, FALSE if scrolling down. */ - gboolean scrolling_up; - - /* The minimum distance left to scroll. If the user just clicks a - button we scroll a minimum amount. This is reduced after each - scroll. */ - gfloat min_distance; - - /* TRUE if the button is still pressed. When the up/down button is - released, this gets set to FALSE, and we scroll until the minimum - distance falls below 0. */ - gboolean button_pressed; -}; - -struct _EVScrolledBarClass -{ - GtkBinClass parent_class; -}; - - -GtkType e_vscrolled_bar_get_type (void); -GtkWidget* e_vscrolled_bar_new (GtkAdjustment *adjustment); - -GtkAdjustment* e_vscrolled_bar_get_adjustment (EVScrolledBar *vscrolled_bar); -void e_vscrolled_bar_set_adjustment (EVScrolledBar *vscrolled_bar, - GtkAdjustment *adjustment); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_VSCROLLED_BAR_H_ */ diff --git a/widgets/shortcut-bar/test-shortcut-bar.c b/widgets/shortcut-bar/test-shortcut-bar.c deleted file mode 100644 index 2018d614d1..0000000000 --- a/widgets/shortcut-bar/test-shortcut-bar.c +++ /dev/null @@ -1,459 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 1999, Helix Code, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * This tests the ShortcutBar widget. - */ - -#include - -#include "e-shortcut-bar.h" - -#define NUM_SHORTCUT_TYPES 5 -gchar *shortcut_types[] = { - "folder:", "file:", "calendar:", "todo:", "contacts:" -}; - -GtkWidget *main_label; - -static void on_main_label_size_allocate (GtkWidget *widget, - GtkAllocation *allocation, - gpointer data); -static void quit (GtkWidget *window, GdkEvent *event, gpointer data); -static void add_test_groups (EShortcutBar *shortcut_bar); -static void add_test_group (EShortcutBar *shortcut_bar, gint i, - gchar *group_name); -static gint get_random_int (gint max); - -static void on_shortcut_bar_item_selected (EShortcutBar *shortcut_bar, - GdkEvent *event, - gint group_num, - gint item_num); -static void show_standard_popup (EShortcutBar *shortcut_bar, - GdkEvent *event, - gint group_num); -static void show_context_popup (EShortcutBar *shortcut_bar, - GdkEvent *event, - gint group_num, - gint item_num); - -static void set_large_icons (GtkWidget *menuitem, - EShortcutBar *shortcut_bar); -static void set_small_icons (GtkWidget *menuitem, - EShortcutBar *shortcut_bar); -static void remove_group (GtkWidget *menuitem, - EShortcutBar *shortcut_bar); - -static void rename_item (GtkWidget *menuitem, - EShortcutBar *shortcut_bar); -static void remove_item (GtkWidget *menuitem, - EShortcutBar *shortcut_bar); - -int -main (int argc, char *argv[]) -{ - GtkWidget *window, *hpaned, *shortcut_bar; - - gnome_init ("test-shortcut-bar", "0.1", argc, argv); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - window = gnome_app_new ("TestShortcutBar", "TestShortCutBar"); - gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); - gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE); - - gtk_signal_connect (GTK_OBJECT (window), "delete-event", - GTK_SIGNAL_FUNC (quit), NULL); - - hpaned = gtk_hpaned_new (); - gnome_app_set_contents (GNOME_APP (window), hpaned); - gtk_widget_show (hpaned); - - shortcut_bar = e_shortcut_bar_new (); - gtk_paned_pack1 (GTK_PANED (hpaned), shortcut_bar, FALSE, TRUE); - gtk_widget_show (shortcut_bar); - -#if 0 - gtk_container_set_border_width (GTK_CONTAINER (shortcut_bar), 4); -#endif - - gtk_paned_set_position (GTK_PANED (hpaned), 100); - /*gtk_paned_set_gutter_size (GTK_PANED (hpaned), 12);*/ - - main_label = gtk_label_new ("Main Application Window Goes Here"); - gtk_paned_pack2 (GTK_PANED (hpaned), main_label, TRUE, TRUE); - gtk_widget_show (main_label); - gtk_signal_connect (GTK_OBJECT (main_label), "size_allocate", - GTK_SIGNAL_FUNC (on_main_label_size_allocate), - NULL); - - - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - - add_test_groups (E_SHORTCUT_BAR (shortcut_bar)); - - gtk_signal_connect (GTK_OBJECT (shortcut_bar), "item_selected", - GTK_SIGNAL_FUNC (on_shortcut_bar_item_selected), - NULL); - - gtk_widget_show (window); - gtk_main (); - return 0; -} - - -static void -on_main_label_size_allocate (GtkWidget *widget, - GtkAllocation *allocation, - gpointer data) -{ - g_print ("In on_main_label_size_allocate\n"); -} - -static void -quit (GtkWidget *window, GdkEvent *event, gpointer data) -{ - gtk_widget_destroy (window); - gtk_exit (0); -} - - -static void -add_test_groups (EShortcutBar *shortcut_bar) -{ - add_test_group (shortcut_bar, 1, "Shortcuts"); - add_test_group (shortcut_bar, 2, "My Shortcuts"); - add_test_group (shortcut_bar, 3, "Longer Shortcuts"); - add_test_group (shortcut_bar, 4, "Very Long Shortcuts"); - add_test_group (shortcut_bar, 5, "Incredibly Long Shortcuts"); -} - - -static void -add_test_group (EShortcutBar *shortcut_bar, gint i, gchar *group_name) -{ - gint group_num, item_num, num_items; - gchar buffer[128]; - gint shortcut_type, j; - - group_num = e_shortcut_bar_add_group (E_SHORTCUT_BAR (shortcut_bar), - group_name); - - if (group_num % 2) - e_shortcut_bar_set_view_type (E_SHORTCUT_BAR (shortcut_bar), - group_num, - E_ICON_BAR_SMALL_ICONS); - - num_items = get_random_int (5) + 3; - for (j = 1; j <= num_items; j++) { - if (j == 1) - sprintf (buffer, "A very long shortcut with proper words so I can test the wrapping and ellipsis behaviour"); - else if (j == 2) - sprintf (buffer, "A very long shortcut with averylongworkinthemiddlesoIcantestthewrappingandellipsisbehaviour"); - else - sprintf (buffer, "Item %i:%i\n", i, j); - - shortcut_type = get_random_int (NUM_SHORTCUT_TYPES); - item_num = e_shortcut_bar_add_item (E_SHORTCUT_BAR (shortcut_bar), group_num, shortcut_types[shortcut_type], buffer); - } -} - - -/* Returns a random integer between 0 and max - 1. */ -static gint -get_random_int (gint max) -{ - gint random_num; - - random_num = (int) (max * (rand () / (RAND_MAX + 1.0))); -#if 0 - g_print ("Random num (%i): %i\n", max, random_num); -#endif - return random_num; -} - - -static void -on_shortcut_bar_item_selected (EShortcutBar *shortcut_bar, - GdkEvent *event, gint group_num, gint item_num) -{ - gchar buffer[256]; - - if (event->button.button == 1) { - sprintf (buffer, "Item Selected - %i:%i", - group_num + 1, item_num + 1); - gtk_label_set_text (GTK_LABEL (main_label), buffer); - } else if (event->button.button == 3) { - if (item_num == -1) - show_standard_popup (shortcut_bar, event, group_num); - else - show_context_popup (shortcut_bar, event, group_num, - item_num); - } -} - - -static void -show_standard_popup (EShortcutBar *shortcut_bar, - GdkEvent *event, - gint group_num) -{ - GtkWidget *menu, *menuitem; - - /* We don't have any commands if there aren't any groups yet. */ - if (group_num == -1) - return; - - menu = gtk_menu_new (); - - menuitem = gtk_menu_item_new_with_label ("Large Icons"); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (set_large_icons), shortcut_bar); - - menuitem = gtk_menu_item_new_with_label ("Small Icons"); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (set_small_icons), shortcut_bar); - - menuitem = gtk_menu_item_new (); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("Add New Group"); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("Remove Group"); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (remove_group), shortcut_bar); - - menuitem = gtk_menu_item_new_with_label ("Rename Group"); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new (); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("Add Shortcut..."); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new (); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("Hide Shortcut Bar"); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - /* Save the group num so we can get it in the callbacks. */ - gtk_object_set_data (GTK_OBJECT (menu), "group_num", - GINT_TO_POINTER (group_num)); - - /* FIXME: Destroy menu when finished with it somehow? */ - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, - event->button.button, event->button.time); -} - - -static void -set_large_icons (GtkWidget *menuitem, - EShortcutBar *shortcut_bar) -{ - GtkWidget *menu; - gint group_num; - - menu = menuitem->parent; - g_return_if_fail (GTK_IS_MENU (menu)); - - group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu), - "group_num")); - - e_shortcut_bar_set_view_type (shortcut_bar, group_num, - E_ICON_BAR_LARGE_ICONS); -} - - -static void -set_small_icons (GtkWidget *menuitem, - EShortcutBar *shortcut_bar) -{ - GtkWidget *menu; - gint group_num; - - menu = menuitem->parent; - g_return_if_fail (GTK_IS_MENU (menu)); - - group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu), - "group_num")); - - e_shortcut_bar_set_view_type (shortcut_bar, group_num, - E_ICON_BAR_SMALL_ICONS); -} - - -static void -remove_group (GtkWidget *menuitem, - EShortcutBar *shortcut_bar) -{ - GtkWidget *menu; - gint group_num; - - menu = menuitem->parent; - g_return_if_fail (GTK_IS_MENU (menu)); - - group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu), - "group_num")); - - e_shortcut_bar_remove_group (shortcut_bar, group_num); -} - - -static void -show_context_popup (EShortcutBar *shortcut_bar, - GdkEvent *event, - gint group_num, - gint item_num) -{ - GtkWidget *menu, *menuitem, *label, *pixmap; - - menu = gtk_menu_new (); - - menuitem = gtk_pixmap_menu_item_new (); - label = gtk_label_new ("Open Folder"); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_show (label); - gtk_container_add (GTK_CONTAINER (menuitem), label); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - pixmap = gnome_stock_pixmap_widget (menu, GNOME_STOCK_MENU_OPEN); - if (pixmap) { - gtk_widget_show(pixmap); - gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menuitem), pixmap); - } - - menuitem = gtk_menu_item_new_with_label ("Open in New Window"); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("Advanced Find"); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new (); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("Remove from Shortcut Bar"); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (remove_item), shortcut_bar); - - menuitem = gtk_menu_item_new_with_label ("Rename Shortcut"); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (rename_item), shortcut_bar); - - menuitem = gtk_menu_item_new (); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - menuitem = gtk_menu_item_new_with_label ("Properties"); - gtk_widget_set_sensitive (menuitem, FALSE); - gtk_widget_show (menuitem); - gtk_menu_append (GTK_MENU (menu), menuitem); - - - /* Save the group & item nums so we can get them in the callbacks. */ - gtk_object_set_data (GTK_OBJECT (menu), "group_num", - GINT_TO_POINTER (group_num)); - gtk_object_set_data (GTK_OBJECT (menu), "item_num", - GINT_TO_POINTER (item_num)); - - /* FIXME: Destroy menu when finished with it somehow? */ - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, - event->button.button, event->button.time); -} - - -static void -rename_item (GtkWidget *menuitem, - EShortcutBar *shortcut_bar) -{ - GtkWidget *menu; - gint group_num, item_num; - - menu = menuitem->parent; - g_return_if_fail (GTK_IS_MENU (menu)); - - group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu), - "group_num")); - item_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu), - "item_num")); - - e_shortcut_bar_start_editing_item (shortcut_bar, group_num, item_num); -} - - -static void -remove_item (GtkWidget *menuitem, - EShortcutBar *shortcut_bar) -{ - GtkWidget *menu; - gint group_num, item_num; - - menu = menuitem->parent; - g_return_if_fail (GTK_IS_MENU (menu)); - - group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu), - "group_num")); - item_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu), - "item_num")); - - e_shortcut_bar_remove_item (shortcut_bar, group_num, item_num); -} - - diff --git a/widgets/table/.cvsignore b/widgets/table/.cvsignore deleted file mode 100644 index 0963d457d9..0000000000 --- a/widgets/table/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -table-test diff --git a/widgets/table/add-col.xpm b/widgets/table/add-col.xpm deleted file mode 100644 index 9c5f314c8e..0000000000 --- a/widgets/table/add-col.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * add_col_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" .............. ", -" .++++++++++++. ", -" .++++++++++++. ", -" ....+++....... ", -" .+. ", -" . ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/table/check-empty.xpm b/widgets/table/check-empty.xpm deleted file mode 100644 index 746b20234e..0000000000 --- a/widgets/table/check-empty.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const 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 c0468fc25b..0000000000 --- a/widgets/table/check-filled.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static const char * check_filled_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" ", -" ............ ", -" . . ", -" . . . ", -" . .. . ", -" . ... . ", -" . . ... . ", -" . .. ... . ", -" . ..... . ", -" . ... . ", -" . . . ", -" . . ", -" ............ ", -" ", -" "}; diff --git a/widgets/table/clip.png b/widgets/table/clip.png deleted file mode 100644 index 27aa5f072f..0000000000 Binary files a/widgets/table/clip.png and /dev/null differ diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c deleted file mode 100644 index 431c1663d1..0000000000 --- a/widgets/table/e-cell-checkbox.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * e-cell-checkbox.c: Checkbox cell renderer - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include -#include -#include -#include -#include "e-cell-checkbox.h" -#include "e-util/e-util.h" -#include "e-table-item.h" - -#include "check-empty.xpm" -#include "check-filled.xpm" - -#define PARENT_TYPE e_cell_toggle_get_type() - -static GdkPixbuf *checks [2]; - -static void -e_cell_checkbox_class_init (GtkObjectClass *object_class) -{ - checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm); - checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm); -} - -E_MAKE_TYPE(e_cell_checkbox, "ECellCheckbox", ECellCheckbox, e_cell_checkbox_class_init, NULL, PARENT_TYPE); - -ECell * -e_cell_checkbox_new (void) -{ - ECellCheckbox *eccb = gtk_type_new (e_cell_checkbox_get_type ()); - - e_cell_toggle_construct (E_CELL_TOGGLE (eccb), 2, 2, checks); - - return (ECell *) eccb; -} diff --git a/widgets/table/e-cell-checkbox.h b/widgets/table/e-cell-checkbox.h deleted file mode 100644 index 969e4a5edc..0000000000 --- a/widgets/table/e-cell-checkbox.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _E_CELL_CHECKBOX_H_ -#define _E_CELL_CHECKBOX_H_ - -#include "e-cell-toggle.h" - -#define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ()) -#define E_CELL_CHECKBOX(o) (GTK_CHECK_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox)) -#define E_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_CHECKBOX_TYPE, ECellCheckboxClass)) -#define E_IS_CELL_CHECKBOX(o) (GTK_CHECK_TYPE ((o), E_CELL_CHECKBOX_TYPE)) -#define E_IS_CELL_CHECKBOX_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_CHECKBOX_TYPE)) - -typedef struct { - ECellToggle parent; -} ECellCheckbox; - -typedef struct { - ECellToggleClass parent_class; -} ECellCheckboxClass; - -GtkType e_cell_checkbox_get_type (void); -ECell *e_cell_checkbox_new (void); - -#endif /* _E_CELL_CHECKBOX_H_ */ - diff --git a/widgets/table/e-cell-string.c b/widgets/table/e-cell-string.c deleted file mode 100644 index 992b1bd10e..0000000000 --- a/widgets/table/e-cell-string.c +++ /dev/null @@ -1,9 +0,0 @@ -ECell * -e_cell_string_new (void) -{ - ECell *ecell; - - ecell = gtk_type_new (ecell); - - return ecell; -} diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c deleted file mode 100644 index 37213e3904..0000000000 --- a/widgets/table/e-cell-text.c +++ /dev/null @@ -1,1887 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-cell-text.c - Text cell renderer - * Copyright (C) 2000 Helix Code, Inc. - * - * Authors: Miguel de Icaza (miguel@kernel.org) - * Chris Lahey - * - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "e-cell-text.h" -#include "e-util/e-util.h" -#include "e-table-item.h" -#include "e-text-event-processor-emacs-like.h" - -#include /* for BlackPixel */ -#include -#include - - - -/* This defines a line of text */ -struct line { - char *text; /* Line's text, it is a pointer into the text->text string */ - int length; /* Line's length in characters */ - int width; /* Line's width in pixels */ - int ellipsis_length; /* Length before adding ellipsis */ -}; - - - -/* Object argument IDs */ -enum { - ARG_0, - ARG_TEXT, - ARG_X, - ARG_Y, - ARG_FONT, - ARG_FONTSET, - ARG_FONT_GDK, - ARG_ANCHOR, - ARG_JUSTIFICATION, - ARG_CLIP_WIDTH, - ARG_CLIP_HEIGHT, - ARG_CLIP, - ARG_X_OFFSET, - ARG_Y_OFFSET, - ARG_FILL_COLOR, - ARG_FILL_COLOR_GDK, - ARG_FILL_COLOR_RGBA, - ARG_FILL_STIPPLE, - ARG_TEXT_WIDTH, - ARG_TEXT_HEIGHT, - ARG_EDITABLE, - ARG_USE_ELLIPSIS, - ARG_ELLIPSIS -}; - - -enum { - E_SELECTION_PRIMARY, - E_SELECTION_CLIPBOARD -}; - -static GdkAtom clipboard_atom = GDK_NONE; - - - -#define PARENT_TYPE e_cell_get_type() - -#define TEXT_PAD 4 - -typedef struct { - gpointer lines; /* Text split into lines (private field) */ - int num_lines; /* Number of lines of text */ - int max_width; - int ref_count; -} ECellTextLineBreaks; - - -typedef struct _CellEdit CellEdit; - -typedef struct { - ECellView cell_view; - GdkGC *gc; - GdkFont *font; - GdkCursor *i_cursor; - GdkBitmap *stipple; /* Stipple for text */ - - GnomeCanvas *canvas; - - /* - * During editing. - */ - CellEdit *edit; - - - int xofs, yofs; /* This gets added to the x - and y for the cell text. */ - double ellipsis_width; /* The width of the ellipsis. */ - -} ECellTextView; - -typedef struct _CurrentCell{ - ECellTextView *text_view; - int width; - gchar *text; - int model_col, view_col, row; - ECellTextLineBreaks *breaks; -} CurrentCell; - -#define CURRENT_CELL(x) ((CurrentCell *)(x)) - -struct _CellEdit { - CurrentCell cell; - - char *old_text; - - /* - * Where the editing is taking place - */ - - int xofs_edit, yofs_edit; /* Offset because of editing. - This is negative compared - to the other offsets. */ - - /* This needs to be reworked a bit once we get line wrapping. */ - int selection_start; /* Start of selection */ - int selection_end; /* End of selection */ - gboolean select_by_word; /* Current selection is by word */ - - /* This section is for drag scrolling and blinking cursor. */ - /* Cursor handling. */ - gint timeout_id; /* Current timeout id for scrolling */ - GTimer *timer; /* Timer for blinking cursor and scrolling */ - - gint lastx, lasty; /* Last x and y motion events */ - gint last_state; /* Last state */ - gulong scroll_start; /* Starting time for scroll (microseconds) */ - - gint show_cursor; /* Is cursor currently shown */ - gboolean button_down; /* Is mouse button 1 down */ - - ETextEventProcessor *tep; /* Text Event Processor */ - - GtkWidget *invisible; /* For selection handling */ - gboolean has_selection; /* TRUE if we have the selection */ - gchar *primary_selection; /* Primary selection text */ - gint primary_length; /* Primary selection text length */ - gchar *clipboard_selection; /* Clipboard selection text */ - gint clipboard_length; /* Clipboard selection text length*/ - - guint pointer_in : 1; - guint default_cursor_shown : 1; -}; - -static void e_cell_text_view_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data); - -static void e_cell_text_view_get_selection(CellEdit *edit, GdkAtom selection, guint32 time); -static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, guchar *data, gint length); - -static GtkWidget *e_cell_text_view_get_invisible(CellEdit *edit); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit); -static void split_into_lines (CurrentCell *cell); -static void unref_lines(CurrentCell *cell); -static void calc_line_widths (CurrentCell *cell); -static int get_line_ypos (CurrentCell *cell, struct line *line); -static int get_line_xpos (CurrentCell *cell, struct line *line); -static void _get_tep(CellEdit *edit); - -static gint _get_position_from_xy (CurrentCell *cell, gint x, gint y); -static void _get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp); -static gboolean _blink_scroll_timeout (gpointer data); - -static void build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row); -static void calc_ellipsis (ECellTextView *text_view); - -static ECellClass *parent_class; - -static void -ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row) -{ - e_table_item_redraw_range ( - text_view->cell_view.e_table_item_view, - view_col, view_row, view_col, view_row); -} - -/* - * Accept the currently edited text - */ -static void -ect_accept_edits (ECellTextView *text_view) -{ - CurrentCell *cell = (CurrentCell *) text_view->edit; - - e_table_model_set_value_at (text_view->cell_view.e_table_model, cell->model_col, cell->row, cell->text); -} - -/* - * Shuts down the editing process - */ -static void -ect_stop_editing (ECellTextView *text_view) -{ - CellEdit *edit = text_view->edit; - int row, view_col; - - row = edit->cell.row; - view_col = edit->cell.view_col; - - g_free (edit->old_text); - edit->old_text = NULL; - g_free (edit->cell.text); - edit->cell.text = NULL; - if (edit->invisible) - gtk_widget_unref (edit->invisible); - if (edit->tep) - gtk_object_unref (GTK_OBJECT(edit->tep)); - if (edit->primary_selection) - g_free(edit->primary_selection); - if (edit->clipboard_selection) - g_free(edit->clipboard_selection); - if ( ! edit->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(text_view->canvas)->window, NULL); - edit->default_cursor_shown = TRUE; - } - if (edit->timeout_id) { - g_source_remove(edit->timeout_id); - edit->timeout_id = 0; - } - if (edit->timer) { - g_timer_stop(edit->timer); - g_timer_destroy(edit->timer); - edit->timer = NULL; - } - - g_free (edit); - - text_view->edit = NULL; - ect_queue_redraw (text_view, view_col, row); -} - -/* - * Cancels the edits - */ -static void -ect_cancel_edit (ECellTextView *text_view) -{ - ect_stop_editing (text_view); -} - -/* - * ECell::new_view method - */ -static ECellView * -ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellText *ect = E_CELL_TEXT (ecell); - ECellTextView *text_view = g_new0 (ECellTextView, 1); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas; - - text_view->cell_view.ecell = ecell; - text_view->cell_view.e_table_model = table_model; - text_view->cell_view.e_table_item_view = e_table_item_view; - - if (ect->font_name){ - GdkFont *f; - - f = gdk_fontset_load (ect->font_name); - text_view->font = f; - } - if (!text_view->font){ - text_view->font = GTK_WIDGET (canvas)->style->font; - - gdk_font_ref (text_view->font); - } - - text_view->canvas = canvas; - - text_view->xofs = 0.0; - text_view->yofs = 0.0; - - return (ECellView *)text_view; -} - -/* - * ECell::kill_view method - */ -static void -ect_kill_view (ECellView *ecv) -{ - ECellTextView *text_view = (ECellTextView *) ecv; - - g_free (text_view); -} - -/* - * ECell::realize method - */ -static void -ect_realize (ECellView *ecell_view) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - - text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window); - - text_view->i_cursor = gdk_cursor_new (GDK_XTERM); - - calc_ellipsis (text_view); - - if (parent_class->realize) - (* parent_class->realize) (ecell_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; - - if (text_view->font) - gdk_font_unref (text_view->font); - - if (text_view->stipple) - gdk_bitmap_unref (text_view->stipple); - - gdk_cursor_destroy (text_view->i_cursor); - - if (parent_class->unrealize) - (* parent_class->unrealize) (ecv); -} - -/* - * 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) -{ - /* New ECellText */ - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - ECellTextView *text_view = (ECellTextView *) ecell_view; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - GdkFont *font = text_view->font; - const int height = font->ascent + font->descent; - CellEdit *edit = text_view->edit; - gboolean edit_display = FALSE; - ECellTextLineBreaks *linebreaks; - - - if (edit){ - - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - fg_gc = canvas->style->fg_gc[edit->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - } else - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } else { - fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE]; - } - - /* - * 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); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - gdk_gc_set_foreground (text_view->gc, &canvas->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, &canvas->style->text [GTK_STATE_NORMAL]); - - x1 += 4; - y1 += 1; - x2 -= 4; - y2 -= 1; - - rect.x = x1; - rect.y = y1; - rect.width = x2 - x1; - rect.height = y2 - y1; - - gdk_gc_set_clip_rectangle (text_view->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - - if ( edit_display ) { - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - - cell->width = x2 - x1; - - split_into_lines(cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - ypos = get_line_ypos (cell, lines); - ypos += font->ascent; - ypos -= edit->yofs_edit; - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (cell, lines); - xpos -= edit->xofs_edit; - start_char = lines->text - cell->text; - end_char = start_char + lines->length; - sel_start = edit->selection_start; - sel_end = edit->selection_end; - if (sel_start > sel_end ) { - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if ( sel_start < start_char ) - sel_start = start_char; - if ( sel_end > end_char ) - sel_end = end_char; - if ( sel_start < sel_end ) { - sel_rect.x = xpos + x1 + gdk_text_width (font, - lines->text, - sel_start - start_char); - sel_rect.y = ypos + y1 - font->ascent; - sel_rect.width = gdk_text_width (font, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = height; - gtk_paint_flat_box(canvas->style, - drawable, - edit->has_selection ? - GTK_STATE_SELECTED : - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - canvas, - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - sel_start - start_char); - gdk_draw_text (drawable, - font, - fg_gc, - xpos + x1 + gdk_text_width (font, - lines->text, - sel_start - start_char), - ypos + y1, - lines->text + sel_start - start_char, - sel_end - sel_start); - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1 + gdk_text_width (font, - lines->text, - sel_end - start_char), - ypos + y1, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->length); - } - if (edit->selection_start == edit->selection_end && - edit->selection_start >= start_char && - edit->selection_start <= end_char && - edit->show_cursor) { - gdk_draw_rectangle (drawable, - text_view->gc, - TRUE, - xpos + x1 + gdk_text_width (font, - lines->text, - sel_start - start_char), - ypos + y1 - font->ascent, - 1, - height); - } - } - unref_lines(cell); - } else { - - ECellTextLineBreaks *linebreaks; - CurrentCell cell; - build_current_cell ( &cell, text_view, model_col, view_col, row ); - - cell.width = x2 - x1; - - split_into_lines(&cell); - - linebreaks = cell.breaks; - lines = linebreaks->lines; - ypos = get_line_ypos(&cell, lines); - ypos += font->ascent; - - for (i = 0; i < linebreaks->num_lines; i++) { - xpos = get_line_xpos (&cell, lines); - if ( ect->use_ellipsis && lines->ellipsis_length < lines->length) { - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->ellipsis_length); - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1 + - lines->width - text_view->ellipsis_width, - ypos + y1, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); - } else { - gdk_draw_text (drawable, - font, - text_view->gc, - xpos + x1, - ypos + y1, - lines->text, - lines->length); - } - } - - ypos += height; - lines++; - unref_lines(&cell); - } - - gdk_gc_set_clip_rectangle (text_view->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); -#if 0 - /* Old ECellText */ - - int xoff; - gboolean edit_display = FALSE; - - /* - * Figure if this cell is being edited - */ - if (edit_display){ - CellEdit *edit = text_view->edit; - const char *text = gtk_entry_get_text (edit->entry); - GdkWChar *p, *text_wc = g_new (GdkWChar, strlen (text) + 1); - int text_wc_len = gdk_mbstowcs (text_wc, text, strlen (text)); - const int cursor_pos = GTK_EDITABLE (edit->entry)->current_pos; - const int left_len = gdk_text_width_wc (text_view->font, text_wc, cursor_pos); - - text_wc [text_wc_len] = 0; - /* - * Paint - */ - gdk_gc_set_foreground (text_view->gc, &w->style->base [GTK_STATE_NORMAL]); - gdk_draw_rectangle (drawable, text_view->gc, TRUE, - rect.x, rect.y, rect.width, rect.height); - gdk_gc_set_foreground (text_view->gc, &w->style->text [GTK_STATE_NORMAL]); - - { - GdkGC *gc = text_view->gc; - const int y = y2 - font->descent - ((y2-y1-height)/2); - int px, i; - - /* - * Border - */ - x1 += 2; - x2--; - - px = x1; - - /* - * If the cursor is outside the visible range - * - * FIXME: we really want a better behaviour. - */ - if ((px + left_len) > x2) - px -= left_len - (x2-x1); - - /* - * Draw - */ - for (i = 0, p = text_wc; *p; p++, i++){ - gdk_draw_text_wc ( - drawable, font, gc, px, y, p, 1); - - if (i == cursor_pos){ - gdk_draw_line ( - drawable, gc, - px, y - font->ascent, - px, y + font->descent - 1); - } - - px += gdk_text_width_wc (font, p, 1); - } - - if (i == cursor_pos){ - gdk_draw_line ( - drawable, gc, - px, y - font->ascent, - px, y + font->descent - 1); - } - } - g_free (text_wc); - } else { - /* - * Regular cell - */ - GdkColor *background, *foreground; - int width; - - /* - * Border - */ - x1++; - x2--; - - /* - * Compute draw mode - */ - switch (ect->justify){ - case GTK_JUSTIFY_LEFT: - xoff = 1; - break; - - case GTK_JUSTIFY_RIGHT: - width = 1 + gdk_text_width (font, str, strlen (str)); - xoff = (x2 - x1) - width; - break; - - case GTK_JUSTIFY_CENTER: - xoff = ((x2 - x1) - gdk_text_width (font, str, strlen (str))) / 2; - break; - default: - xoff = 0; - g_warning ("Can not handle GTK_JUSTIFY_FILL"); - break; - } - - - if (selected){ - background = &w->style->bg [GTK_STATE_SELECTED]; - foreground = &w->style->text [GTK_STATE_SELECTED]; - } else { - background = &w->style->base [GTK_STATE_NORMAL]; - foreground = &w->style->text [GTK_STATE_NORMAL]; - } - - gdk_gc_set_foreground (text_view->gc, background); - gdk_draw_rectangle (drawable, text_view->gc, TRUE, - rect.x, rect.y, rect.width, rect.height); - gdk_gc_set_foreground (text_view->gc, foreground); - - gdk_draw_string ( - drawable, font, text_view->gc, - x1 + xoff, - y2 - font->descent - ((y2-y1-height)/2), str); - } -#endif -} - -/* - * Selects the entire string - */ -static void -ect_edit_select_all (ECellTextView *text_view) -{ - g_assert (text_view->edit); - - text_view->edit->selection_start = 0; - text_view->edit->selection_end = strlen(text_view->edit->cell.text); -} - -/* - * 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; - ECellText *ect = E_CELL_TEXT (ecell_view->ecell); - ETextEventProcessorEvent e_tep_event; - gboolean edit_display = FALSE; - CellEdit *edit = text_view->edit; - GtkWidget *canvas = GTK_WIDGET (text_view->canvas); - gint return_val = 0; - - CurrentCell cell, *cellptr; - build_current_cell ( &cell, text_view, model_col, view_col, row ); - - - if (edit){ - if ((edit->cell.view_col == view_col) && (edit->cell.row == row)) { - edit_display = TRUE; - cellptr = CURRENT_CELL(edit); - } else { - cellptr = &cell; - } - } else { - cellptr = &cell; - } - - e_tep_event.type = event->type; - switch (event->type) { - case GDK_FOCUS_CHANGE: - break; - case GDK_KEY_PRESS: /* Fall Through */ - case GDK_KEY_RELEASE: - if (event->key.keyval == GDK_Escape){ - ect_cancel_edit (text_view); - return TRUE; - } - - if ((!edit_display) && ect->editable) { - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - ect_edit_select_all (text_view); - edit = text_view->edit; - cellptr = CURRENT_CELL(edit); - edit_display = TRUE; - } - if (edit_display) { - GdkEventKey key = event->key; - if ( key.keyval == GDK_KP_Enter || key.keyval == GDK_Return ) { - e_table_item_leave_edit (text_view->cell_view.e_table_item_view); - } else { - e_tep_event.key.time = key.time; - e_tep_event.key.state = key.state; - e_tep_event.key.keyval = key.keyval; - e_tep_event.key.length = key.length; - e_tep_event.key.string = key.string; - _get_tep(edit); - return e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - } - } - - else - return 0; - break; - case GDK_BUTTON_PRESS: /* Fall Through */ - case GDK_BUTTON_RELEASE: - event->button.x -= 4; - event->button.y -= 1; - if ((!edit_display) - && ect->editable - && event->type == GDK_BUTTON_RELEASE - && event->button.button == 1) { - GdkEventButton button = event->button; - - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - edit = text_view->edit; - cellptr = CURRENT_CELL(edit); - edit_display = TRUE; - - e_tep_event.button.type = GDK_BUTTON_PRESS; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(cellptr, button.x, button.y); - _get_tep(edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - edit->button_down = TRUE; - else - edit->button_down = FALSE; - } - edit->lastx = button.x; - edit->lasty = button.y; - edit->last_state = button.state; - - e_tep_event.button.type = GDK_BUTTON_RELEASE; - } - if (edit_display) { - GdkEventButton button = event->button; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(cellptr, button.x, button.y); - _get_tep(edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - edit->button_down = TRUE; - else - edit->button_down = FALSE; - } - edit->lastx = button.x; - edit->lasty = button.y; - edit->last_state = button.state; - } - break; - case GDK_MOTION_NOTIFY: - event->motion.x -= 4; - event->motion.y -= 1; - if (edit_display) { - GdkEventMotion motion = event->motion; - e_tep_event.motion.time = motion.time; - e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy(cellptr, motion.x, motion.y); - _get_tep(edit); - return_val = e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - edit->lastx = motion.x; - edit->lasty = motion.y; - edit->last_state = motion.state; - } - break; - case GDK_ENTER_NOTIFY: -#if 0 - edit->pointer_in = TRUE; -#endif - if (edit_display) { - if ( edit->default_cursor_shown ) { - gdk_window_set_cursor(canvas->window, text_view->i_cursor); - edit->default_cursor_shown = FALSE; - } - } - break; - case GDK_LEAVE_NOTIFY: -#if 0 - text_view->pointer_in = FALSE; -#endif - if (edit_display) { - if ( ! edit->default_cursor_shown ) { - gdk_window_set_cursor(canvas->window, NULL); - edit->default_cursor_shown = TRUE; - } - } - break; - default: - break; - } - if (return_val) - return return_val; -#if 0 - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); -#endif - else - return 0; - -#if 0 - switch (event->type){ - case GDK_BUTTON_PRESS: - /* - * Adjust for the border we use - */ - event->button.x++; - - printf ("Button pressed at %g %g\n", event->button.x, event->button.y); - if (text_view->edit){ - printf ("FIXME: Should handle click here\n"); - } else - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - break; - - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Escape){ - ect_cancel_edit (text_view); - return TRUE; - } - - if (!text_view->edit){ - e_table_item_enter_edit (text_view->cell_view.e_table_item_view, view_col, row); - ect_edit_select_all (text_view); - } - - gtk_widget_event (GTK_WIDGET (text_view->edit->entry), event); - ect_queue_redraw (text_view, view_col, row); - break; -#endif -} - -/* - * ECell::height method - */ -static int -ect_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - CurrentCell cell; - int return_val; - - build_current_cell ( &cell, text_view, model_col, view_col, row ); - split_into_lines( &cell ); - - return_val = (text_view->font->ascent + text_view->font->descent) * cell.breaks->num_lines + TEXT_PAD; - - unref_lines( &cell ); - - return return_val; -} - -/* - * ECellView::enter_edit method - */ -static void * -ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellTextView *text_view = (ECellTextView *) ecell_view; - const char *str = e_table_model_value_at (ecell_view->e_table_model, model_col, row); - CellEdit *edit; - - edit = g_new (CellEdit, 1); - text_view->edit = edit; - - build_current_cell ( CURRENT_CELL(edit), text_view, model_col, view_col, row ); - - edit->xofs_edit = 0.0; - edit->yofs_edit = 0.0; - - edit->selection_start = 0; - edit->selection_end = 0; - edit->select_by_word = FALSE; - - edit->timeout_id = g_timeout_add(10, _blink_scroll_timeout, text_view); - edit->timer = g_timer_new(); - g_timer_elapsed(edit->timer, &(edit->scroll_start)); - g_timer_start(edit->timer); - - edit->lastx = 0; - edit->lasty = 0; - edit->last_state = 0; - - edit->scroll_start = 0; - edit->show_cursor = TRUE; - edit->button_down = FALSE; - - edit->tep = NULL; - - edit->has_selection = FALSE; - - edit->invisible = NULL; - edit->primary_selection = NULL; - edit->primary_length = 0; - edit->clipboard_selection = NULL; - edit->clipboard_length = 0; - - edit->pointer_in = FALSE; - edit->default_cursor_shown = TRUE; - - edit->old_text = g_strdup (str); - edit->cell.text = g_strdup (str); - -#if 0 - if ( edit->pointer_in ) { - if ( edit->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text_view->i_cursor); - edit->default_cursor_shown = FALSE; - } - } -#endif - - 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; - CellEdit *edit = text_view->edit; - - if (edit){ - ect_accept_edits (text_view); - ect_stop_editing (text_view); - } else { - /* - * We did invoke this leave edit internally - */ - } -} - -/* - * GtkObject::destroy method - */ -static void -ect_destroy (GtkObject *object) -{ - ECellText *ect = E_CELL_TEXT (object); - - g_free (ect->font_name); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -e_cell_text_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = ect_destroy; - - ecc->new_view = ect_new_view; - ecc->kill_view = ect_kill_view; - ecc->realize = ect_realize; - ecc->unrealize = ect_unrealize; - ecc->draw = ect_draw; - ecc->event = ect_event; - ecc->height = ect_height; - ecc->enter_edit = ect_enter_edit; - ecc->leave_edit = ect_leave_edit; - - parent_class = gtk_type_class (PARENT_TYPE); - - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); -} - -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, gboolean editable) -{ - ECellText *ect = gtk_type_new (e_cell_text_get_type ()); - - ect->ellipsis = NULL; - ect->use_ellipsis = TRUE; - - ect->editable = editable; - - ect->font_name = g_strdup (fontname); - ect->justify = justify; - - return (ECell *) ect; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (CurrentCell *cell, struct line *line) -{ - int x; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - - x = text_view->xofs + ect->x; - - switch (ect->justify) { - case GTK_JUSTIFY_RIGHT: - x += cell->width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (cell->width - line->width) / 2; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_ypos (CurrentCell *cell, struct line *line) -{ - int y; - - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)cell->text_view)->ecell); - ECellTextLineBreaks *linebreaks = cell->breaks; - - struct line *lines = linebreaks->lines; - - y = text_view->yofs + ect->y; - y += (line - lines) * (text_view->font->ascent + text_view->font->descent); - - return y; -} - -static void -_get_xy_from_position (CurrentCell *cell, gint position, gint *xp, gint *yp) -{ - if (xp || yp) { - struct line *lines; - int x, y; - int j; - ECellTextView *text_view = cell->text_view; - GdkFont *font = text_view->font; - ECellTextLineBreaks *linebreaks; - - split_into_lines(cell); - - linebreaks = cell->breaks; - lines = linebreaks->lines; - - x = get_line_xpos (cell, lines); - y = get_line_ypos (cell, lines); - for (j = 0, lines = linebreaks->lines; j < linebreaks->num_lines; lines++, j++) { - if (lines->text > cell->text + position) - break; - y += font->ascent + font->descent; - } - lines --; - y -= font->descent; - - x += gdk_text_width (font, - lines->text, - position - (lines->text - cell->text)); - if ( (CellEdit *) cell == cell->text_view->edit ) { - x -= ((CellEdit *)cell)->xofs_edit; - y -= ((CellEdit *)cell)->yofs_edit; - } - if (xp) - *xp = x; - if (yp) - *yp = y; - unref_lines(cell); - } -} - -static gint -_get_position_from_xy (CurrentCell *cell, gint x, gint y) -{ - int i, j; - int xpos, ypos; - struct line *lines; - int return_val; - - ECellTextView *text_view = cell->text_view; - GdkFont *font = text_view->font; - ECellTextLineBreaks *linebreaks; - - split_into_lines(cell); - - linebreaks = cell->breaks; - - lines = linebreaks->lines; - - if ( (CellEdit *) cell == cell->text_view->edit ) { - x += ((CellEdit *)cell)->xofs_edit; - y += ((CellEdit *)cell)->yofs_edit; - } - - ypos = get_line_ypos (cell, linebreaks->lines); - j = 0; - while (y > ypos) { - ypos += font->ascent + font->descent; - j ++; - } - j--; - if (j >= linebreaks->num_lines) - j = linebreaks->num_lines - 1; - if (j < 0) - j = 0; - i = 0; - - lines += j; - xpos = get_line_xpos (cell, lines); - for(i = 0; i < lines->length; i++) { - int charwidth = gdk_text_width(font, - lines->text + i, - 1); - xpos += charwidth / 2; - if (xpos > x) { - break; - } - xpos += (charwidth + 1) / 2; - } - - return_val = lines->text + i - cell->text; - - unref_lines(cell); - - return return_val; -} - -#define SCROLL_WAIT_TIME 30000 - -static gboolean -_blink_scroll_timeout (gpointer data) -{ - CurrentCell *cell = CURRENT_CELL(data); - ECellTextView *text_view = (ECellTextView *) data; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - CellEdit *edit = text_view->edit; - ECellTextLineBreaks *linebreaks = cell->breaks; - - gulong current_time; - gboolean scroll = FALSE; - gboolean redraw = FALSE; - - g_timer_elapsed(edit->timer, ¤t_time); - - if (edit->scroll_start + SCROLL_WAIT_TIME > 1000000) { - if (current_time > edit->scroll_start - (1000000 - SCROLL_WAIT_TIME) && - current_time < edit->scroll_start) - scroll = TRUE; - } else { - if (current_time > edit->scroll_start + SCROLL_WAIT_TIME || - current_time < edit->scroll_start) - scroll = TRUE; - } - if (scroll && edit->button_down) { - /* FIXME: Copy this for y. */ - if (edit->lastx - ect->x > cell->width && - edit->xofs_edit < linebreaks->max_width - cell->width) { - edit->xofs_edit += 4; - if (edit->xofs_edit > linebreaks->max_width - cell->width + 1) - edit->xofs_edit = linebreaks->max_width - cell->width + 1; - redraw = TRUE; - } - if (edit->lastx - ect->x < 0 && - edit->xofs_edit > 0) { - edit->xofs_edit -= 4; - if (edit->xofs_edit < 0) - edit->xofs_edit = 0; - redraw = TRUE; - } - if (redraw) { - ETextEventProcessorEvent e_tep_event; - e_tep_event.type = GDK_MOTION_NOTIFY; - e_tep_event.motion.state = edit->last_state; - e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy(cell, edit->lastx, edit->lasty); - _get_tep(edit); - e_text_event_processor_handle_event (edit->tep, - &e_tep_event); - edit->scroll_start = current_time; - } - } - - if (!((current_time / 500000) % 2)) { - if (!edit->show_cursor) - redraw = TRUE; - edit->show_cursor = TRUE; - } else { - if (edit->show_cursor) - redraw = TRUE; - edit->show_cursor = FALSE; - } - if ( redraw ) { - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } - return TRUE; -} - -static int -_get_position(ECellTextView *text_view, ETextEventProcessorCommand *command) -{ - int i; - int length; - int x, y; - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - - switch (command->position) { - - case E_TEP_VALUE: - return command->value; - - case E_TEP_SELECTION: - return edit->selection_end; - - case E_TEP_START_OF_BUFFER: - return 0; - case E_TEP_END_OF_BUFFER: - return strlen(cell->text); - - case E_TEP_START_OF_LINE: - for (i = edit->selection_end - 2; i > 0; i--) - if (cell->text[i] == '\n') { - i++; - break; - } - return i; - case E_TEP_END_OF_LINE: - length = strlen(cell->text); - for (i = edit->selection_end + 1; i < length; i++) - if (cell->text[i] == '\n') { - break; - } - if (i > length) - i = length; - return i; - - case E_TEP_FORWARD_CHARACTER: - length = strlen(cell->text); - i = edit->selection_end + 1; - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_CHARACTER: - i = edit->selection_end - 1; - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_WORD: - length = strlen(cell->text); - for (i = edit->selection_end + 1; i < length; i++) - if (isspace(cell->text[i])) { - break; - } - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_WORD: - for (i = edit->selection_end - 2; i > 0; i--) - if (isspace(cell->text[i])) { - i++; - break; - } - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_LINE: - _get_xy_from_position(cell, edit->selection_end, &x, &y); - y += text_view->font->ascent + text_view->font->descent; - return _get_position_from_xy(cell, x, y); - case E_TEP_BACKWARD_LINE: - _get_xy_from_position(cell, edit->selection_end, &x, &y); - y -= text_view->font->ascent + text_view->font->descent; - return _get_position_from_xy(cell, x, y); - - case E_TEP_FORWARD_PARAGRAPH: - case E_TEP_BACKWARD_PARAGRAPH: - - case E_TEP_FORWARD_PAGE: - case E_TEP_BACKWARD_PAGE: - return edit->selection_end; - default: - return edit->selection_end; - } -} - -static void -_delete_selection(ECellTextView *text_view) -{ - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - gint length = strlen(cell->text); - if (edit->selection_end == edit->selection_start) - return; - if (edit->selection_end < edit->selection_start) { - edit->selection_end ^= edit->selection_start; - edit->selection_start ^= edit->selection_end; - edit->selection_end ^= edit->selection_start; - } - memmove( cell->text + edit->selection_start, - cell->text + edit->selection_end, - length - edit->selection_end + 1 ); - length -= edit->selection_end - edit->selection_start; - edit->selection_end = edit->selection_start; -} - -static void -_insert(ECellTextView *text_view, char *string, int value) -{ - if (value > 0) { - char *temp; - CellEdit *edit = text_view->edit; - CurrentCell *cell = CURRENT_CELL(edit); - gint length = strlen(cell->text); - temp = g_new(gchar, length + value + 1); - strncpy(temp, cell->text, edit->selection_start); - strncpy(temp + edit->selection_start, string, value); - strcpy(temp + edit->selection_start + value, cell->text + edit->selection_start); - g_free(cell->text); - cell->text = temp; - edit->selection_start += value; - edit->selection_end = edit->selection_start; - } -} - -static void -e_cell_text_view_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) -{ - CellEdit *edit = (CellEdit *) data; - CurrentCell *cell = CURRENT_CELL(edit); - ECellTextView *text_view = cell->text_view; - - gboolean change = FALSE; - gboolean redraw = FALSE; - - int sel_start, sel_end; - switch (command->action) { - case E_TEP_MOVE: - edit->selection_start = _get_position(text_view, command); - edit->selection_end = edit->selection_start; - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - break; - case E_TEP_SELECT: - edit->selection_end = _get_position(text_view, command); - sel_start = MIN(edit->selection_start, edit->selection_end); - sel_end = MAX(edit->selection_start, edit->selection_end); - if (sel_start != sel_end) { - e_cell_text_view_supply_selection (edit, command->time, GDK_SELECTION_PRIMARY, cell->text + sel_start, sel_end - sel_start); - } else if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - break; - case E_TEP_DELETE: - if (edit->selection_end == edit->selection_start) { - edit->selection_end = _get_position(text_view, command); - } - _delete_selection(text_view); - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - - case E_TEP_INSERT: - if (edit->selection_end != edit->selection_start) { - _delete_selection(text_view); - } - _insert(text_view, command->string, command->value); - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - case E_TEP_COPY: - sel_start = MIN(edit->selection_start, edit->selection_end); - sel_end = MAX(edit->selection_start, edit->selection_end); - if (sel_start != sel_end) { - e_cell_text_view_supply_selection (edit, command->time, clipboard_atom, cell->text + sel_start, sel_end - sel_start); - } - if (edit->timer) { - g_timer_reset(edit->timer); - } - break; - case E_TEP_PASTE: - e_cell_text_view_get_selection (edit, clipboard_atom, command->time); - if (edit->timer) { - g_timer_reset(edit->timer); - } - redraw = TRUE; - change = TRUE; - break; - case E_TEP_GET_SELECTION: - e_cell_text_view_get_selection (edit, GDK_SELECTION_PRIMARY, command->time); - break; - case E_TEP_ACTIVATE: - e_table_item_leave_edit (text_view->cell_view.e_table_item_view); - break; - case E_TEP_SET_SELECT_BY_WORD: - edit->select_by_word = command->value; - break; - case E_TEP_GRAB: - case E_TEP_UNGRAB: -#if 0 - case E_TEP_GRAB: - gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - text_view->i_cursor, - command->time); - break; - gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time); - break; -#endif - case E_TEP_NOP: - break; - } - - if (!edit->button_down) { - int x; - int i; - struct line *lines; - ECellTextLineBreaks *linebreaks; - - split_into_lines(cell); - - linebreaks = cell->breaks; - - for (lines = linebreaks->lines, i = 0; i < linebreaks->num_lines ; i++, lines ++) { - if (lines->text - cell->text > edit->selection_end) { - break; - } - } - lines --; - x = gdk_text_width(text_view->font, - lines->text, - edit->selection_end - (lines->text - cell->text)); - - - if (x < edit->xofs_edit) { - edit->xofs_edit = x; - redraw = TRUE; - } - - if (2 + x - cell->width > edit->xofs_edit) { - edit->xofs_edit = 2 + x - cell->width; - redraw = TRUE; - } - unref_lines(cell); - } - - if ( redraw ) { - ect_queue_redraw (text_view, edit->cell.view_col, edit->cell.row); - } -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif -} - -static void _invisible_destroy (GtkInvisible *invisible, - CellEdit *edit) -{ - edit->invisible = NULL; -} - -static GtkWidget *e_cell_text_view_get_invisible(CellEdit *edit) -{ - GtkWidget *invisible; - if (edit->invisible) { - invisible = edit->invisible; - } else { - invisible = gtk_invisible_new(); - edit->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - edit); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - edit); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - edit); - } - return invisible; -} - -static void -_selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - CellEdit *edit) -{ - if (event->selection == GDK_SELECTION_PRIMARY) { - g_free (edit->primary_selection); - edit->primary_selection = NULL; - edit->primary_length = 0; - - edit->has_selection = FALSE; -#if 0 - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -#endif - - } else if (event->selection == clipboard_atom) { - g_free (edit->clipboard_selection); - edit->clipboard_selection = NULL; - edit->clipboard_length = 0; - } -} - -static void -_selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - CellEdit *edit) -{ - switch (info) { - case E_SELECTION_PRIMARY: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, edit->primary_selection, edit->primary_length); - break; - case E_SELECTION_CLIPBOARD: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, edit->clipboard_selection, edit->clipboard_length); - break; - } -} - -static void -_selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - CellEdit *edit) -{ - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - return; - } else { - ETextEventProcessorCommand command; - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.string = selection_data->data; - command.value = selection_data->length; - command.time = time; - e_cell_text_view_command(edit->tep, &command, edit); - } -} - -static void e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, guchar *data, gint length) -{ - gboolean successful; - GtkWidget *invisible; - - invisible = e_cell_text_view_get_invisible(edit); - - if (selection == GDK_SELECTION_PRIMARY ) { - if (edit->primary_selection) { - g_free (edit->primary_selection); - } - edit->primary_selection = g_strndup(data, length); - edit->primary_length = length; - } else if (selection == clipboard_atom) { - if (edit->clipboard_selection) { - g_free (edit->clipboard_selection); - } - edit->clipboard_selection = g_strndup(data, length); - edit->clipboard_length = length; - } - - successful = gtk_selection_owner_set (invisible, - selection, - time); - - if (selection == GDK_SELECTION_PRIMARY) - edit->has_selection = successful; -} - -static void -e_cell_text_view_get_selection(CellEdit *edit, GdkAtom selection, guint32 time) -{ - GtkWidget *invisible; - invisible = e_cell_text_view_get_invisible(edit); - gtk_selection_convert(invisible, - selection, - GDK_SELECTION_TYPE_STRING, - time); -} - -static void -_get_tep(CellEdit *edit) -{ - if (!edit->tep) { - edit->tep = e_text_event_processor_emacs_like_new(); - gtk_object_ref (GTK_OBJECT (edit->tep)); - gtk_object_sink (GTK_OBJECT (edit->tep)); - gtk_signal_connect(GTK_OBJECT(edit->tep), - "command", - GTK_SIGNAL_FUNC(e_cell_text_view_command), - (gpointer) edit); - } -} - -/* Splits the text of the text item into lines */ -static void -split_into_lines (CurrentCell *cell) -{ - char *p; - struct line *lines; - int len; - - gchar *text = cell->text; - ECellTextLineBreaks *linebreaks = cell->breaks; - - if (! cell->breaks) { - cell->breaks = g_new(ECellTextLineBreaks, 1); - cell->breaks->ref_count = 1; - } else { - cell->breaks->ref_count ++; - return; - } - linebreaks = cell->breaks; - - /* Check if already split. */ - - linebreaks->lines = NULL; - linebreaks->num_lines = 0; - - if (!text) - return; - - /* First, count the number of lines */ - - for (p = text; *p; p++) - if (*p == '\n') - linebreaks->num_lines++; - - linebreaks->num_lines++; - - /* Allocate array of lines and calculate split positions */ - - linebreaks->lines = lines = g_new0 (struct line, linebreaks->num_lines); - len = 0; - - for (p = text; *p; p++) { - if (len == 0) - lines->text = p; - if (*p == '\n') { - lines->length = len; - lines++; - len = 0; - } else - len++; - } - - if (len == 0) - lines->text = p; - lines->length = len; - - calc_line_widths (cell); -} - -/* Free lines structure. */ -static void -unref_lines(CurrentCell *cell) -{ - if ( cell->breaks ) { - cell->breaks->ref_count --; - if ( cell->breaks->ref_count <= 0 ) { - g_free(cell->breaks->lines); - g_free(cell->breaks); - cell->breaks = NULL; - } - } -} - -static void -calc_ellipsis (ECellTextView *text_view) -{ - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - if (text_view->font) - text_view->ellipsis_width = - gdk_text_width (text_view->font, - ect->ellipsis ? ect->ellipsis : "...", - ect->ellipsis ? strlen (ect->ellipsis) : 3); -} - -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (CurrentCell *cell) -{ - ECellTextView *text_view = cell->text_view; - ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell); - GdkFont *font = text_view->font; - ECellTextLineBreaks *linebreaks = cell->breaks; - struct line *lines; - int i; - int j; - - - - lines = linebreaks->lines; - linebreaks->max_width = 0; - - if (!lines) - return; - - for (i = 0; i < linebreaks->num_lines; i++) { - if (lines->length != 0) { - if (font) { - lines->width = gdk_text_width (font, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (ect->use_ellipsis && - (!(text_view->edit && - cell->row == text_view->edit->cell.row && - cell->view_col == text_view->edit->cell.view_col)) && - lines->width > cell->width) { - if (font) { - lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++ ) { - if (gdk_text_width (font, lines->text, j) + text_view->ellipsis_width <= cell->width) - lines->ellipsis_length = j; - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = gdk_text_width (font, lines->text, lines->ellipsis_length) + - text_view->ellipsis_width; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > linebreaks->max_width) - linebreaks->max_width = lines->width; - } else { - lines->width = 0; - lines->ellipsis_length = 0; - } - - lines++; - } -} - -static void -build_current_cell (CurrentCell *cell, ECellTextView *text_view, int model_col, int view_col, int row) -{ - ECellView *ecell_view = (ECellView *) text_view; - cell->text_view = text_view; - cell->model_col = model_col; - cell->view_col = view_col; - cell->row = row; - cell->breaks = NULL; - cell->text = e_table_model_value_at (ecell_view->e_table_model, model_col, row); - cell->width = e_table_header_get_column(((ETableItem *)ecell_view->e_table_item_view)->header, view_col)->width - 8; -} diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h deleted file mode 100644 index 80afdf46ac..0000000000 --- a/widgets/table/e-cell-text.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* ECellText - Text item for e-table. - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * Drawing and event handling from: - * - * EText - Text item for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ -#ifndef _E_CELL_TEXT_H_ -#define _E_CELL_TEXT_H_ - -#include -#include "e-cell.h" -#include "e-text-event-processor.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; - - double x, y; /* Position at anchor */ - - gulong pixel; /* Fill color */ - - /* Clip handling */ - char *ellipsis; /* The ellipsis characters. NULL = "...". */ - - guint use_ellipsis : 1; /* Whether to use the ellipsis. */ - guint editable : 1; /* Item is editable */ -} 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, gboolean editable); - -#endif /* _E_CELL_TEXT_H_ */ - - diff --git a/widgets/table/e-cell-toggle.c b/widgets/table/e-cell-toggle.c deleted file mode 100644 index 679d04a0ca..0000000000 --- a/widgets/table/e-cell-toggle.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * e-cell-toggle.c: Multi-state image toggle cell object. - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include -#include -#include -#include -#include "e-cell-toggle.h" -#include "e-util/e-util.h" -#include "e-table-item.h" - -#define PARENT_TYPE e_cell_get_type() - -typedef struct { - ECellView cell_view; - GdkGC *gc; - GnomeCanvas *canvas; -} ECellToggleView; - -static ECellClass *parent_class; - -static void -etog_queue_redraw (ECellToggleView *text_view, int view_col, int view_row) -{ - e_table_item_redraw_range ( - text_view->cell_view.e_table_item_view, - view_col, view_row, view_col, view_row); -} - -/* - * ECell::realize method - */ -static ECellView * -etog_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - ECellToggleView *toggle_view = g_new0 (ECellToggleView, 1); - ETableItem *eti = E_TABLE_ITEM (e_table_item_view); - GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas; - - toggle_view->cell_view.ecell = ecell; - toggle_view->cell_view.e_table_model = table_model; - toggle_view->cell_view.e_table_item_view = e_table_item_view; - toggle_view->canvas = canvas; - - return (ECellView *) toggle_view; -} - -static void -etog_kill_view (ECellView *ecell_view) -{ - g_free (ecell_view); -} - -static void -etog_realize (ECellView *ecell_view) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - - toggle_view->gc = gdk_gc_new (GTK_WIDGET (toggle_view->canvas)->window); -} - -/* - * ECell::unrealize method - */ -static void -etog_unrealize (ECellView *ecv) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecv; - - gdk_gc_unref (toggle_view->gc); - toggle_view->gc = NULL; -} - -/* - * ECell::draw method - */ -static void -etog_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, gboolean selected, - int x1, int y1, int x2, int y2) -{ - ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - GdkPixbuf *image; - ArtPixBuf *art; - int x, y, width, height; - const int value = GPOINTER_TO_INT ( - e_table_model_value_at (ecell_view->e_table_model, model_col, row)); - - if (value >= toggle->n_states){ - g_warning ("Value from the table model is %d, the states we support are [0..%d)\n", - value, toggle->n_states); - return; - } - - /* - * Paint the background - */ - gdk_draw_rectangle (drawable, GTK_WIDGET (toggle_view->canvas)->style->white_gc, TRUE, x1, y1, x2 - x1, y2 - y1); - - image = toggle->images [value]; - art = image->art_pixbuf; - - if ((x2 - x1) < art->width){ - x = x1; - width = x2 - x1; - } else { - x = x1 + ((x2 - x1) - art->width) / 2; - width = art->width; - } - - if ((y2 - y1) < art->height){ - y = y1; - height = y2 - y1; - } else { - y = y1 + ((y2 - y1) - art->height) / 2; - height = art->height; - } - - width = y2 - y1; - - if (image->art_pixbuf->has_alpha){ - GdkColor background; - guchar *buffer; - int alpha, ix, iy; - - buffer = g_malloc (art->rowstride * art->height * 3); - - background.red = 255; - background.green = 255; - background.blue = 255; - - for (iy = 0; iy < art->height; iy++){ - unsigned char *dest; - unsigned char *src; - - dest = buffer + (iy * art->rowstride); - src = art->pixels + (iy * art->rowstride); - - for (ix = 0; ix < art->width; ix++){ - alpha = src [3]; - if (alpha == 0){ - *dest++ = background.red; - *dest++ = background.green; - *dest++ = background.blue; - src += 3; - } else if (alpha == 255){ - *dest++ = *src++; - *dest++ = *src++; - *dest++ = *src++; - } else { - *dest++ = (background.red + ((*src++ - background.red) * alpha + 0x80)) >> 8; - *dest++ = (background.green + ((*src++ - background.green) * alpha + 0x80)) >> 8; - *dest++ = (background.blue + ((*src++ - background.blue) * alpha + 0x80)) >> 8; - } - src++; - } - } - - gdk_draw_rgb_image_dithalign ( - drawable, toggle_view->gc, x, y, width, height, - GDK_RGB_DITHER_NORMAL, buffer, art->rowstride, 0, 0); - - g_free (buffer); - } else - gdk_draw_rgb_image_dithalign ( - drawable, toggle_view->gc, x, y, width, height, - GDK_RGB_DITHER_NORMAL, art->pixels, art->rowstride, 0, 0); -} - -static void -etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int row, int value) -{ - ECell *ecell = toggle_view->cell_view.ecell; - ECellToggle *toggle = E_CELL_TOGGLE (ecell); - - if (value >= toggle->n_states) - value = 0; - - e_table_model_set_value_at (toggle_view->cell_view.e_table_model, - model_col, row, GINT_TO_POINTER (value)); - etog_queue_redraw (toggle_view, view_col, row); -} - -/* - * ECell::event method - */ -static gint -etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) -{ - ECellToggleView *toggle_view = (ECellToggleView *) ecell_view; - void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row); - const int value = GPOINTER_TO_INT (_value); - - switch (event->type){ - case GDK_BUTTON_RELEASE: - etog_set_value (toggle_view, model_col, view_col, row, value + 1); - return TRUE; - - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_space){ - etog_set_value (toggle_view, model_col, view_col, row, value + 1); - return TRUE; - } - return FALSE; - - default: - return FALSE; - } - return TRUE; -} - -/* - * ECell::height method - */ -static int -etog_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell); - - return toggle->height; -} - -static void -etog_destroy (GtkObject *object) -{ - ECellToggle *etog = E_CELL_TOGGLE (object); - int i; - - for (i = 0; i < etog->n_states; i++) - gdk_pixbuf_unref (etog->images [i]); - - g_free (etog->images); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -static void -e_cell_toggle_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - object_class->destroy = etog_destroy; - - ecc->new_view = etog_new_view; - ecc->kill_view = etog_kill_view; - ecc->realize = etog_realize; - ecc->unrealize = etog_unrealize; - ecc->draw = etog_draw; - ecc->event = etog_event; - ecc->height = etog_height; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -E_MAKE_TYPE(e_cell_toggle, "ECellToggle", ECellToggle, e_cell_toggle_class_init, NULL, PARENT_TYPE); - -void -e_cell_toggle_construct (ECellToggle *etog, int border, int n_states, GdkPixbuf **images) -{ - int max_height = 0; - int i; - - etog->border = border; - etog->n_states = n_states; - - etog->images = g_new (GdkPixbuf *, n_states); - - for (i = 0; i < n_states; i++){ - etog->images [i] = images [i]; - gdk_pixbuf_ref (images [i]); - - if (images [i]->art_pixbuf->height > max_height) - max_height = images [i]->art_pixbuf->height; - } - - etog->height = max_height; -} - -ECell * -e_cell_toggle_new (int border, int n_states, GdkPixbuf **images) -{ - ECellToggle *etog = gtk_type_new (e_cell_toggle_get_type ()); - - e_cell_toggle_construct (etog, border, n_states, images); - - return (ECell *) etog; -} - - diff --git a/widgets/table/e-cell-toggle.h b/widgets/table/e-cell-toggle.h deleted file mode 100644 index d5773b454a..0000000000 --- a/widgets/table/e-cell-toggle.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _E_CELL_TOGGLE_H_ -#define _E_CELL_TOGGLE_H_ - -#include -#include -#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 1d87019007..0000000000 --- a/widgets/table/e-cell.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * e-cell.c: base class for cell renderers in e-table - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include "e-cell.h" -#include "e-util/e-util.h" - -#define PARENT_TYPE gtk_object_get_type() - -static ECellView * -ec_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - return NULL; -} - -static void -ec_realize (ECellView *e_cell) -{ -} - -static void -ec_kill_view (ECellView *ecell_view) -{ -} - -static void -ec_unrealize (ECellView *e_cell) -{ -} - -static void -ec_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, gboolean selected, - int x1, int y1, int x2, int y2) -{ - g_error ("e-cell-draw invoked\n"); -} - -static gint -ec_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) -{ - g_error ("e-cell-event invoked\n"); - return 0; -} - -static gint -ec_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - g_error ("e-cell-event invoked\n"); - return 0; -} - -static void -ec_focus (ECellView *ecell_view, int model_col, int view_col, int row, int x1, int y1, int x2, int y2) -{ - ecell_view->focus_col = view_col; - ecell_view->focus_row = row; - ecell_view->focus_x1 = x1; - ecell_view->focus_y1 = y1; - ecell_view->focus_x2 = x2; - ecell_view->focus_y2 = y2; -} - -static void -ec_unfocus (ECellView *ecell_view) -{ - ecell_view->focus_col = -1; - ecell_view->focus_row = -1; - ecell_view->focus_x1 = -1; - ecell_view->focus_y1 = -1; - ecell_view->focus_x2 = -1; - ecell_view->focus_y2 = -1; -} - -static void * -ec_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return NULL; -} - -static void -ec_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *context) -{ -} - -static void -e_cell_class_init (GtkObjectClass *object_class) -{ - ECellClass *ecc = (ECellClass *) object_class; - - ecc->realize = ec_realize; - ecc->unrealize = ec_unrealize; - ecc->new_view = ec_new_view; - ecc->kill_view = ec_kill_view; - ecc->draw = ec_draw; - ecc->event = ec_event; - ecc->focus = ec_focus; - ecc->unfocus = ec_unfocus; - ecc->height = ec_height; - ecc->enter_edit = ec_enter_edit; - ecc->leave_edit = ec_leave_edit; -} - -static void -e_cell_init (GtkObject *object) -{ -} - -E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE); - - -void -e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->event ( - ecell_view, event, model_col, view_col, row); -} - -ECellView * -e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell)->klass)->new_view ( - ecell, table_model, e_table_item_view); -} - -void -e_cell_realize (ECellView *ecell_view) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->realize (ecell_view); -} - -void -e_cell_kill_view (ECellView *ecell_view) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->kill_view (ecell_view); -} - -void -e_cell_unrealize (ECellView *ecell_view) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->unrealize (ecell_view); -} - -void -e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, gboolean selected, int x1, int y1, int x2, int y2) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->draw ( - ecell_view, drawable, model_col, view_col, row, selected, x1, y1, x2, y2); -} - -int -e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->height ( - ecell_view, model_col, view_col, row); -} - -void * -e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row) -{ - return E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->enter_edit ( - ecell_view, model_col, view_col, row); -} - -void -e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context) -{ - E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass)->leave_edit ( - ecell_view, model_col, view_col, row, edit_context); -} diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h deleted file mode 100644 index b21653d6d1..0000000000 --- a/widgets/table/e-cell.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _E_CELL_H_ -#define _E_CELL_H_ - -#include -#include -#include "e-table-model.h" - -#define E_CELL_TYPE (e_cell_get_type ()) -#define E_CELL(o) (GTK_CHECK_CAST ((o), E_CELL_TYPE, ECell)) -#define E_CELL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass)) -#define E_IS_CELL(o) (GTK_CHECK_TYPE ((o), E_CELL_TYPE)) -#define E_IS_CELL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TYPE)) - -typedef struct _ECell ECell; -typedef struct _ECellView ECellView; - -struct _ECell { - GtkObject object; -}; - -struct _ECellView { - ECell *ecell; - ETableModel *e_table_model; - void *e_table_item_view; - - gint focus_x1, focus_y1, focus_x2, focus_y2; - gint focus_col, focus_row; -}; - -#define E_CELL_IS_FOCUSED(ecell_view) (ecell_view->focus_x1 != -1) - -typedef struct { - GtkObjectClass parent_class; - - ECellView *(*new_view) (ECell *ecell, ETableModel *table_model, void *e_table_item_view); - void (*kill_view) (ECellView *ecell_view); - - void (*realize) (ECellView *ecell_view); - void (*unrealize) (ECellView *ecell_view); - - void (*draw) (ECellView *ecell_view, GdkDrawable *drawable, - int model_col, int view_col, int row, - gboolean selected, int x1, int y1, int x2, int y2); - gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row); - void (*focus) (ECellView *ecell_view, int model_col, int view_col, - int row, int x1, int y1, int x2, int y2); - void (*unfocus) (ECellView *ecell_view); - int (*height) (ECellView *ecell_view, int model_col, int view_col, int row); - - void *(*enter_edit)(ECellView *ecell_view, int model_col, int view_col, int row); - void (*leave_edit)(ECellView *ecell_view, int model_col, int view_col, int row, void *context); -} ECellClass; - -GtkType e_cell_get_type (void); -ECellView *e_cell_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view); -void e_cell_kill_view (ECellView *ecell_view); - -void e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row); - -void e_cell_realize (ECellView *ecell_view); -void e_cell_unrealize (ECellView *ecell_view); - -void e_cell_draw (ECellView *ecell_view, GdkDrawable *dr, - int model_col, int view_col, int row, gboolean selected, - int x1, int y1, int x2, int y2); -void e_cell_print (ECellView *ecell_view, GnomePrintContext *context, - int model_col, int view_col, int row, - double width, double height); -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 e2e12caf63..0000000000 --- a/widgets/table/e-table-col.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-col.c: ETableCol implementation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include "e-table-col.h" -#include "e-util/e-util.h" - -#define PARENT_TYPE (gtk_object_get_type ()) - -static GtkObjectClass *parent_class; - -static void -etc_destroy (GtkObject *object) -{ - ETableCol *etc = E_TABLE_COL (object); - - if ( etc->is_pixbuf ) - gdk_pixbuf_unref( etc->pixbuf ); - else - 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->is_pixbuf = FALSE; - - etc->col_idx = col_idx; - etc->text = g_strdup (text); - etc->pixbuf = NULL; - etc->width = width; - etc->min_width = min_width; - etc->ecell = ecell; - etc->compare = compare; - - etc->arrow = E_TABLE_COL_ARROW_NONE; - - etc->selected = 0; - etc->resizeable = resizable; - - return etc; -} - -ETableCol * -e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, 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->is_pixbuf = TRUE; - - etc->col_idx = col_idx; - etc->text = NULL; - etc->pixbuf = pixbuf; - etc->width = width; - etc->min_width = min_width; - etc->ecell = ecell; - etc->compare = compare; - - etc->arrow = E_TABLE_COL_ARROW_NONE; - - etc->selected = 0; - etc->resizeable = resizable; - - gdk_pixbuf_ref(etc->pixbuf); - - return etc; -} - -void -e_table_col_set_arrow (ETableCol *col, ETableColArrow arrow) -{ - col->arrow = arrow; -} - -ETableColArrow -e_table_col_get_arrow (ETableCol *col) -{ - return col->arrow; -} - - diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h deleted file mode 100644 index c6f9c9dfb5..0000000000 --- a/widgets/table/e-table-col.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_COL_H_ -#define _E_TABLE_COL_H_ - -#include "e-cell.h" -#include - -#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; -typedef struct _ETableColClass ETableColClass; -typedef enum _ETableColArrow ETableColArrow; - -enum _ETableColArrow { - E_TABLE_COL_ARROW_NONE, - E_TABLE_COL_ARROW_UP, - E_TABLE_COL_ARROW_DOWN -}; - -/* - * Information about a single column - */ -struct _ETableCol { - GtkObject base; - char *text; - GdkPixbuf *pixbuf; - short width; - short min_width; - short x; - GCompareFunc compare; - unsigned int is_pixbuf:1; - unsigned int selected:1; - unsigned int resizeable:1; - int col_idx; - - ETableColArrow arrow; - - ECell *ecell; -}; - -struct _ETableColClass { - GtkObjectClass parent_class; -}; - -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); -ETableCol *e_table_col_new_with_pixbuf (int col_idx, GdkPixbuf *pixbuf, - int width, int min_width, - ECell *ecell, GCompareFunc compare, - gboolean resizable); -void e_table_col_destroy (ETableCol *etc); -void e_table_col_set_arrow (ETableCol *col, ETableColArrow arrow); -ETableColArrow e_table_col_get_arrow (ETableCol *col); - - -#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 -#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 -#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-container.c b/widgets/table/e-table-group-container.c deleted file mode 100644 index 1ae73b6c3b..0000000000 --- a/widgets/table/e-table-group-container.c +++ /dev/null @@ -1,853 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include "e-table-group-container.h" -#include "e-table-item.h" -#include -#include "e-util/e-util.h" -#include "e-util/e-canvas-utils.h" -#include "widgets/e-text/e-text.h" - -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define BUTTON_HEIGHT 10 -#define BUTTON_PADDING 2 - -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgc_parent_class; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_FROZEN -}; - -static void etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static int etgc_event (GnomeCanvasItem *item, GdkEvent *event); -static void etgc_realize (GnomeCanvasItem *item); -static void etgc_unrealize (GnomeCanvasItem *item); - -static void etgc_add (ETableGroup *etg, gint row); -static gboolean etgc_remove (ETableGroup *etg, gint row); -static void etgc_increment (ETableGroup *etg, gint position, gint amount); -static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col); - -static void etgc_child_resize (GtkObject *object, gpointer data); - -static void etgc_queue_reposition (ETableGroupContainer *etgc); - -typedef struct { - ETableGroup *child; - void *key; - GnomeCanvasItem *text; - GnomeCanvasItem *rect; - gint count; -} ETableGroupContainerChildNode; - -static void -e_table_group_container_child_node_free(ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node) -{ - ETableGroup *etg = E_TABLE_GROUP(etgc); - ETableGroup *child = child_node->child; - gtk_object_destroy(GTK_OBJECT(child)); - e_table_model_free_value(etg->model, etgc->ecol->col_idx, child_node->key); - gtk_object_destroy(GTK_OBJECT(child_node->text)); - gtk_object_destroy(GTK_OBJECT(child_node->rect)); -} - -static void -e_table_group_container_list_free(ETableGroupContainer *etgc) -{ - ETableGroupContainerChildNode *child_node; - GList *list; - if ( etgc->idle ) - g_source_remove( etgc->idle ); - for ( list = etgc->children; list; list = g_list_next(list) ) { - child_node = (ETableGroupContainerChildNode *) list->data; - e_table_group_container_child_node_free(etgc, child_node); - } - g_list_free(etgc->children); -} - -static void -etgc_destroy (GtkObject *object) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - - if ( etgc->font ) { - gdk_font_unref(etgc->font); - etgc->font = NULL; - } - if ( etgc->ecol ) { - gtk_object_unref(GTK_OBJECT(etgc->ecol)); - } - if ( etgc->rect ) { - gtk_object_destroy(GTK_OBJECT(etgc->rect)); - } - e_table_group_container_list_free(etgc); - - GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object); -} - -#if 0 -void -e_table_group_add (ETableGroup *etg, GnomeCanvasItem *item) -{ - double x1, y1, x2, y2; - - g_return_if_fail (etg != NULL); - g_return_if_fail (item != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - etg->children = g_list_append (etg->children, item); - - GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etg)->klass)->bounds (etg, &x1, &y1, &x2, &y2); - - if (GTK_OBJECT (etg)->flags & GNOME_CANVAS_ITEM_REALIZED){ - GList *l; - int height = etg->transparent ? 0 : TITLE_HEIGHT; - int x = etg->transparent ? 0 : GROUP_INDENT; - - for (l = etg->children; l->next; l = l->next){ - GnomeCanvasItem *child = l->data; - - height += child->y2 - child->y1; - - printf ("Height\n"); - if (E_IS_TABLE_ITEM (item)){ - printf (" Item: "); - } else { - printf (" Group: "); - } - printf ("%d\n", child->y2-child->y1); - } - - e_canvas_item_move_absolute ( item, x, height); - - - if (E_IS_TABLE_ITEM (item)){ - - printf ("Table item! ---------\n"); - gtk_signal_connect (GTK_OBJECT (item), "resize", - GTK_SIGNAL_FUNC (etg_relayout), etg); - } - } -} - -static void -etg_realize (GnomeCanvasItem *item) -{ - ETableGroup *etg = E_TABLE_GROUP (item); - GList *l; - int height = 0; - - GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->realize (item); - - for (l = etg->children; l; l = l->next){ - GnomeCanvasItem *child = l->data; - - printf ("During realization for child %p -> %d\n", child, height); - gnome_canvas_item_set ( - child, - "y", (double) height, - NULL); - - height += child->y2 - child->y1; - } -} - -static void -etg_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ETableGroup *etg = E_TABLE_GROUP (item); - - GNOME_CANVAS_ITEM_CLASS (etg_parent_class)->update (item, affine, clip_path, flags); - - if (!etg->transparent){ - int current_width, current_height; - - etg_dim (etg, ¤t_width, ¤t_height); - - if ((current_height != etg->height) || (current_width != etg->width)){ - etg->width = current_width; - etg->height = current_height; - - gnome_canvas_item_set ( - etg->rect, - "x1", 0.0, - "y1", 0.0, - "x2", (double) etg->width, - "y2", (double) etg->height, - NULL); - } - } -} -#endif - -void -e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules) -{ - e_table_group_construct (parent, E_TABLE_GROUP (etgc), full_header, header, model); - etgc->ecol = ecol; - gtk_object_ref(GTK_OBJECT(etgc->ecol)); - etgc->child_rules = child_rules; - etgc->ascending = ascending; - - etgc->font = gdk_font_load ("lucidasans-10"); -#if 0 - etgc->open = open; - etgc->transparent = transparent; - - etgc_dim (etgc, &etgc->width, &etgc->height); - - if (!etgc->transparent) - etgc->rect = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (etgc), - gnome_canvas_rect_get_type (), - "fill_color", "gray", - "outline_color", "gray20", - "x1", 0.0, - "y1", 0.0, - "x2", (double) etgc->width, - "y2", (double) etgc->height, - NULL); -#endif - -#if 0 - /* - * Reparent the child into our space. - */ - gnome_canvas_item_reparent (child, GNOME_CANVAS_GROUP (etgc)); - - gnome_canvas_item_set ( - child, - "x", (double) GROUP_INDENT, - "y", (double) TITLE_HEIGHT, - NULL); - - /* - * Force dimension computation - */ - GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update ( - GNOME_CANVAS_ITEM (etgc), NULL, NULL, GNOME_CANVAS_UPDATE_REQUESTED); -#endif -} - -ETableGroup * -e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules) -{ - ETableGroupContainer *etgc; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (ecol != NULL, NULL); - - etgc = gtk_type_new (e_table_group_container_get_type ()); - - e_table_group_container_construct (parent, etgc, full_header, header, - model, ecol, ascending, child_rules); - return E_TABLE_GROUP (etgc); -} - -#if 0 -static void -etgc_relayout (GnomeCanvasItem *eti, ETableGroupContainer *etgc) -{ - GList *l; - int height = etgc->transparent ? 0 : GROUP_INDENT; - gboolean move = FALSE; - - printf ("Relaying out\n"); - - for (l = etgc->children; l->next; l = l->next){ - GnomeCanvasItem *child = l->data; - - height += child->y2 - child->y1; - - if (child == eti) - move = TRUE; - - if (move){ - printf ("Moving item %p\n", child); - gnome_canvas_item_set ( child, - "y", (double) height, - NULL); - } - } - if (height != etgc->height){ - etgc->height = height; - gtk_signal_emit (GTK_OBJECT (etgc), etgc_signals [RESIZE]); - } -} - -void -e_table_group_container_add (ETableGroupContainer *etgc, GnomeCanvasItem *item) -{ - double x1, y1, x2, y2; - - g_return_if_fail (etgc != NULL); - g_return_if_fail (item != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etgc)); - g_return_if_fail (GNOME_IS_CANVAS_ITEM (item)); - - etgc->children = g_list_append (etgc->children, item); - - GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (etgc)->klass)->bounds (etgc, &x1, &y1, &x2, &y2); - - if (GTK_OBJECT (etgc)->flags & GNOME_CANVAS_ITEM_REALIZED){ - GList *l; - int height = etgc->transparent ? 0 : TITLE_HEIGHT; - int x = etgc->transparent ? 0 : GROUP_INDENT; - - for (l = etgc->children; l->next; l = l->next){ - GnomeCanvasItem *child = l->data; - - height += child->y2 - child->y1; - - printf ("Height\n"); - if (E_IS_TABLE_ITEM (item)){ - printf (" Item: "); - } else { - printf (" Group: "); - } - printf ("%d\n", child->y2-child->y1); - } - - e_canvas_item_move_absolute ( item, x, height); - - - if (E_IS_TABLE_ITEM (item)){ - - printf ("Table item! ---------\n"); - gtk_signal_connect (GTK_OBJECT (item), "resize", - GTK_SIGNAL_FUNC (etgc_relayout), etgc); - } - } -} - -static void -etgc_realize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item); - GList *l; - int height = 0; - - GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->realize (item); - - for (l = etgc->children; l; l = l->next){ - GnomeCanvasItem *child = l->data; - - printf ("During realization for child %p -> %d\n", child, height); - gnome_canvas_item_set ( - child, - "y", (double) height, - NULL); - - height += child->y2 - child->y1; - } -} - -static void -etgc_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (item); - - GNOME_CANVAS_ITEM_CLASS (etgc_parent_class)->update (item, affine, clip_path, flags); - - if ( etgc->need_resize ) { - - if (!etgc->transparent){ - int current_width, current_height; - - etgc_dim (etgc, ¤t_width, ¤t_height); - - if ((current_height != etgc->height) || (current_width != etgc->width)){ - etgc->width = current_width; - etgc->height = current_height; - - gnome_canvas_item_set ( - etgc->rect, - "x1", 0.0, - "y1", 0.0, - "x2", (double) etgc->width, - "y2", (double) etgc->height, - NULL); - } - } - etgc->need_resize = FALSE; - } -} -#endif - -static int -etgc_event (GnomeCanvasItem *item, GdkEvent *event) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item); - gboolean return_val = TRUE; - gboolean change_focus = FALSE; - gboolean use_col = FALSE; - gint start_col = 0; - gint old_col; - EFocus direction = E_FOCUS_START; - - switch (event->type) { - case GDK_KEY_PRESS: - if (event->key.keyval == GDK_Tab || - event->key.keyval == GDK_KP_Tab || - event->key.keyval == GDK_ISO_Left_Tab) { - change_focus = TRUE; - use_col = TRUE; - start_col = (event->key.state & GDK_SHIFT_MASK) ? -1 : 0; - direction = (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START; - } else if (event->key.keyval == GDK_Left || - event->key.keyval == GDK_KP_Left) { - change_focus = TRUE; - use_col = TRUE; - start_col = -1; - direction = E_FOCUS_END; - } else if (event->key.keyval == GDK_Right || - event->key.keyval == GDK_KP_Right) { - change_focus = TRUE; - use_col = TRUE; - start_col = 0; - direction = E_FOCUS_START; - } else if (event->key.keyval == GDK_Down || - event->key.keyval == GDK_KP_Down) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_START; - } else if (event->key.keyval == GDK_Up || - event->key.keyval == GDK_KP_Up) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_END; - } else if (event->key.keyval == GDK_Return || - event->key.keyval == GDK_KP_Enter) { - change_focus = TRUE; - use_col = FALSE; - direction = E_FOCUS_START; - } - if ( change_focus ) { - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - ETableGroup *child = child_node->child; - if (e_table_group_get_focus(child)) { - old_col = e_table_group_get_focus_column(child); - if ( old_col == -1 ) - old_col = 0; - if ( start_col == -1 ) - start_col = e_table_header_count(e_table_group_get_header(child)) - 1; - - if (direction == E_FOCUS_END) - list = list->prev; - else - list = list->next; - - if (list) { - child_node = (ETableGroupContainerChildNode *)list->data; - child = child_node->child; - if (use_col) - e_table_group_set_focus(child, direction, start_col); - else { - e_table_group_set_focus(child, direction, old_col); - } - return 1; - } else { - return 0; - } - } - } - } - return_val = FALSE; - default: - return_val = FALSE; - } - if ( return_val == FALSE ) { - if ( GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event ) - return GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->event(item, event); - } - return return_val; - -} - -/* Realize handler for the text item */ -static void -etgc_realize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc; - - if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->realize) (item); - - etgc = E_TABLE_GROUP_CONTAINER (item); -} - -/* Unrealize handler for the etgc item */ -static void -etgc_unrealize (GnomeCanvasItem *item) -{ - ETableGroupContainer *etgc; - - etgc = E_TABLE_GROUP_CONTAINER (item); - - if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (item); -} - -static void -compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node) -{ - /* FIXME : What a hack, eh? */ - gchar *text = g_strdup_printf("%s : %s (%d item%s)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count, child_node->count == 1 ? "" : "s" ); - gnome_canvas_item_set(child_node->text, - "text", text, - NULL); - g_free(text); -} - -static void etgc_add (ETableGroup *etg, gint row) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, row); - GCompareFunc comp = etgc->ecol->compare; - GList *list = etgc->children; - ETableGroup *child; - ETableGroupContainerChildNode *child_node; - int i = 0; - for ( ; list; list = g_list_next(list), i++ ) { - int comp_val; - child_node = (ETableGroupContainerChildNode *)(list->data); - comp_val = (*comp)(child_node->key, val); - if ( comp_val == 0 ) { - child = child_node->child; - child_node->count ++; - e_table_group_add(child, row); - compute_text(etgc, child_node); - return; - } - if ( (comp_val > 0 && etgc->ascending) || - (comp_val < 0 && (!etgc->ascending)) ) - break; - } - child_node = g_new(ETableGroupContainerChildNode, 1); - child_node->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc), - gnome_canvas_rect_get_type (), - "fill_color", "grey70", - "outline_color", "grey50", - NULL); - child_node->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgc), - e_text_get_type(), - "font_gdk", etgc->font, - "anchor", GTK_ANCHOR_SW, - "x", (double) 0, - "y", (double) 0, - "fill_color", "black", - NULL); - child = e_table_group_new(GNOME_CANVAS_GROUP(etgc), etg->full_header, etg->header, etg->model, etgc->child_rules); - child_node->child = child; - child_node->key = e_table_model_duplicate_value(etg->model, etgc->ecol->col_idx, val); - - gtk_signal_connect(GTK_OBJECT(child), "resize", - etgc_child_resize, etgc); - child_node->count = 1; - e_table_group_add(child, row); - if ( list ) { - etgc->children = g_list_insert(etgc->children, child_node, i); - } - else - etgc->children = g_list_append(etgc->children, child_node); - compute_text(etgc, child_node); - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static gboolean etgc_remove (ETableGroup *etg, gint row) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list = etgc->children; - for ( ; list; list = g_list_next(list) ) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; - ETableGroup *child = child_node->child; - if ( e_table_group_remove(child, row) ) { - child_node->count --; - if ( child_node->count == 0 ) { - e_table_group_container_child_node_free(etgc, child_node); - etgc->children = g_list_remove(etgc->children, child_node); - g_free(child_node); - } else { - compute_text(etgc, child_node); - } - return TRUE; - } - } - return FALSE; - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static void etgc_increment (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - GList *list = etgc->children; - for ( ; list; list = g_list_next(list) ) { - e_table_group_increment(((ETableGroupContainerChildNode *)list->data)->child, position, amount); - } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static void etgc_set_focus (ETableGroup *etg, EFocus direction, gint view_col) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - if (etgc->children) { - if (direction == E_FOCUS_END) { - e_table_group_set_focus(((ETableGroupContainerChildNode *)g_list_last(etgc->children)->data)->child, direction, view_col); - } else { - e_table_group_set_focus(((ETableGroupContainerChildNode *)etgc->children->data)->child, direction, view_col); - } - } - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static gint -etgc_get_focus_column (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg); - if (etgc->children) { - GList *list; - for (list = etgc->children; list; list = list->next) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data; - ETableGroup *child = child_node->child; - if (e_table_group_get_focus(child)) { - return e_table_group_get_focus_column(child); - } - } - } - return 0; -} - -static void etgc_thaw (ETableGroup *etg) -{ - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static void -etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - if ( GTK_VALUE_BOOL (*arg) ) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - etgc_thaw(etg); - } - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width ) - E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width(etg, GTK_VALUE_DOUBLE (*arg)); - break; - default: - break; - } -} - -static void -etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void etgc_set_width (ETableGroup *etg, gdouble width) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - GList *list = etgc->children; - etgc->width = width; - - for ( ; list; list = g_list_next(list) ) { - gdouble child_width = width - GROUP_INDENT; - gtk_object_set(GTK_OBJECT(((ETableGroupContainerChildNode *)list->data)->child), - "width", child_width, - NULL); - } - - etgc_queue_reposition(E_TABLE_GROUP_CONTAINER(etg)); -} - -static gdouble etgc_get_width (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - return etgc->width; -} - -static gdouble etgc_get_height (ETableGroup *etg) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); - return etgc->height; -} - -static void -etgc_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS( object_class ); - - object_class->destroy = etgc_destroy; - object_class->set_arg = etgc_set_arg; - object_class->get_arg = etgc_get_arg; - - item_class->event = etgc_event; - item_class->realize = etgc_realize; - item_class->unrealize = etgc_unrealize; - - etgc_parent_class = gtk_type_class (PARENT_TYPE); - - e_group_class->add = etgc_add; - e_group_class->remove = etgc_remove; - e_group_class->increment = etgc_increment; - e_group_class->set_focus = etgc_set_focus; - e_group_class->get_focus_column = etgc_get_focus_column; - e_group_class->thaw = etgc_thaw; - - e_group_class->get_width = etgc_get_width; - e_group_class->set_width = etgc_set_width; - e_group_class->get_height = etgc_get_height; - - gtk_object_add_arg_type ("ETableGroupContainer::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableGroupContainer::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_FROZEN); -} - -static void -etgc_init (GtkObject *object) -{ - ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object); - container->children = FALSE; -} - -static gboolean -etgc_update_positioning (ETableGroupContainer *etgc, gpointer data) -{ - gboolean frozen; - gtk_object_get(GTK_OBJECT(etgc), - "frozen", &frozen, - NULL); - if ( frozen ) { - etgc->idle = 0; - return FALSE; - } - if ( GTK_OBJECT_FLAGS( etgc ) & GNOME_CANVAS_ITEM_REALIZED ) { - gdouble old_height; - - old_height = etgc->height; - if ( etgc->children == NULL ) { - } else { - GList *list; - gdouble extra_height; - gdouble running_height; - gdouble item_height = 0; - - extra_height = 0; - if (etgc->font) - extra_height += etgc->font->ascent + etgc->font->descent + BUTTON_PADDING * 2; - - extra_height = MAX(extra_height, BUTTON_HEIGHT + BUTTON_PADDING * 2); - - running_height = extra_height; - - list = etgc->children; - for ( ; list; list = g_list_next(list) ) { - ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data; - ETableGroup *child = child_node->child; - gtk_object_get( GTK_OBJECT(child), - "height", &item_height, - NULL ); - - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(child_node->text), - GROUP_INDENT, - running_height - BUTTON_PADDING); - - e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(child), - GROUP_INDENT, - running_height); - - gnome_canvas_item_set(GNOME_CANVAS_ITEM(child_node->rect), - "x1", (double) 0, - "x2", (double) etgc->width, - "y1", (double) running_height - extra_height, - "y2", (double) running_height + item_height, - NULL); - - running_height += item_height + extra_height; - } - running_height -= extra_height; - if ( running_height != old_height) { - etgc->height = running_height; - gtk_signal_emit_by_name (GTK_OBJECT (etgc), "resize"); - } - } - } - etgc->idle = 0; - return FALSE; -} - -static void -etgc_queue_reposition (ETableGroupContainer *etgc) -{ - if (etgc->idle == 0) - etgc->idle = g_idle_add((GSourceFunc)etgc_update_positioning, etgc); -} - -static void -etgc_child_resize (GtkObject *object, gpointer data) -{ - ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(data); - etgc_queue_reposition (etgc); -} - -E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE); - diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h deleted file mode 100644 index 2234e77ac1..0000000000 --- a/widgets/table/e-table-group-container.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_CONTAINER_H_ -#define _E_TABLE_GROUP_CONTAINER_H_ - -#include -#include "e-table-model.h" -#include "e-table-header.h" -#include "e-table-group.h" - -#define E_TABLE_GROUP_CONTAINER_TYPE (e_table_group_container_get_type ()) -#define E_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainer)) -#define E_TABLE_GROUP_CONTAINER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainerClass)) -#define E_IS_TABLE_GROUP_CONTAINER(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_CONTAINER_TYPE)) -#define E_IS_TABLE_GROUP_CONTAINER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_CONTAINER_TYPE)) - -typedef struct { - ETableGroup group; - - /* - * The ETableCol used to group this set - */ - ETableCol *ecol; - gint ascending; - - /* - * List of ETableGroups we stack - */ - GList *children; - - /* - * The canvas rectangle that contains the children - */ - GnomeCanvasItem *rect; - - GdkFont *font; - - gdouble width, height; - - void *child_rules; - - gint idle; - - /* - * Update booleans: - */ - guint need_resize : 1; - - /* - * State: the ETableGroup is open or closed - */ - guint open:1; -} ETableGroupContainer; - -typedef struct { - ETableGroupClass parent_class; -} ETableGroupContainerClass; - -ETableGroup *e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header, ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules); -void e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, ETableCol *ecol, int ascending, xmlNode *child_rules); - -GtkType e_table_group_container_get_type (void); - -#endif /* _E_TABLE_GROUP_CONTAINER_H_ */ diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c deleted file mode 100644 index 2e939453d7..0000000000 --- a/widgets/table/e-table-group-leaf.c +++ /dev/null @@ -1,296 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include "e-table-group-leaf.h" -#include "e-table-item.h" -#include -#include "e-util/e-util.h" - -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define PARENT_TYPE e_table_group_get_type () - -static GnomeCanvasGroupClass *etgl_parent_class; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_FROZEN -}; - -static void etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void -etgl_destroy (GtkObject *object) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(object); - gtk_object_unref(GTK_OBJECT(etgl->subset)); - gtk_object_destroy(GTK_OBJECT(etgl->item)); - if ( GTK_OBJECT_CLASS (etgl_parent_class)->destroy ) - GTK_OBJECT_CLASS (etgl_parent_class)->destroy (object); -} - -static void -e_table_group_leaf_construct (GnomeCanvasGroup *parent, ETableGroupLeaf *etgl, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - int col, - int ascending) -{ - etgl->subset = E_TABLE_SUBSET_VARIABLE(e_table_sorted_variable_new(model, col, ascending, e_table_header_get_column(full_header, col)->compare)); - e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model); -} - -ETableGroup * -e_table_group_leaf_new (GnomeCanvasGroup *parent, ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - int col, - int ascending) -{ - ETableGroupLeaf *etgl; - - g_return_val_if_fail (parent != NULL, NULL); - - etgl = gtk_type_new (e_table_group_leaf_get_type ()); - - e_table_group_leaf_construct (parent, etgl, full_header, - header, model, col, ascending); - return E_TABLE_GROUP (etgl); -} - -static void -etgl_resize (GtkObject *object, gpointer data) -{ - e_table_group_resize (E_TABLE_GROUP(data)); -} - -static void -etgl_realize (GnomeCanvasItem *item) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(item); - gdouble height; - - if ( GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize ) - GNOME_CANVAS_ITEM_CLASS (etgl_parent_class)->realize (item); - - etgl->item = E_TABLE_ITEM(gnome_canvas_item_new(GNOME_CANVAS_GROUP(etgl), - e_table_item_get_type (), - "ETableHeader", E_TABLE_GROUP(etgl)->header, - "ETableModel", etgl->subset, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - "width", etgl->width, - NULL)); - gtk_signal_connect(GTK_OBJECT(etgl->item), - "resize", etgl_resize, etgl); - gtk_object_get(GTK_OBJECT(etgl->item), - "height", &height, - NULL); - if ( height != 1 ) - e_table_group_resize(E_TABLE_GROUP(etgl)); -} - -static int -etgl_event (GnomeCanvasItem *item, GdkEvent *event) -{ - gboolean return_val = TRUE; - - switch (event->type) { - - default: - return_val = FALSE; - } - if ( return_val == FALSE ) { - if ( GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event ) - return GNOME_CANVAS_ITEM_CLASS(etgl_parent_class)->event(item, event); - } - return return_val; - -} - -static void -etgl_add (ETableGroup *etg, gint row) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - e_table_subset_variable_add(etgl->subset, row); -} - -static gboolean -etgl_remove (ETableGroup *etg, gint row) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - return e_table_subset_variable_remove(etgl->subset, row); -} - -static void -etgl_increment (ETableGroup *etg, gint position, gint amount) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - e_table_subset_variable_increment(etgl->subset, position, amount); -} - -static void -etgl_set_focus (ETableGroup *etg, EFocus direction, gint view_col) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - if (direction == E_FOCUS_END) { - e_table_item_focus(etgl->item, view_col, e_table_model_row_count(E_TABLE_MODEL(etgl->subset)) - 1); - } else { - e_table_item_focus(etgl->item, view_col, 0); - } -} - -static gint -etgl_get_focus_column (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - return e_table_item_get_focused_column(etgl->item); -} - -static void -etgl_set_width (ETableGroup *etg, gdouble width) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - etgl->width = width; -#if 0 - if ( etgl->item ) { - gnome_canvas_item_set(GNOME_CANVAS_ITEM(etgl->item), - "width", width, - NULL); - } -#endif -} - -static gdouble -etgl_get_width (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - gtk_object_get(GTK_OBJECT(etgl->item), - "width", &etgl->width, - NULL); - return etgl->width; -} - -static gdouble -etgl_get_height (ETableGroup *etg) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg); - gdouble height; - if ( etgl->item ) - gtk_object_get(GTK_OBJECT(etgl->item), - "height", &height, - NULL); - else - height = 1; - return height; -} - -static void -etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - if ( GTK_VALUE_BOOL (*arg) ) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - } - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width ) - E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->set_width(etg, GTK_VALUE_DOUBLE (*arg)); - break; - default: - break; - } -} - -static void -etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_height(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - case ARG_WIDTH: - if ( E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width ) - GTK_VALUE_DOUBLE (*arg) = E_TABLE_GROUP_CLASS(GTK_OBJECT(etg)->klass)->get_width(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -etgl_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS( object_class ); - - object_class->destroy = etgl_destroy; - object_class->set_arg = etgl_set_arg; - object_class->get_arg = etgl_get_arg; - - item_class->realize = etgl_realize; - item_class->event = etgl_event; - - etgl_parent_class = gtk_type_class (PARENT_TYPE); - - e_group_class->add = etgl_add; - e_group_class->remove = etgl_remove; - e_group_class->increment = etgl_increment; - e_group_class->set_focus = etgl_set_focus; - e_group_class->get_focus_column = etgl_get_focus_column; - - e_group_class->get_width = etgl_get_width; - e_group_class->set_width = etgl_set_width; - e_group_class->get_height = etgl_get_height; - - gtk_object_add_arg_type ("ETableGroupLeaf::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableGroupLeaf::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_FROZEN); -} - -static void -etgl_init (GtkObject *object) -{ - ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object); - - etgl->width = 1; - etgl->subset = NULL; - etgl->item = NULL; -} - -E_MAKE_TYPE (e_table_group_leaf, "ETableGroupLeaf", ETableGroupLeaf, etgl_class_init, etgl_init, PARENT_TYPE); diff --git a/widgets/table/e-table-group-leaf.h b/widgets/table/e-table-group-leaf.h deleted file mode 100644 index 6ffd9066d1..0000000000 --- a/widgets/table/e-table-group-leaf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_LEAF_H_ -#define _E_TABLE_GROUP_LEAF_H_ - -#include -#include "e-table-group.h" -#include "e-table-sorted-variable.h" -#include "e-table-item.h" - -#define E_TABLE_GROUP_LEAF_TYPE (e_table_group_leaf_get_type ()) -#define E_TABLE_GROUP_LEAF(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeaf)) -#define E_TABLE_GROUP_LEAF_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeafClass)) -#define E_IS_TABLE_GROUP_LEAF(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_LEAF_TYPE)) -#define E_IS_TABLE_GROUP_LEAF_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_LEAF_TYPE)) - -typedef struct { - ETableGroup group; - - /* - * Item. - */ - ETableItem *item; - - gdouble width; - - ETableSubsetVariable *subset; -} ETableGroupLeaf; - -typedef struct { - ETableGroupClass parent_class; -} ETableGroupLeafClass; - -ETableGroup *e_table_group_leaf_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - int col, - int ascending); -GtkType e_table_group_leaf_get_type (void); - -#endif /* _E_TABLE_GROUP_LEAF_H_ */ diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c deleted file mode 100644 index 6ae8a25db7..0000000000 --- a/widgets/table/e-table-group.c +++ /dev/null @@ -1,369 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include "e-table-group.h" -#include "e-table-group-container.h" -#include "e-table-group-leaf.h" -#include "e-table-item.h" -#include -#include -#include "e-util/e-util.h" -#include "e-util/e-xml-utils.h" - -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define PARENT_TYPE gnome_canvas_group_get_type () - -#define ETG_CLASS(e) (E_TABLE_GROUP_CLASS(GTK_OBJECT(e)->klass)) - -static GnomeCanvasGroupClass *etg_parent_class; - -enum { - RESIZE, - LAST_SIGNAL -}; - -static gint etg_signals [LAST_SIGNAL] = { 0, }; - -/* The arguments we take */ -enum { - ARG_0, - ARG_HEIGHT, - ARG_WIDTH, - ARG_FROZEN -}; - -static void etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean etg_get_focus (ETableGroup *etg); -static void etg_destroy (GtkObject *object); -#if 0 -GnomeCanvasItem * -e_table_group_new (GnomeCanvasGroup *parent, ETableCol *ecol, - gboolean open, gboolean transparent) -{ - ETableGroup *etg; - - g_return_val_if_fail (parent != NULL, NULL); - g_return_val_if_fail (ecol != NULL, NULL); - - etg = gtk_type_new (e_table_group_get_type ()); - - e_table_group_construct (parent, etg, ecol, open, transparent); - - return GNOME_CANVAS_ITEM (etg); -} -#endif - -static void -etg_destroy (GtkObject *object) -{ - ETableGroup *etg = E_TABLE_GROUP(object); - gtk_object_unref(GTK_OBJECT(etg->header)); - gtk_object_unref(GTK_OBJECT(etg->full_header)); - gtk_object_unref(GTK_OBJECT(etg->model)); - if ( GTK_OBJECT_CLASS (etg_parent_class)->destroy ) - GTK_OBJECT_CLASS (etg_parent_class)->destroy (object); -} - -ETableGroup * -e_table_group_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - xmlNode *rules) -{ - int column; - int ascending; - - g_return_val_if_fail (model != NULL, NULL); - - column = e_xml_get_integer_prop_by_name(rules, "column"); - ascending = e_xml_get_integer_prop_by_name(rules, "ascending"); - - if(rules && !xmlStrcmp(rules->name, "group")) { - ETableCol *col; - if ( column > e_table_header_count(full_header) ) - return e_table_group_leaf_new(parent, full_header, header, model, column, ascending); - col = e_table_header_get_columns(full_header)[column]; - return e_table_group_container_new(parent, full_header, header, model, col, ascending, rules->childs); - } else { - return e_table_group_leaf_new(parent, full_header, header, model, column, ascending); - } - return NULL; -} - -void -e_table_group_construct (GnomeCanvasGroup *parent, - ETableGroup *etg, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model) -{ - etg->full_header = full_header; - gtk_object_ref(GTK_OBJECT(etg->full_header)); - etg->header = header; - gtk_object_ref(GTK_OBJECT(etg->header)); - etg->model = model; - gtk_object_ref(GTK_OBJECT(etg->model)); - gnome_canvas_item_constructv (GNOME_CANVAS_ITEM (etg), parent, 0, NULL); -} - -void -e_table_group_add (ETableGroup *etg, - gint row) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->add ) - ETG_CLASS (etg)->add (etg, row); -} - -gboolean -e_table_group_remove (ETableGroup *etg, - gint row) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if ( ETG_CLASS (etg)->remove ) - return ETG_CLASS (etg)->remove (etg, row); - else - return FALSE; -} - -gint -e_table_group_get_count (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, 0); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), 0); - - if ( ETG_CLASS (etg)->get_count ) - return ETG_CLASS (etg)->get_count (etg); - else - return 0; -} - -void -e_table_group_increment (ETableGroup *etg, - gint position, - gint amount) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->increment ) - ETG_CLASS (etg)->increment (etg, position, amount); -} - -void -e_table_group_set_focus (ETableGroup *etg, - EFocus direction, - gint row) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->set_focus ) - ETG_CLASS (etg)->set_focus (etg, direction, row); -} - -gboolean -e_table_group_get_focus (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if ( ETG_CLASS (etg)->get_focus ) - return ETG_CLASS (etg)->get_focus (etg); - else - return FALSE; -} - -gboolean -e_table_group_get_focus_column (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE); - - if ( ETG_CLASS (etg)->get_focus_column ) - return ETG_CLASS (etg)->get_focus_column (etg); - else - return FALSE; -} - -ETableCol * -e_table_group_get_ecol (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL); - - if ( ETG_CLASS (etg)->get_ecol ) - return ETG_CLASS (etg)->get_ecol (etg); - else - return NULL; -} - -void -e_table_group_resize (ETableGroup *e_table_group) -{ - g_return_if_fail (e_table_group != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (e_table_group)); - - gtk_signal_emit (GTK_OBJECT (e_table_group), - etg_signals [RESIZE]); -} - -ETableHeader * -e_table_group_get_header (ETableGroup *etg) -{ - g_return_val_if_fail (etg != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL); - - return etg->header; -} - -static int -etg_event (GnomeCanvasItem *item, GdkEvent *event) -{ - ETableGroup *etg = E_TABLE_GROUP (item); - gboolean return_val = TRUE; - - switch (event->type) { - - case GDK_FOCUS_CHANGE: - etg->has_focus = event->focus_change.in; - return_val = FALSE; - - default: - return_val = FALSE; - } - if ( return_val == FALSE ) { - if ( GNOME_CANVAS_ITEM_CLASS(etg_parent_class)->event ) - return GNOME_CANVAS_ITEM_CLASS(etg_parent_class)->event(item, event); - } - return return_val; - -} - -static void -etg_thaw(ETableGroup *etg) -{ - g_return_if_fail (etg != NULL); - g_return_if_fail (E_IS_TABLE_GROUP (etg)); - - if ( ETG_CLASS (etg)->thaw ) - ETG_CLASS (etg)->thaw (etg); -} - -static void -etg_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - if ( GTK_VALUE_BOOL (*arg) ) - etg->frozen = TRUE; - else { - etg->frozen = FALSE; - etg_thaw(etg); - } - break; - case ARG_WIDTH: - if ( ETG_CLASS(etg)->set_width ) - ETG_CLASS(etg)->set_width(etg, GTK_VALUE_DOUBLE (*arg)); - break; - default: - break; - } -} - -static void -etg_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ETableGroup *etg = E_TABLE_GROUP (object); - - switch (arg_id) { - case ARG_FROZEN: - GTK_VALUE_BOOL (*arg) = etg->frozen; - break; - case ARG_HEIGHT: - if ( ETG_CLASS(etg)->get_height ) - GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_height(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - case ARG_WIDTH: - if ( ETG_CLASS(etg)->get_width ) - GTK_VALUE_DOUBLE (*arg) = ETG_CLASS(etg)->get_width(etg); - else - arg->type = GTK_TYPE_INVALID; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static gboolean -etg_get_focus (ETableGroup *etg) -{ - return etg->has_focus; -} - -static void -etg_class_init (GtkObjectClass *object_class) -{ - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class; - ETableGroupClass *klass = (ETableGroupClass *) object_class; - - object_class->set_arg = etg_set_arg; - object_class->get_arg = etg_get_arg; - object_class->destroy = etg_destroy; - - item_class->event = etg_event; - - klass->resize = NULL; - - klass->add = NULL; - klass->remove = NULL; - klass->get_count = NULL; - klass->increment = NULL; - klass->set_focus = NULL; - klass->get_focus = etg_get_focus; - klass->get_ecol = NULL; - - klass->thaw = NULL; - klass->get_height = NULL; - klass->get_width = NULL; - klass->set_width = NULL; - - etg_parent_class = gtk_type_class (PARENT_TYPE); - - etg_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableGroupClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, etg_signals, LAST_SIGNAL); -} - -E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE); - - - diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h deleted file mode 100644 index 0dd62eb125..0000000000 --- a/widgets/table/e-table-group.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_GROUP_H_ -#define _E_TABLE_GROUP_H_ - -#include -#include -#include "e-table-model.h" -#include "e-table-header.h" -#include "e-util/e-util.h" - -#define E_TABLE_GROUP_TYPE (e_table_group_get_type ()) -#define E_TABLE_GROUP(o) (GTK_CHECK_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup)) -#define E_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_GROUP_TYPE, ETableGroupClass)) -#define E_IS_TABLE_GROUP(o) (GTK_CHECK_TYPE ((o), E_TABLE_GROUP_TYPE)) -#define E_IS_TABLE_GROUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_GROUP_TYPE)) - -typedef struct { - GnomeCanvasGroup group; - - /* - * The full header. - */ - ETableHeader *full_header; - ETableHeader *header; - - /* - * The model we pull data from. - */ - ETableModel *model; - - /* - * Whether we should add indentation and open/close markers, - * or if we just act as containers of subtables. - */ - guint transparent : 1; - - guint has_focus : 1; - - guint frozen : 1; -} ETableGroup; - -typedef struct { - GnomeCanvasGroupClass parent_class; - void (*resize) (ETableGroup *etg); - - void (*add) (ETableGroup *etg, gint row); - gboolean (*remove) (ETableGroup *etg, gint row); - gint (*get_count) (ETableGroup *etg); - void (*increment) (ETableGroup *etg, gint position, gint amount); - void (*set_focus) (ETableGroup *etg, EFocus direction, gint view_col); - gboolean (*get_focus) (ETableGroup *etg); - gint (*get_focus_column) (ETableGroup *etg); - ETableCol *(*get_ecol) (ETableGroup *etg); - - void (*thaw) (ETableGroup *etg); - gdouble (*get_height) (ETableGroup *etg); - gdouble (*get_width) (ETableGroup *etg); - void (*set_width) (ETableGroup *etg, gdouble width); -} ETableGroupClass; - -void e_table_group_add (ETableGroup *etg, - gint row); -gboolean e_table_group_remove (ETableGroup *etg, - gint row); -gint e_table_group_get_count (ETableGroup *etg); -void e_table_group_increment (ETableGroup *etg, - gint position, - gint amount); -void e_table_group_set_focus (ETableGroup *etg, - EFocus direction, - gint view_col); -gboolean e_table_group_get_focus (ETableGroup *etg); -gint e_table_group_get_focus_column (ETableGroup *etg); -ETableHeader *e_table_group_get_header (ETableGroup *etg); -ETableCol *e_table_group_get_ecol (ETableGroup *etg); - -ETableGroup *e_table_group_new (GnomeCanvasGroup *parent, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model, - xmlNode *rules); -void e_table_group_construct (GnomeCanvasGroup *parent, - ETableGroup *etg, - ETableHeader *full_header, - ETableHeader *header, - ETableModel *model); - -/* For emitting the signal */ -void e_table_group_resize (ETableGroup *etg); - -GtkType e_table_group_get_type (void); - -#endif /* _E_TABLE_GROUP_H_ */ diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c deleted file mode 100644 index 6b6146c938..0000000000 --- a/widgets/table/e-table-header-item.c +++ /dev/null @@ -1,920 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include -#include "e-util/e-cursors.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-col-dnd.h" - -#include "add-col.xpm" -#include "remove-col.xpm" - -/* Padding above and below of the string in the header display */ -#define PADDING 4 - -#define MIN_ARROW_SIZE 10 - -/* 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; - -static void ethi_request_redraw (ETableHeaderItem *ethi); - - -/* - * 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; - if ( ethi->height < MIN_ARROW_SIZE + 4 + PADDING ) - ethi->height = MIN_ARROW_SIZE + 4 + 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) -{ - /* Check if it's the correct ethi */ - if (ethi->drag_col == -1) - return FALSE; - - gdk_drag_status (context, 0, time); - if (GTK_WIDGET(canvas) == gtk_drag_get_source_widget(context)) { - 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); - gdk_drag_status (context, context->suggested_action, time); - } else { - ethi_remove_drop_marker (ethi); - ethi_add_destroy_marker (ethi); - } - } else { - ethi_remove_drop_marker (ethi); - ethi_add_destroy_marker (ethi); - } - } - - return TRUE; -} - -static void -ethi_drag_end (GtkWidget *canvas, GdkDragContext *context, ETableHeaderItem *ethi) -{ - if (ethi->drag_col == -1) - return; - - if (canvas == gtk_drag_get_source_widget(context)) { - if (context->action == 0) { - ethi_request_redraw (ethi); - e_table_header_remove(ethi->eth, ethi->drag_col); - } - ethi_remove_drop_marker (ethi); - ethi_remove_destroy_marker (ethi); - ethi->drag_col = -1; - } -} - -static gboolean -ethi_drag_drop (GtkWidget *canvas, - GdkDragContext *context, - gint x, - gint y, - guint time, - ETableHeaderItem *ethi) -{ - gboolean successful = FALSE; - - if (ethi->drag_col == -1) - return FALSE; - - if (GTK_WIDGET(canvas) == gtk_drag_get_source_widget(context)) { - 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); - ethi_add_drop_marker(ethi, col); - - if (col != -1) { - if (col != ethi->drag_col) { - ethi_request_redraw (ethi); - e_table_header_move(ethi->eth, ethi->drag_col, col); - } - successful = TRUE; - } - } - } - gtk_drag_finish(context, successful, successful, time); - return successful; -} - -static void -ethi_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, ETableHeaderItem *ethi) -{ - if (ethi->drag_col == -1) - return; - - if (widget == gtk_drag_get_source_widget(context)) { - 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){ - g_warning ("Font had not been set for this ETableHeader"); - ethi_font_load (ethi, "fixed"); - } - - /* - * Now, configure DnD - */ - gtk_drag_dest_set (GTK_WIDGET (item->canvas), 0, - 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); - - ethi->drag_drop_id = gtk_signal_connect ( - GTK_OBJECT (item->canvas), "drag_drop", - GTK_SIGNAL_FUNC (ethi_drag_drop), 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); - gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_drop_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 + PADDING / 2; - clip.y = y + PADDING / 2; - clip.width = width - PADDING; - clip.height = ethi->height; - - gdk_gc_set_clip_rectangle (ethi->gc, &clip); - - if ( col->is_pixbuf ) { - xtra = (clip.width - gdk_pixbuf_get_width(col->pixbuf))/2; - - xtra += PADDING / 2; - - gdk_pixbuf_render_to_drawable_alpha(col->pixbuf, - drawable, - 0, 0, - x + xtra, y + (clip.height - gdk_pixbuf_get_height(col->pixbuf)) / 2, - gdk_pixbuf_get_width(col->pixbuf), gdk_pixbuf_get_height(col->pixbuf), - GDK_PIXBUF_ALPHA_FULL, 128, - GDK_RGB_DITHER_NORMAL, - 0, 0); - } else { - /* Center the thing */ - xtra = (clip.width - gdk_string_measure (ethi->font, col->text))/2; - - /* Skip over border */ - if (xtra < 0) - xtra = 0; - - xtra += PADDING / 2; - - gdk_draw_text ( - drawable, ethi->font, - ethi->gc, x + xtra, y + ethi->height - ethi->font->descent - PADDING / 2, - col->text, strlen (col->text)); - } - - switch ( e_table_col_get_arrow(col) ) { - case E_TABLE_COL_ARROW_NONE: - break; - case E_TABLE_COL_ARROW_UP: - case E_TABLE_COL_ARROW_DOWN: - gtk_paint_arrow (gtk_widget_get_style(GTK_WIDGET(GNOME_CANVAS_ITEM(ethi)->canvas)), - drawable, - GTK_STATE_NORMAL, - GTK_SHADOW_IN, - &clip, - GTK_WIDGET(GNOME_CANVAS_ITEM(ethi)->canvas), - "header", - e_table_col_get_arrow(col) == E_TABLE_COL_ARROW_UP ? GTK_ARROW_UP : GTK_ARROW_DOWN, - TRUE, - x + PADDING / 2 + clip.width - MIN_ARROW_SIZE - 2, - y + (ethi->height - MIN_ARROW_SIZE) / 2, - MIN_ARROW_SIZE, - MIN_ARROW_SIZE); - break; - } -} - -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; - ETableCol *ecol; - int col_width; - GdkPixmap *pixmap; - GdkGC *gc; - - 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); - - ecol = e_table_header_get_column (ethi->eth, ethi->drag_col); - if (ethi->drag_col == ethi->resize_col) - col_width = ethi->resize_width; - else - col_width = ecol->width; - pixmap = gdk_pixmap_new(widget->window, col_width, ethi->height, -1); - gc = widget->style->bg_gc [GTK_STATE_ACTIVE]; - draw_button (ethi, ecol, pixmap, gc, - widget->style, - 0, 0, col_width, ethi->height); - gtk_drag_set_icon_pixmap (context, - gdk_window_get_colormap(widget->window), - pixmap, - NULL, - col_width / 2, - ethi->height / 2); - gdk_pixmap_unref(pixmap); - - 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) - new_width = 1; - - if (new_width < ethi->resize_min_width) - new_width = ethi->resize_min_width; - 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 156e25beef..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 -#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, drag_drop_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 91aa366932..0000000000 --- a/widgets/table/e-table-header.c +++ /dev/null @@ -1,345 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-col-head.c: TableColHead implementation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc - */ -#include -#include -#include -#include -#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) -{ - memmove (ð->columns [pos+1], ð->columns [pos], - sizeof (ETableCol *) * (eth->col_count - pos)); - eth->columns [pos] = val; - eth->col_count ++; -} - -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_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])); - - memmove (ð->columns [idx], ð->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); - - { - if ( start_col < 0 ) - start_col = 0; - if ( end_col > eth->col_count ) - end_col = eth->col_count - 1; - - total = 0; - for (col = start_col; col < end_col; col++){ - - 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 -#include -#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 222d4592cf..0000000000 --- a/widgets/table/e-table-item.c +++ /dev/null @@ -1,1368 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include -#include -#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, - RESIZE, - LAST_SIGNAL -}; - -static gint eti_signals [LAST_SIGNAL] = { 0, }; - -enum { - ARG_0, - ARG_TABLE_HEADER, - ARG_TABLE_MODEL, - ARG_TABLE_DRAW_GRID, - ARG_TABLE_DRAW_FOCUS, - ARG_MODE_SPREADSHEET, - ARG_LENGHT_THRESHOLD, - - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS -}; - -static gboolean -eti_editing (ETableItem *eti) -{ - if (eti->editing_col == -1) - return FALSE; - else - return TRUE; -} - -/* - * During realization, we have to invoke the per-ecell realize routine - * (On our current setup, we have one e-cell per column. - * - * We might want to optimize this to only realize the unique e-cells: - * ie, a strings-only table, uses the same e-cell for every column, and - * we might want to avoid realizing each e-cell. - */ -static void -eti_realize_cell_views (ETableItem *eti) -{ - int i; - - for (i = 0; i < eti->n_cells; i++) - e_cell_realize (eti->cell_views [i]); - eti->cell_views_realized = 1; -} - -static void eti_compute_height (ETableItem *eti); - -static void -eti_attach_cell_views (ETableItem *eti) -{ - int i; - - g_assert (eti->header); - g_assert (eti->table_model); - - /* - * Now realize the various ECells - */ - eti->n_cells = eti->cols; - eti->cell_views = g_new (ECellView *, eti->n_cells); - - for (i = 0; i < eti->n_cells; i++){ - ETableCol *col = e_table_header_get_column (eti->header, i); - - eti->cell_views [i] = e_cell_new_view (col->ecell, eti->table_model, eti); - } - - eti_compute_height (eti); -} - -/* - * During unrealization: we invoke every e-cell (one per column in the current - * setup) to dispose all X resources allocated - */ -static void -eti_unrealize_cell_views (ETableItem *eti) -{ - int i; - - if (eti->cell_views_realized == 0) - return; - - for (i = 0; i < eti->n_cells; i++) - e_cell_unrealize (eti->cell_views [i]); - eti->cell_views_realized = 0; -} - -static void -eti_detach_cell_views (ETableItem *eti) -{ - int i; - - for (i = 0; i < eti->n_cells; i++){ - e_cell_kill_view (eti->cell_views [i]); - eti->cell_views [i] = NULL; - } - - g_free (eti->cell_views); - eti->cell_views = NULL; - eti->n_cells = 0; -} - -static void -eti_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - double i2c [6]; - ArtPoint c1, c2, i1, i2; - ETableItem *eti = E_TABLE_ITEM (item); - - gnome_canvas_item_i2c_affine (item, i2c); - i1.x = eti->x1; - i1.y = eti->y1; - i2.x = eti->x1 + eti->width; - i2.y = eti->y1 + eti->height; - art_affine_point (&c1, &i1, i2c); - art_affine_point (&c2, &i2, i2c); - - item->x1 = c1.x; - item->y1 = c1.y; - item->x2 = c2.x; - item->y2 = c2.y; -} - - -/* - * GnomeCanvasItem::update method - */ -static void -eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags); - - eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2); - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); -} - -/* - * eti_remove_table_model: - * - * Invoked to release the table model associated with this ETableItem - */ -static void -eti_remove_table_model (ETableItem *eti) -{ - if (!eti->table_model) - return; - - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->table_model), - eti->table_model_row_change_id); - gtk_object_unref (GTK_OBJECT (eti->table_model)); - - eti->table_model_change_id = 0; - eti->table_model_row_change_id = 0; - eti->table_model = NULL; -} - -/* - * eti_remove_header_model: - * - * Invoked to release the header model associated with this ETableItem - */ -static void -eti_remove_header_model (ETableItem *eti) -{ - if (!eti->header) - return; - - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_structure_change_id); - gtk_signal_disconnect (GTK_OBJECT (eti->header), - eti->header_dim_change_id); - - if (eti->cell_views){ - eti_unrealize_cell_views (eti); - eti_detach_cell_views (eti); - } - gtk_object_unref (GTK_OBJECT (eti->header)); - - - eti->header_structure_change_id = 0; - eti->header_dim_change_id = 0; - eti->header = NULL; -} - -/* - * eti_row_height: - * - * Returns the height used by row @row. This does not include the one-pixel - * used as a separator between rows - */ -static int -eti_row_height (ETableItem *eti, int row) -{ - const int cols = e_table_header_count (eti->header); - int col; - int h, max_h; - - g_assert (eti->cell_views); - - max_h = 0; - - for (col = 0; col < cols; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - h = e_cell_height (eti->cell_views [col], ecol->col_idx, col, row); - - if (h > max_h) - max_h = h; - } - return max_h; -} - -/* - * eti_get_height: - * - * Returns the height of the ETableItem. - * - * The ETableItem might compute the whole height by asking every row its - * size. There is a special mode (designed to work when there are too - * many rows in the table that performing the previous step could take - * too long) set by the ETableItem->length_threshold that would determine - * when the height is computed by using the first row as the size for - * every other row in the ETableItem. - */ -static int -eti_get_height (ETableItem *eti) -{ - const int rows = eti->rows; - int row; - int height; - - if (rows == 0) - return 0; - - if (eti->length_threshold != -1){ - if (rows > eti->length_threshold){ - height = (eti_row_height (eti, 0) + 1) * rows; - - /* - * 1 pixel at the top - */ - return height + 1; - } - } - - height = 1; - for (row = 0; row < rows; row++) - height += eti_row_height (eti, row) + 1; - - return height; -} - -static void -eti_compute_height (ETableItem *eti) -{ - int new_height = eti_get_height (eti); - - if (new_height != eti->height){ - /* double x1, y1, x2, y2;*/ - printf ("Emitting!\n"); - - eti->height = new_height; - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RESIZE]); - } -} - -/* - * 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->focused_row > eti->rows - 1) { - eti->focused_row = eti->rows - 1; - } - - if (eti->cell_views) - eti_compute_height (eti); - - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_item_region_redraw (eti, 0, 0, eti->width, eti->height); -} - -static void -eti_item_region_redraw (ETableItem *eti, int x0, int y0, int x1, int y1) -{ - GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti); - ArtDRect rect; - double i2c [6]; - - rect.x0 = x0; - rect.y0 = y0; - rect.x1 = x1; - rect.y1 = y1; - - gnome_canvas_item_i2c_affine (item, i2c); - art_drect_affine_transform (&rect, &rect, i2c); - - gnome_canvas_request_redraw (item->canvas, rect.x0, rect.y0, rect.x1, rect.y1); -} - -/* - * eti_request_redraw: - * - * Queues a canvas redraw for the entire ETableItem. - */ -static void -eti_request_redraw (ETableItem *eti) -{ - eti_item_region_redraw (eti, eti->x1, eti->y1, eti->x1 + eti->width + 1, eti->y1 + eti->height + 1); -} - -/* - * Computes the distance between @start_row and @end_row in pixels - */ -static int -eti_row_diff (ETableItem *eti, int start_row, int end_row) -{ - int row, total; - - total = 0; - - for (row = start_row; row < end_row; row++) - total += eti_row_height (eti, row) + 1; - - return total; -} - -/* - * eti_request_region_redraw: - * - * Request a canvas redraw on the range (start_col, start_row) to (end_col, end_row). - * This is inclusive (ie, you can use: 0,0-0,0 to redraw the first cell). - * - * The @border argument is a number of pixels around the region that should also be queued - * for redraw. This is typically used by the focus routines to queue a redraw for the - * border as well. - */ -static void -eti_request_region_redraw (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row, int border) -{ - int x1, y1, width, height; - - x1 = e_table_header_col_diff (eti->header, 0, start_col); - y1 = eti_row_diff (eti, 0, start_row); - width = e_table_header_col_diff (eti->header, start_col, end_col + 1); - height = eti_row_diff (eti, start_row, end_row + 1); - - eti_item_region_redraw (eti, eti->x1 + x1 - border, - eti->y1 + y1 - border, - eti->x1 + x1 + width + 1 + border, - eti->y1 + y1 + height + 1 + border); -} - -static void -eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti) -{ - if (eti->renderers_can_change_size){ - eti_table_model_changed (table_model, eti); - return; - } - - eti_request_region_redraw (eti, 0, row, eti->cols, row, 0); -} - -void -e_table_item_redraw_range (ETableItem *eti, - int start_col, int start_row, - int end_col, int end_row) -{ - int border; - - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - if ((start_col == eti->focused_col) || - (end_col == eti->focused_col) || - (start_row == eti->focused_row) || - (end_row == eti->focused_row)) - border = 2; - else - border = 0; - - eti_request_region_redraw (eti, start_col, start_row, end_col, end_row, border); -} - -static void -eti_add_table_model (ETableItem *eti, ETableModel *table_model) -{ - g_assert (eti->table_model == NULL); - - eti->table_model = table_model; - gtk_object_ref (GTK_OBJECT (eti->table_model)); - - eti->table_model_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_changed", - GTK_SIGNAL_FUNC (eti_table_model_changed), eti); - - eti->table_model_row_change_id = gtk_signal_connect ( - GTK_OBJECT (table_model), "model_row_changed", - GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti); - - if (eti->header){ - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - } - - eti_table_model_changed (table_model, eti); -} - -static void -eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti) -{ - eti_request_redraw (eti); - - eti->width = e_table_header_total_width (eti->header); - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_request_redraw (eti); -} - -static void -eti_header_structure_changed (ETableHeader *eth, ETableItem *eti) -{ - eti_request_redraw (eti); - - eti->cols = e_table_header_count (eti->header); - eti->width = e_table_header_total_width (eti->header); - - /* - * There should be at least one column - */ - g_assert (eti->cols != 0); - - if (eti->cell_views){ - eti_unrealize_cell_views (eti); - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - eti_realize_cell_views (eti); - } else { - if (eti->table_model){ - eti_detach_cell_views (eti); - eti_attach_cell_views (eti); - } - } - - eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); - - eti_request_redraw (eti); -} - -static void -eti_add_header_model (ETableItem *eti, ETableHeader *header) -{ - g_assert (eti->header == NULL); - - eti->header = header; - gtk_object_ref (GTK_OBJECT (header)); - - eti_header_structure_changed (header, eti); - - eti->header_dim_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "dimension_change", - GTK_SIGNAL_FUNC (eti_header_dim_changed), eti); - - eti->header_structure_change_id = gtk_signal_connect ( - GTK_OBJECT (header), "structure_change", - GTK_SIGNAL_FUNC (eti_header_structure_changed), eti); -} - -/* - * GtkObject::destroy method - */ -static void -eti_destroy (GtkObject *object) -{ - ETableItem *eti = E_TABLE_ITEM (object); - - eti_remove_header_model (eti); - eti_remove_table_model (eti); - - g_slist_free (eti->selection); - - if (GTK_OBJECT_CLASS (eti_parent_class)->destroy) - (*GTK_OBJECT_CLASS (eti_parent_class)->destroy) (object); -} - -static void -eti_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - ETableItem *eti; - - item = GNOME_CANVAS_ITEM (o); - eti = E_TABLE_ITEM (o); - - switch (arg_id){ - case ARG_TABLE_HEADER: - eti_remove_header_model (eti); - eti_add_header_model (eti, GTK_VALUE_POINTER (*arg)); - break; - - case ARG_TABLE_MODEL: - eti_remove_table_model (eti); - eti_add_table_model (eti, GTK_VALUE_POINTER (*arg)); - break; - - case ARG_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_get_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_WIDTH: - GTK_VALUE_DOUBLE (*arg) = eti->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = eti->height; - break; - default: - arg->type = GTK_TYPE_INVALID; - } -} - -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 = 1; - - eti->selection_mode = GTK_SELECTION_SINGLE; -} - -#define gray50_width 2 -#define gray50_height 2 -static const char gray50_bits[] = { - 0x02, 0x01, }; - -static void -eti_realize (GnomeCanvasItem *item) -{ - ETableItem *eti = E_TABLE_ITEM (item); - GtkWidget *canvas_widget = GTK_WIDGET (item->canvas); - GdkWindow *window; - - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->realize)(item); - - /* - * Gdk Resource allocation - */ - window = canvas_widget->window; - - eti->fill_gc = canvas_widget->style->white_gc; - gdk_gc_ref (canvas_widget->style->white_gc); - - eti->grid_gc = gdk_gc_new (window); -#if 0 - /* This sets it to gray */ -/* gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); */ -#else - gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->black); -#endif - eti->focus_gc = gdk_gc_new (window); - gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]); - gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]); - eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height); - gdk_gc_set_ts_origin (eti->focus_gc, 0, 0); - gdk_gc_set_stipple (eti->focus_gc, eti->stipple); - gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED); - - if (eti->cell_views == NULL) - eti_attach_cell_views (eti); - - eti_realize_cell_views (eti); - - eti_compute_height (eti); - - eti_update (item, NULL, NULL, 0); -} - -static void -eti_unrealize (GnomeCanvasItem *item) -{ - ETableItem *eti = E_TABLE_ITEM (item); - - gdk_gc_unref (eti->fill_gc); - eti->fill_gc = NULL; - gdk_gc_unref (eti->grid_gc); - eti->grid_gc = NULL; - gdk_gc_unref (eti->focus_gc); - eti->focus_gc = NULL; - gdk_bitmap_unref (eti->stipple); - eti->stipple = NULL; - - eti_unrealize_cell_views (eti); - - eti->height = 0; - - if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize) - (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->unrealize)(item); -} - -static void -eti_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) -{ - ETableItem *eti = E_TABLE_ITEM (item); - const int rows = eti->rows; - const int cols = eti->cols; - int row, col, y1, y2; - int first_col, last_col, x_offset; - int first_row, last_row, y_offset, yd; - int x1, x2; - int f_x1, f_x2, f_y1, f_y2; - gboolean f_found; - double i2c [6]; - ArtPoint eti_base, eti_base_item; - - /* - * Clear the background - */ -#if 0 - gdk_draw_rectangle ( - drawable, eti->fill_gc, TRUE, - eti->x1 - x, eti->y1 - y, eti->width, eti->height); -#endif - - /* - * Find out our real position after grouping - */ - gnome_canvas_item_i2c_affine (item, i2c); - eti_base_item.x = eti->x1; - eti_base_item.y = eti->y1; - art_affine_point (&eti_base, &eti_base_item, i2c); - - /* - * First column to draw, last column to draw - */ - first_col = -1; - last_col = x_offset = 0; - x1 = x2 = floor (eti_base.x); - for (col = 0; col < cols; col++, x1 = x2){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - x2 = x1 + ecol->width; - - if (x1 > (x + width)) - break; - if (x2 < x) - continue; - if (first_col == -1){ - x_offset = x1 - x; - first_col = col; - } - } - last_col = col; - - /* - * Nothing to paint - */ - if (first_col == -1) - return; - - /* - * Compute row span. - */ - first_row = -1; - y_offset = 0; - y1 = y2 = floor (eti_base.y) + 1; - for (row = 0; row < rows; row++, y1 = y2){ - - y2 += eti_row_height (eti, row) + 1; - - if (y1 > y + height) - break; - - if (y2 < y) - continue; - - if (first_row == -1){ - y_offset = y1 - y; - first_row = row; - } - } - last_row = row; - - if (first_row == -1) - return; - - /* - * Draw cells - */ - yd = y_offset; - f_x1 = f_x2 = f_y1 = f_y2 = -1; - f_found = FALSE; - - if (eti->draw_grid && first_row == 0){ - gdk_draw_line ( - drawable, eti->grid_gc, - eti_base.x - x, yd, eti_base.x + eti->width - x, yd); - } - yd++; - - for (row = first_row; row < last_row; row++){ - int xd, height; - gboolean selected; - - height = eti_row_height (eti, row); - - xd = x_offset; -/* printf ("paint: %d %d\n", yd, yd + height); */ - - selected = g_slist_find (eti->selection, GINT_TO_POINTER (row)) != NULL; - - for (col = first_col; col < last_col; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - ECellView *ecell_view = eti->cell_views [col]; - - e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, selected, - xd, yd, xd + ecol->width, yd + height); - - if (col == eti->focused_col && row == eti->focused_row){ - f_x1 = xd; - f_x2 = xd + ecol->width; - f_y1 = yd; - f_y2 = yd + height; - f_found = TRUE; - } - - xd += ecol->width; - } - yd += height; - - if (eti->draw_grid) - gdk_draw_line ( - drawable, eti->grid_gc, - eti_base.x - x, yd, eti_base.x + eti->width - x, yd); - yd++; - } - - if (eti->draw_grid){ - int xd = x_offset; - - for (col = first_col; col <= last_col; col++){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - gdk_draw_line ( - drawable, eti->grid_gc, - xd, y_offset, xd, yd - 1); - - /* - * This looks wierd, but it is to draw the last line - */ - if (ecol) - xd += ecol->width; - } - } - - /* - * Draw focus - */ - if (f_found && eti->draw_focus){ - - if (!eti_editing (eti)) - gdk_draw_rectangle ( - drawable, eti->focus_gc, FALSE, - f_x1 + 1, f_y1, f_x2 - f_x1 - 2, f_y2 - f_y1 - 1); - } -} - -static double -eti_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item) -{ - *actual_item = item; - - return 0.0; -} - -static gboolean -find_cell (ETableItem *eti, double x, double y, int *col_res, int *row_res, double *x1_res, double *y1_res) -{ - const int cols = eti->cols; - const int rows = eti->rows; - gdouble x1, y1, x2, y2; - int col, row; - - /* FIXME: this routine is inneficient, fix later */ - - x -= eti->x1; - y -= eti->y1; - - x1 = 0; - for (col = 0; col < cols; col++, x1 = x2){ - ETableCol *ecol = e_table_header_get_column (eti->header, col); - - if (x < x1) - return FALSE; - - x2 = x1 + ecol->width; - - if (x > x2) - continue; - - *col_res = col; - if (x1_res) - *x1_res = x - x1; - break; - } - - y1 = y2 = 0; - for (row = 0; row < rows; row++, y1 = y2){ - if (y < y1) - return FALSE; - - y2 += eti_row_height (eti, row) + 1; - - if (y > y2) - continue; - - *row_res = row; - if (y1_res) - *y1_res = y - y1; - break; - } - - return TRUE; -} - -static void -eti_cursor_move (ETableItem *eti, gint row, gint column) -{ - e_table_item_leave_edit (eti); - e_table_item_focus (eti, column, row); -} - -static void -eti_cursor_move_left (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row, eti->focused_col - 1); -} - -static void -eti_cursor_move_right (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row, eti->focused_col + 1); -} - -static void -eti_cursor_move_up (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row - 1, eti->focused_col); -} - -static void -eti_cursor_move_down (ETableItem *eti) -{ - eti_cursor_move(eti, eti->focused_row + 1, eti->focused_col); -} - -static int -eti_event (GnomeCanvasItem *item, GdkEvent *e) -{ - ETableItem *eti = E_TABLE_ITEM (item); - ECellView *ecell_view; - ETableCol *ecol; - gint return_val = TRUE; - - 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->motion.x, &e->motion.y); - - if (!find_cell (eti, e->motion.x, e->motion.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->motion.x = x1; - e->motion.y = y1; - - e_cell_event (ecell_view, e, ecol->col_idx, col, row); - } - break; - } - - case GDK_KEY_PRESS: - if (eti->focused_col == -1) - return FALSE; - - switch (e->key.keyval){ - case GDK_Left: - if (!eti->mode_spreadsheet && eti_editing (eti)) - break; - - if (eti->focused_col > 0) - eti_cursor_move_left (eti); - break; - - case GDK_Right: - if (!eti->mode_spreadsheet && eti_editing (eti)) - break; - - if (eti->focused_col < eti->cols - 1) - eti_cursor_move_right (eti); - break; - - case GDK_Up: - if (eti->focused_row > 0) - eti_cursor_move_up (eti); - else - return_val = FALSE; - break; - - case GDK_Down: - if ((eti->focused_row + 1) < eti->rows) - eti_cursor_move_down (eti); - else - return_val = FALSE; - break; - - case GDK_Tab: - case GDK_KP_Tab: - case GDK_ISO_Left_Tab: - if ((e->key.state & GDK_SHIFT_MASK) != 0){ - /* shift tab */ - if (eti->focused_col > 0) - eti_cursor_move_left (eti); - else if (eti->focused_row > 0) - eti_cursor_move(eti, eti->focused_row - 1, eti->cols - 1); - else - return_val = FALSE; - } else { - if (eti->focused_col < eti->cols - 1) - eti_cursor_move_right (eti); - else if (eti->focused_row < eti->rows - 1) - eti_cursor_move(eti, eti->focused_row + 1, 0); - else - return_val = FALSE; - } - break; - - default: - if (!eti_editing (eti)){ - if ((e->key.state & (GDK_MOD1_MASK | GDK_CONTROL_MASK)) != 0) - return_val = FALSE; - - if (!(e->key.keyval >= 0x20 && e->key.keyval <= 0xff)) - return_val = FALSE; - } - - 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; - - case GDK_FOCUS_CHANGE: - if (e->focus_change.in) { - } else { - e_table_item_leave_edit (eti); - e_table_item_unfocus (eti); - } - - default: - return_val = FALSE; - } - return return_val; -} - -/* - * 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; - object_class->get_arg = eti_get_arg; - - item_class->update = eti_update; - item_class->realize = eti_realize; - item_class->unrealize = eti_unrealize; - item_class->draw = eti_draw; - item_class->point = eti_point; - item_class->event = eti_event; - item_class->bounds = eti_bounds; - - eti_class->row_selection = eti_row_selection; - - gtk_object_add_arg_type ("ETableItem::ETableHeader", GTK_TYPE_POINTER, - GTK_ARG_WRITABLE, ARG_TABLE_HEADER); - gtk_object_add_arg_type ("ETableItem::ETableModel", GTK_TYPE_POINTER, - GTK_ARG_WRITABLE, ARG_TABLE_MODEL); - gtk_object_add_arg_type ("ETableItem::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); - - gtk_object_add_arg_type ("ETableItem::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("ETableItem::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("ETableItem::has_focus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - - eti_signals [ROW_SELECTION] = - gtk_signal_new ("row_selection", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, row_selection), - gtk_marshal_NONE__INT_INT, - GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT); - - eti_signals [RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETableItemClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, eti_signals, LAST_SIGNAL); - -} - -GtkType -e_table_item_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETableItem", - sizeof (ETableItem), - sizeof (ETableItemClass), - (GtkClassInitFunc) eti_class_init, - (GtkObjectInitFunc) eti_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_OBJECT_TYPE, &info); - } - - return type; -} - -void -e_table_item_focus (ETableItem *eti, int col, int row) -{ - g_return_if_fail (eti != NULL); - g_return_if_fail (E_IS_TABLE_ITEM (eti)); - - /* - * make sure we have the Gtk Focus - */ - gnome_canvas_item_grab_focus (GNOME_CANVAS_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); -} - -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; -} - -gint -e_table_item_get_focused_column (ETableItem *eti) -{ - g_return_val_if_fail (eti != NULL, -1); - g_return_val_if_fail (E_IS_TABLE_ITEM (eti), -1); - - return eti->focused_col; -} - - -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 635dc76922..0000000000 --- a/widgets/table/e-table-item.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef _E_TABLE_ITEM_H_ -#define _E_TABLE_ITEM_H_ - -#include -#include "e-table-model.h" -#include "e-table-header.h" - -#define E_TABLE_ITEM_TYPE (e_table_item_get_type ()) -#define E_TABLE_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem)) -#define E_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ITEM_TYPE, ETableItemClass)) -#define E_IS_TABLE_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_ITEM_TYPE)) -#define E_IS_TABLE_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ITEM_TYPE)) - -typedef struct { - GnomeCanvasItem parent; - ETableModel *table_model; - ETableHeader *header; - - int x1, y1; - int width, height; - - int cols, rows; - - /* - * Ids for the signals we connect to - */ - int header_dim_change_id; - int header_structure_change_id; - int table_model_change_id; - int table_model_row_change_id; - - GdkGC *fill_gc; - GdkGC *grid_gc; - GdkGC *focus_gc; - GdkBitmap *stipple; - - unsigned int draw_grid:1; - unsigned int draw_focus:1; - unsigned int mode_spreadsheet:1; - unsigned int renderers_can_change_size:1; - unsigned int cell_views_realized:1; - - int focused_col, focused_row; - - /* - * Realized views, per column - */ - ECellView **cell_views; - int n_cells; - - /* - * Lengh Threshold: above this, we stop computing correctly - * the size - */ - int length_threshold; - - GSList *selection; - GtkSelectionMode selection_mode; - - /* - * During edition - */ - int editing_col, editing_row; - void *edit_ctx; -} ETableItem; - -typedef struct { - GnomeCanvasItemClass parent_class; - - void (*row_selection) (ETableItem *eti, int row, gboolean selected); - void (*resize) (ETableItem *eti); -} ETableItemClass; - -GtkType e_table_item_get_type (void); - -/* - * Focus - */ -void e_table_item_focus (ETableItem *eti, int col, int row); -void e_table_item_unfocus (ETableItem *eti); - -gint e_table_item_get_focused_column (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 ef14b98018..0000000000 --- a/widgets/table/e-table-model.c +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-model.c: a Table Model - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc. - */ -#include -#include -#include "e-table-model.h" - -#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE gtk_object_get_type(); - - -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); -} - -void * -e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value) -{ - g_return_val_if_fail (e_table_model != NULL, NULL); - g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), NULL); - - if (ETM_CLASS (e_table_model)->duplicate_value) - return ETM_CLASS (e_table_model)->duplicate_value (e_table_model, col, value); - else - return NULL; -} - -void -e_table_model_free_value (ETableModel *e_table_model, int col, void *value) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - if (ETM_CLASS (e_table_model)->free_value) - ETM_CLASS (e_table_model)->free_value (e_table_model, col, value); -} - -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); -} - - -guint -e_table_model_get_type (void) -{ - static guint type = 0; - - if (!type) - { - GtkTypeInfo info = - { - "ETableModle", - sizeof (ETableModel), - sizeof (ETableModelClass), - (GtkClassInitFunc) e_table_model_class_init, - NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (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); -} - -void -e_table_model_freeze (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = TRUE; - return ETM_CLASS (e_table_model)->thaw (e_table_model); -} - -void -e_table_model_thaw (ETableModel *e_table_model) -{ - g_return_if_fail (e_table_model != NULL); - g_return_if_fail (E_IS_TABLE_MODEL (e_table_model)); - - e_table_model->frozen = FALSE; - if (ETM_CLASS(e_table_model)->thaw) - ETM_CLASS (e_table_model)->thaw (e_table_model); -} diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h deleted file mode 100644 index ceca8e348f..0000000000 --- a/widgets/table/e-table-model.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_MODEL_H_ -#define _E_TABLE_MODEL_H_ - -#include - -#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; - - guint frozen : 1; -} 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); - - void *(*duplicate_value) (ETableModel *etm, int col, const void *value); - void (*free_value) (ETableModel *etm, int col, void *value); - - void (*thaw) (ETableModel *etm); - /* - * 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 *value); -gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row); - -void *e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value); -void e_table_model_free_value (ETableModel *e_table_model, int col, void *value); - -void e_table_model_freeze (ETableModel *e_table_model); -void e_table_model_thaw (ETableModel *e_table_model); - -/* - * 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 -#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 - -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 e90abfcc4f..0000000000 --- a/widgets/table/e-table-simple.c +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#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 * -simple_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETableSimple *simple = (ETableSimple *)etm; - - return simple->duplicate_value (etm, col, value, simple->data); -} - -static void -simple_free_value (ETableModel *etm, int col, void *value) -{ - ETableSimple *simple = (ETableSimple *)etm; - - simple->free_value (etm, col, value, simple->data); -} - -static void -simple_thaw (ETableModel *etm) -{ - ETableSimple *simple = (ETableSimple *)etm; - - simple->thaw (etm, 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; - model_class->duplicate_value = simple_duplicate_value; - model_class->free_value = simple_free_value; - model_class->thaw = simple_thaw; -} - -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, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleThawFn thaw, - 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; - et->thaw = thaw; - et->duplicate_value = duplicate_value; - et->free_value = free_value; - et->data = data; - - return (ETableModel *) et; -} diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h deleted file mode 100644 index 51134f45aa..0000000000 --- a/widgets/table/e-table-simple.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#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 void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, const void *val, void *data); -typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data); -typedef void (*ETableSimpleThawFn) (ETableModel *etm, void *data); - -typedef struct { - ETableModel parent; - - ETableSimpleColumnCountFn col_count; - ETableSimpleRowCountFn row_count; - ETableSimpleValueAtFn value_at; - ETableSimpleSetValueAtFn set_value_at; - ETableSimpleIsCellEditableFn is_cell_editable; - ETableSimpleDuplicateValueFn duplicate_value; - ETableSimpleFreeValueFn free_value; - ETableSimpleThawFn thaw; - 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, - ETableSimpleDuplicateValueFn duplicate_value, - ETableSimpleFreeValueFn free_value, - ETableSimpleThawFn thaw, - void *data); - -#endif /* _E_TABLE_SIMPLE_H_ */ - diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c deleted file mode 100644 index 478038fdb7..0000000000 --- a/widgets/table/e-table-sorted-variable.c +++ /dev/null @@ -1,148 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table-sorted.c: Implements a table that sorts another table - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc. - */ -#include -#include -#include -#include -#include "e-util/e-util.h" -#include "e-table-sorted-variable.h" - -#define PARENT_TYPE E_TABLE_SUBSET_VARIABLE_TYPE - -#define INCREMENT_AMOUNT 10 - -static ETableSubsetVariableClass *etsv_parent_class; - -static void etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv); -static void etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv); -static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedVariable *etsv); -static void etsv_add (ETableSubsetVariable *etssv, gint row); - -static void -etsv_destroy (GtkObject *object) -{ - ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object); - ETableSubset *etss = E_TABLE_SUBSET (object); - - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_cell_changed_id); - - etsv->table_model_changed_id = 0; - etsv->table_model_row_changed_id = 0; - etsv->table_model_cell_changed_id = 0; - - GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); -} - -static void -etsv_class_init (GtkObjectClass *object_class) -{ - ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - - etsv_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = etsv_destroy; - - etssv_class->add = etsv_add; -} - -E_MAKE_TYPE(e_table_sorted_variable, "ETableSortedVariable", ETableSortedVariable, etsv_class_init, NULL, PARENT_TYPE); - -static void -etsv_add (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE(etssv); - int i; - int col = etsv->sort_col; - GCompareFunc comp = etsv->compare; - gint ascending = etsv->ascending; - - void *val = e_table_model_value_at(etss->source, col, row); - - /* FIXME: binary search anyone? */ - for ( i = 0; i < etss->n_map; i++ ) { - int comp_val = (*comp)(val, e_table_model_value_at(etss->source, col, etss->map_table[i])); - if ( (ascending && comp_val < 0) || ((!ascending) && comp_val > 0) ) - break; - } - if ( etss->n_map + 1 > etssv->n_vals_allocated ) { - etss->map_table = g_realloc(etss->map_table, (etssv->n_vals_allocated + INCREMENT_AMOUNT) * sizeof(int)); - etssv->n_vals_allocated += INCREMENT_AMOUNT; - } - if ( i < etss->n_map ) - memmove(etss->map_table + i + 1, etss->map_table + i, (etss->n_map - i) * sizeof(int)); - etss->map_table[i] = row; - etss->n_map++; - if ( !etm->frozen ) - e_table_model_changed(etm); -} - -ETableModel * -e_table_sorted_variable_new (ETableModel *source, int col, int ascending, GCompareFunc compare) -{ - ETableSortedVariable *etsv = gtk_type_new (E_TABLE_SORTED_VARIABLE_TYPE); - ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE (etsv); - - if (e_table_subset_variable_construct (etssv, source) == NULL){ - gtk_object_destroy (GTK_OBJECT (etsv)); - return NULL; - } - - etsv->sort_col = col; - etsv->ascending = ascending; - etsv->compare = compare; - - etsv->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_changed), etsv); - etsv->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_row_changed), etsv); - etsv->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_cell_changed), etsv); - - return E_TABLE_MODEL(etsv); -} - -static void -etsv_proxy_model_changed (ETableModel *etm, ETableSortedVariable *etsv) -{ - if ( !E_TABLE_MODEL(etsv)->frozen ) { - /* FIXME: do_resort(); */ - } -} - -static void -etsv_proxy_model_row_changed (ETableModel *etm, int row, ETableSortedVariable *etsv) -{ - ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if ( !E_TABLE_MODEL(etsv)->frozen ) { - if(e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add(etssv, row); - } -} - -static void -etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETableSortedVariable *etsv) -{ - ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE(etsv); - if ( !E_TABLE_MODEL(etsv)->frozen ) { - if ( col == etsv->sort_col ) { - if(e_table_subset_variable_remove(etssv, row)) - e_table_subset_variable_add(etssv, row); - } - } -} - diff --git a/widgets/table/e-table-sorted-variable.h b/widgets/table/e-table-sorted-variable.h deleted file mode 100644 index cf188acd4a..0000000000 --- a/widgets/table/e-table-sorted-variable.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SORTED_VARIABLE_H_ -#define _E_TABLE_SORTED_VARIABLE_H_ - -#include -#include "e-table-model.h" -#include "e-table-subset-variable.h" - -#define E_TABLE_SORTED_VARIABLE_TYPE (e_table_sorted_variable_get_type ()) -#define E_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariable)) -#define E_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) -#define E_IS_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTED_VARIABLE_TYPE)) -#define E_IS_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_VARIABLE_TYPE)) - -typedef struct { - ETableSubsetVariable base; - - short sort_col; - int ascending; - GCompareFunc compare; - - int table_model_changed_id; - int table_model_row_changed_id; - int table_model_cell_changed_id; -} ETableSortedVariable; - -typedef struct { - ETableSubsetVariableClass parent_class; -} ETableSortedVariableClass; - -GtkType e_table_sorted_variable_get_type (void); -ETableModel *e_table_sorted_variable_new (ETableModel *etm, int col, int ascending, GCompareFunc compare); - -#endif /* _E_TABLE_SORTED_VARIABLE_H_ */ diff --git a/widgets/table/e-table-sorted.c b/widgets/table/e-table-sorted.c deleted file mode 100644 index c754f4cff7..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 -#include -#include "e-util/e-util.h" -#include "e-table-sorted.h" - -#define PARENT_TYPE E_TABLE_SUBSET_TYPE - -static ETableSubsetClass *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 92bd8d1522..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 -#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 { - ETableSubsetClass 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-variable.c b/widgets/table/e-table-subset-variable.c deleted file mode 100644 index 5a3e0f2ddf..0000000000 --- a/widgets/table/e-table-subset-variable.c +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include -#include "e-util/e-util.h" -#include "e-table-subset-variable.h" - -#define ETSSV_CLASS(e) ((ETableSubsetVariableClass *)((GtkObject *)e)->klass) - -#define PARENT_TYPE E_TABLE_SUBSET_TYPE - -#define INCREMENT_AMOUNT 10 - -static ETableSubsetClass *etssv_parent_class; - -static void -etssv_add (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - - if ( etss->n_map + 1 > etssv->n_vals_allocated ) { - etss->map_table = g_realloc(etss->map_table, (etssv->n_vals_allocated + INCREMENT_AMOUNT) * sizeof(int)); - etssv->n_vals_allocated += INCREMENT_AMOUNT; - } - etss->map_table[etss->n_map++] = row; - if ( !etm->frozen ) - e_table_model_changed(etm); -} - -static gboolean -etssv_remove (ETableSubsetVariable *etssv, - gint row) -{ - ETableModel *etm = E_TABLE_MODEL(etssv); - ETableSubset *etss = E_TABLE_SUBSET(etssv); - int i; - - for ( i = 0; i < etss->n_map; i++ ) { - if (etss->map_table[i] == row) { - memmove(etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int)); - etss->n_map --; - if ( !etm->frozen ) - e_table_model_changed(etm); - return TRUE; - } - } - return FALSE; -} - -static void -etssv_class_init (GtkObjectClass *object_class) -{ - ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - etssv_parent_class = gtk_type_class (PARENT_TYPE); - - klass->add = etssv_add; - klass->remove = etssv_remove; -} - -E_MAKE_TYPE(e_table_subset_variable, "ETableSubsetVariable", ETableSubsetVariable, etssv_class_init, NULL, PARENT_TYPE); - -ETableModel * -e_table_subset_variable_construct (ETableSubsetVariable *etssv, - ETableModel *source) -{ - if ( e_table_subset_construct(E_TABLE_SUBSET(etssv), source, 1) == NULL ) - return NULL; - E_TABLE_SUBSET(etssv)->n_map = 0; - - return E_TABLE_MODEL (etssv); -} - -ETableModel * -e_table_subset_variable_new (ETableModel *source) -{ - ETableSubsetVariable *etssv = gtk_type_new (E_TABLE_SUBSET_VARIABLE_TYPE); - - if (e_table_subset_variable_construct (etssv, source) == NULL){ - gtk_object_destroy (GTK_OBJECT (etssv)); - return NULL; - } - - return (ETableModel *) etssv; -} - -void -e_table_subset_variable_add (ETableSubsetVariable *etssv, - gint row) -{ - g_return_if_fail (etssv != NULL); - g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv)); - - if (ETSSV_CLASS(etssv)->add) - ETSSV_CLASS (etssv)->add (etssv, row); -} - -gboolean -e_table_subset_variable_remove (ETableSubsetVariable *etssv, - gint row) -{ - g_return_val_if_fail (etssv != NULL, FALSE); - g_return_val_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv), FALSE); - - if (ETSSV_CLASS(etssv)->remove) - return ETSSV_CLASS (etssv)->remove (etssv, row); - else - return FALSE; -} - -void -e_table_subset_variable_increment (ETableSubsetVariable *etssv, - gint position, - gint amount) -{ - int i; - ETableSubset *etss = E_TABLE_SUBSET(etssv); - for ( i = 0; i < etss->n_map; i++ ) { - if ( etss->map_table[i] > position ) - etss->map_table[i] += amount; - } -} - -void -e_table_subset_variable_set_allocation (ETableSubsetVariable *etssv, - gint total) -{ - ETableSubset *etss = E_TABLE_SUBSET(etssv); - if ( total <= 0 ) - total = 1; - if ( total > etss->n_map ) { - etss->map_table = g_realloc(etss->map_table, total * sizeof(int)); - } -} diff --git a/widgets/table/e-table-subset-variable.h b/widgets/table/e-table-subset-variable.h deleted file mode 100644 index 8ac0af0382..0000000000 --- a/widgets/table/e-table-subset-variable.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SUBSET_VARIABLE_H_ -#define _E_TABLE_SUBSET_VARIABLE_H_ - -#include -#include "e-table-subset.h" - -#define E_TABLE_SUBSET_VARIABLE_TYPE (e_table_subset_variable_get_type ()) -#define E_TABLE_SUBSET_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariable)) -#define E_TABLE_SUBSET_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariableClass)) -#define E_IS_TABLE_SUBSET_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SUBSET_VARIABLE_TYPE)) -#define E_IS_TABLE_SUBSET_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_VARIABLE_TYPE)) - -typedef struct { - ETableSubset base; - - int n_vals_allocated; -} ETableSubsetVariable; - -typedef struct { - ETableSubsetClass parent_class; - - void (*add) (ETableSubsetVariable *ets, - gint row); - gboolean (*remove) (ETableSubsetVariable *ets, - gint row); -} ETableSubsetVariableClass; - -GtkType e_table_subset_variable_get_type (void); -ETableModel *e_table_subset_variable_new (ETableModel *etm); -ETableModel *e_table_subset_variable_construct (ETableSubsetVariable *etssv, - ETableModel *source); -void e_table_subset_variable_add (ETableSubsetVariable *ets, - gint row); -gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets, - gint row); -void e_table_subset_variable_increment (ETableSubsetVariable *ets, - gint position, - gint amount); -void e_table_subset_variable_set_allocation (ETableSubsetVariable *ets, - gint total); -#endif /* _E_TABLE_SUBSET_VARIABLE_H_ */ - diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c deleted file mode 100644 index b4473b87ef..0000000000 --- a/widgets/table/e-table-subset.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * 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 -#include -#include -#include "e-util/e-util.h" -#include "e-table-subset.h" - -#define PARENT_TYPE E_TABLE_MODEL_TYPE - -static ETableModelClass *etss_parent_class; - -static void -etss_destroy (GtkObject *object) -{ - ETableSubset *etss = E_TABLE_SUBSET (object); - - if (etss->source) - gtk_object_unref (GTK_OBJECT (etss->source)); - - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_cell_changed_id); - - etss->table_model_changed_id = 0; - etss->table_model_row_changed_id = 0; - etss->table_model_cell_changed_id = 0; - - 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_duplicate_value (ETableModel *etm, int col, const void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - return e_table_model_duplicate_value (etss->source, col, value); -} - -static void -etss_free_value (ETableModel *etm, int col, void *value) -{ - ETableSubset *etss = (ETableSubset *)etm; - - e_table_model_free_value (etss->source, col, value); -} - -static void -etss_thaw (ETableModel *etm) -{ - e_table_model_changed (etm); -} - -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; - table_class->duplicate_value = etss_duplicate_value; - table_class->free_value = etss_free_value; - table_class->thaw = etss_thaw; -} - -E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, NULL, PARENT_TYPE); - -static void -etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss) -{ - if ( !E_TABLE_MODEL(etss)->frozen ) - e_table_model_changed (E_TABLE_MODEL (etss)); -} - -static void -etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss) -{ - if ( !E_TABLE_MODEL(etss)->frozen ) { - 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) -{ - if ( !E_TABLE_MODEL(etss)->frozen ) { - 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 *) g_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; - - etss->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (etss_proxy_model_changed), etss); - etss->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", - GTK_SIGNAL_FUNC (etss_proxy_model_row_changed), etss); - etss->table_model_cell_changed_id = 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 074120a410..0000000000 --- a/widgets/table/e-table-subset.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_SUBSET_H_ -#define _E_TABLE_SUBSET_H_ - -#include -#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; - - int table_model_changed_id; - int table_model_row_changed_id; - int table_model_cell_changed_id; -} 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 e508e24e02..0000000000 --- a/widgets/table/e-table.c +++ /dev/null @@ -1,723 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * E-table.c: A graphical view of a Table. - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright 1999, Helix Code, Inc - */ -#include -#include -#include -#include -#ifdef HAVE_ALLOCA_H -#include -#endif -#include -#include -#include -#include -#include "e-util/e-util.h" -#include "e-util/e-xml-utils.h" -#include "e-table.h" -#include "e-table-header-item.h" -#include "e-table-subset.h" -#include "e-table-item.h" -#include "e-table-group.h" - -#define COLUMN_HEADER_HEIGHT 16 -#define TITLE_HEIGHT 16 -#define GROUP_INDENT 10 - -#define PARENT_TYPE gtk_table_get_type () - -static GtkObjectClass *e_table_parent_class; - -static void e_table_fill_table (ETable *e_table, ETableModel *model); - -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)); - gtk_widget_destroy (GTK_WIDGET (et->header_canvas)); - gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); - - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_model_change_id); - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_row_change_id); - gtk_signal_disconnect (GTK_OBJECT (et->model), - et->table_cell_change_id); - - if (et->rebuild_idle_id) { - g_source_remove(et->rebuild_idle_id); - et->rebuild_idle_id = 0; - } - - (*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; - - e_table->need_rebuild = 0; - e_table->need_row_changes = 0; - e_table->row_changes_list = NULL; - e_table->rebuild_idle_id = 0; -} - -static ETableHeader * -e_table_make_header (ETable *e_table, ETableHeader *full_header, xmlNode *xmlColumns) -{ - ETableHeader *nh; - xmlNode *column; - const int max_cols = e_table_header_count (full_header); - - nh = e_table_header_new (); - for (column = xmlColumns->childs; column; column = column->next) { - int col = atoi (column->childs->content); - - 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); - -} - -#if 0 -typedef struct { - void *value; - GArray *array; -} group_key_t; - -static GArray * -e_table_create_groups (ETableModel *etm, int key_col, GCompareFunc comp) -{ - GArray *groups; - const int rows = e_table_model_row_count (etm); - int row, i; - - groups = g_array_new (FALSE, FALSE, sizeof (group_key_t)); - - for (row = 0; row < rows; row++){ - void *val = e_table_model_value_at (etm, key_col, row); - const int n_groups = groups->len; - - /* - * Should replace this with a bsearch later - */ - for (i = 0; i < n_groups; i++){ - group_key_t *g = &g_array_index (groups, group_key_t, i); - - if ((*comp) (g->value, val)){ - g_array_append_val (g->array, row); - break; - } - } - if (i != n_groups) - continue; - - /* - * We need to create a new group - */ - { - group_key_t gk; - - gk.value = val; - gk.array = g_array_new (FALSE, FALSE, sizeof (int)); - - g_array_append_val (gk.array, row); - g_array_append_val (groups, gk); - } - } - - return groups; -} - -static void -e_table_destroy_groups (GArray *groups) -{ - const int n = groups->len; - int i; - - for (i = 0; i < n; i++){ - group_key_t *g = &g_array_index (groups, group_key_t, i); - - g_array_free (g->array, TRUE); - } - g_array_free (groups, TRUE); -} - -static ETableModel ** -e_table_make_subtables (ETableModel *model, GArray *groups) -{ - const int n_groups = groups->len; - ETableModel **tables; - int i; - - tables = g_new (ETableModel *, n_groups+1); - - for (i = 0; i < n_groups; i++){ - group_key_t *g = &g_array_index (groups, group_key_t, i); - const int sub_size = g->array->len; - ETableSubset *ss; - int j; - - tables [i] = e_table_subset_new (model, sub_size); - ss = E_TABLE_SUBSET (tables [i]); - - for (j = 0; j < sub_size; j++) - ss->map_table [j] = g_array_index (g->array, int, j); - } - tables [i] = NULL; - - return (ETableModel **) tables; -} -#endif -typedef struct _Node Node; - -struct _Node { - Node *parent; - GnomeCanvasItem *item; - ETableModel *table_model; - GSList *children; - - guint is_leaf:1; -}; -#if 0 -static Node * -leaf_new (GnomeCanvasItem *table_item, ETableModel *table_model, Node *parent) -{ - Node *node = g_new (Node, 1); - - g_assert (table_item != NULL); - g_assert (table_model != NULL); - g_assert (parent != NULL); - - node->item = table_item; - node->parent = parent; - node->table_model = table_model; - node->is_leaf = 1; - - g_assert (!parent->is_leaf); - - parent->children = g_slist_append (parent->children, node); - - e_table_group_add (E_TABLE_GROUP (parent->item), table_item); - - return node; -} - -static Node * -node_new (GnomeCanvasItem *group_item, ETableModel *table_model, Node *parent) -{ - Node *node = g_new (Node, 1); - - g_assert (table_model != NULL); - - node->children = NULL; - node->item = group_item; - node->parent = parent; - node->table_model = table_model; - node->is_leaf = 0; - - if (parent){ - parent->children = g_slist_append (parent->children, node); - - e_table_group_add (E_TABLE_GROUP (parent->item), group_item); - } - - return node; -} - -static Node * -e_table_create_leaf (ETable *e_table, ETableModel *etm, Node *parent) -{ - GnomeCanvasItem *table_item; - Node *leaf; - - table_item = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (parent->item), - e_table_item_get_type (), - "ETableHeader", e_table->header, - "ETableModel", etm, - "drawgrid", e_table->draw_grid, - "drawfocus", e_table->draw_focus, - "spreadsheet", e_table->spreadsheet, - NULL); - - leaf = leaf_new (table_item, etm, parent); - - return leaf; -} - -static int -leaf_height (Node *leaf) -{ - const GnomeCanvasItem *item = leaf->item; - - return item->y2 - item->y1; -} - -static int -leaf_event (GnomeCanvasItem *item, GdkEvent *event) -{ - static int last_x = -1; - static int last_y = -1; - - if (event->type == GDK_BUTTON_PRESS){ - last_x = event->button.x; - last_y = event->button.y; - } else if (event->type == GDK_BUTTON_RELEASE){ - last_x = -1; - last_y = -1; - } else if (event->type == GDK_MOTION_NOTIFY){ - if (last_x == -1) - return FALSE; - - gnome_canvas_item_move (item, event->motion.x - last_x, event->motion.y - last_y); - last_x = event->motion.x; - last_y = event->motion.y; - } else - return FALSE; - return TRUE; -} - -static Node * -e_table_create_nodes (ETable *e_table, ETableModel *model, ETableHeader *header, - GnomeCanvasGroup *root, Node *parent, int *groups_list) -{ - GArray *groups; - ETableModel **tables; - ETableCol *ecol; - int key_col, i; - GnomeCanvasItem *group_item; - Node *group; - - key_col = *groups_list; - g_assert (key_col != -1); - - /* - * Create groups - */ - ecol = e_table_header_get_column (header, key_col); - - g_assert (ecol != NULL); - - groups = e_table_create_groups (model, key_col, ecol->compare); - tables = e_table_make_subtables (e_table->model, groups); - e_table_destroy_groups (groups); - group_item = gnome_canvas_item_new (root, - e_table_group_get_type(), - "columns", ecol, TRUE, parent == NULL); - group = node_new (group_item, model, parent); - - for (i = 0; tables [i] != NULL; i++){ - /* - * Leafs - */ - if (groups_list [1] == -1){ - GnomeCanvasItem *item_leaf_header; - Node *leaf_header; - - /* FIXME *//* - item_leaf_header = e_table_group_new ( - GNOME_CANVAS_GROUP (group_item), ecol, TRUE, FALSE);*/ - leaf_header = node_new (item_leaf_header, tables [i], group); - - e_table_create_leaf (e_table, tables [i], leaf_header); - } else { - e_table_create_nodes ( - e_table, tables [i], header, GNOME_CANVAS_GROUP (group_item), - group, &groups_list [1]); - } - } - - return group; -} - -static int * -group_spec_to_desc (const char *group_spec) -{ - int a_size = 10; - int *elements; - char *p, *copy, *follow; - int n_elements = 0; - - if (group_spec == NULL) - return NULL; - - elements = g_new (int, a_size); - copy = alloca (strlen (group_spec) + 1); - strcpy (copy, group_spec); - - while ((p = strtok_r (copy, ",", &follow)) != NULL){ - elements [n_elements] = atoi (p); - ++n_elements; - if (n_elements+1 == a_size){ - int *new_e; - - n_elements += 10; - new_e = g_renew (int, elements, n_elements); - if (new_e == NULL){ - g_free (elements); - return NULL; - } - elements = new_e; - } - copy = NULL; - } - - /* Tag end */ - elements [n_elements] = -1; - - return elements; -} - -/* - * The ETableCanvas object is just used to enable us to - * hook up to the realize/unrealize phases of the canvas - * initialization (as laying out the subtables requires us to - * know the actual size of the subtables we are inserting - */ - -#define E_TABLE_CANVAS_PARENT_TYPE gnome_canvas_get_type () - -typedef struct { - GnomeCanvas base; - - ETable *e_table; -} ETableCanvas; - -typedef struct { - GnomeCanvasClass base_class; -} ETableCanvasClass; - -static GnomeCanvasClass *e_table_canvas_parent_class; - -static void -e_table_canvas_realize (GtkWidget *widget) -{ -#if 0 - GnomeCanvasItem *group_item; - - group_item = gnome_canvas_item_new (root, - e_table_group_get_type(), - "header", E_TABLE, TRUE, parent == NULL); - - - ETableCanvas *e_table_canvas = (ETableCanvas *) widget; - ETable *e_table = e_table_canvas->e_table; - int *groups; - Node *leaf; - - GTK_WIDGET_CLASS (e_table_canvas_parent_class)->realize (widget); - - groups = group_spec_to_desc (e_table->group_spec); - - - - leaf = e_table_create_nodes ( - e_table, e_table->model, - e_table->header, GNOME_CANVAS_GROUP (e_table->root), 0, groups); - - - if (groups) - g_free (groups); -#endif -} - -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)); - - GTK_WIDGET_CLASS (e_table_canvas_parent_class)->unrealize (widget); -} - -static void -e_table_canvas_class_init (GtkObjectClass *object_class) -{ - GtkWidgetClass *widget_class = (GtkWidgetClass *) object_class; - - widget_class->realize = e_table_canvas_realize; - widget_class->unrealize = e_table_canvas_unrealize; - - e_table_canvas_parent_class = gtk_type_class (E_TABLE_CANVAS_PARENT_TYPE); -} - -static void -e_table_canvas_init (GtkObject *canvas) -{ - ETableCanvas *e_table_canvas = (ETableCanvas *) (canvas); - ETable *e_table = e_table_canvas->e_table; - - GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS); - -} - -GtkType e_table_canvas_get_type (void); - -E_MAKE_TYPE (e_table_canvas, "ETableCanvas", ETableCanvas, e_table_canvas_class_init, - e_table_canvas_init, E_TABLE_CANVAS_PARENT_TYPE); - -static GnomeCanvas * -e_table_canvas_new (ETable *e_table) -{ - ETableCanvas *e_table_canvas; - - e_table_canvas = gtk_type_new (e_table_canvas_get_type ()); - e_table_canvas->e_table = e_table; - - e_table->root = gnome_canvas_item_new ( - GNOME_CANVAS_GROUP (GNOME_CANVAS (e_table_canvas)->root), - gnome_canvas_group_get_type (), - "x", 0.0, - "y", 0.0, - NULL); - - return GNOME_CANVAS (e_table_canvas); -} -#endif - -static void -table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table) -{ - gdouble height; - gdouble width; - gtk_object_get(GTK_OBJECT(e_table->group), - "height", &height, - NULL); - gnome_canvas_set_scroll_region ( - GNOME_CANVAS (e_table->table_canvas), - 0, 0, alloc->width, MAX(height, alloc->height)); - width = alloc->width; - gtk_object_set(GTK_OBJECT(e_table->group), - "width", width, - NULL); -} - -static void -change_row (gpointer key, gpointer value, gpointer data) -{ - ETable *et = E_TABLE(data); - gint row = GPOINTER_TO_INT(key); - if ( e_table_group_remove(et->group, row) ) { - e_table_group_add(et->group, row); - } -} - -static gboolean -changed_idle (gpointer data) -{ - ETable *et = E_TABLE(data); - if ( et->need_rebuild ) { - gtk_object_destroy( GTK_OBJECT(et->group ) ); - et->group = e_table_group_new(GNOME_CANVAS_GROUP(et->table_canvas->root), - et->full_header, - et->header, - et->model, - e_xml_get_child_by_name(xmlDocGetRootElement(et->specification), "grouping")->childs); - e_table_fill_table(et, et->model); - } else if (et->need_row_changes) { - g_hash_table_foreach(et->row_changes_list, change_row, et); - } - et->need_rebuild = 0; - et->need_row_changes = 0; - if (et->row_changes_list) - g_hash_table_destroy(et->row_changes_list); - et->row_changes_list = NULL; - et->rebuild_idle_id = 0; - return FALSE; -} - -static void -et_table_model_changed (ETableModel *model, ETable *et) -{ - et->need_rebuild = TRUE; - if ( !et->rebuild_idle_id ) { - et->rebuild_idle_id = g_idle_add(changed_idle, et); - } -} - -static void -et_table_row_changed (ETableModel *table_model, int row, ETable *et) -{ - if ( !et->need_rebuild ) { - if (!et->need_row_changes) { - et->need_row_changes = 1; - et->row_changes_list = g_hash_table_new (g_direct_hash, g_direct_equal); - } - if (!g_hash_table_lookup(et->row_changes_list, GINT_TO_POINTER(row))) { - g_hash_table_insert(et->row_changes_list, GINT_TO_POINTER(row), GINT_TO_POINTER(row + 1)); - } - } - if ( !et->rebuild_idle_id ) { - et->rebuild_idle_id = g_idle_add(changed_idle, et); - } -} - -static void -et_table_cell_changed (ETableModel *table_model, int view_col, int row, ETable *et) -{ - et_table_row_changed(table_model, row, et); -} - -static void -e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header, ETableModel *model, xmlNode *xml_grouping) -{ - e_table->table_canvas = GNOME_CANVAS(gnome_canvas_new ()); - gtk_signal_connect ( - GTK_OBJECT (e_table->table_canvas), "size_allocate", - GTK_SIGNAL_FUNC (table_canvas_size_allocate), 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); - - e_table->group = e_table_group_new(GNOME_CANVAS_GROUP(e_table->table_canvas->root), - full_header, - header, - model, - xml_grouping->childs); - - e_table->table_model_change_id = gtk_signal_connect ( - GTK_OBJECT (model), "model_changed", - GTK_SIGNAL_FUNC (et_table_model_changed), e_table); - - e_table->table_row_change_id = gtk_signal_connect ( - GTK_OBJECT (model), "model_row_changed", - GTK_SIGNAL_FUNC (et_table_row_changed), e_table); - - e_table->table_cell_change_id = gtk_signal_connect ( - GTK_OBJECT (model), "model_cell_changed", - GTK_SIGNAL_FUNC (et_table_cell_changed), e_table); -} - -static void -e_table_fill_table (ETable *e_table, ETableModel *model) -{ - int count; - int i; - count = e_table_model_row_count(model); - gtk_object_set(GTK_OBJECT(e_table->group), - "frozen", TRUE, - NULL); - for ( i = 0; i < count; i++ ) { - e_table_group_add(e_table->group, i); - } - gtk_object_set(GTK_OBJECT(e_table->group), - "frozen", FALSE, - NULL); -} - -void -e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, - const char *spec) -{ - xmlDoc *xmlSpec; - xmlNode *xmlRoot; - xmlNode *xmlColumns; - xmlNode *xmlGrouping; - - char *copy; - copy = g_strdup(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)); - - xmlSpec = xmlParseMemory(copy, strlen(copy) + 1); - e_table->specification = xmlSpec; - - xmlRoot = xmlDocGetRootElement(xmlSpec); - xmlColumns = e_xml_get_child_by_name(xmlRoot, "columns-shown"); - xmlGrouping = e_xml_get_child_by_name(xmlRoot, "grouping"); - - e_table->header = e_table_make_header (e_table, full_header, xmlColumns); - - e_table_setup_header (e_table); - e_table_setup_table (e_table, full_header, e_table->header, etm, xmlGrouping); - e_table_fill_table (e_table, etm); -} - -GtkWidget * -e_table_new (ETableHeader *full_header, ETableModel *etm, const char *spec) -{ - ETable *e_table; - - e_table = gtk_type_new (e_table_get_type ()); - - e_table_construct (e_table, full_header, etm, 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 841013c09a..0000000000 --- a/widgets/table/e-table.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TABLE_H_ -#define _E_TABLE_H_ - -#include -#include -#include -#include "e-table-model.h" -#include "e-table-header.h" -#include "e-table-group.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; - - ETableGroup *group; - - int table_model_change_id; - int table_row_change_id; - int table_cell_change_id; - - GnomeCanvas *header_canvas, *table_canvas; - - GnomeCanvasItem *header_item, *root; - - xmlDoc *specification; - - guint draw_grid:1; - guint draw_focus:1; - guint spreadsheet:1; - - guint need_rebuild:1; - guint need_row_changes:1; - - GHashTable *row_changes_list; - gint rebuild_idle_id; -} 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 *spec); -GtkWidget *e_table_new (ETableHeader *full_header, ETableModel *etm, - const char *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 Binary files a/widgets/table/image1.png and /dev/null differ diff --git a/widgets/table/image2.png b/widgets/table/image2.png deleted file mode 100644 index e6a4c75dbe..0000000000 Binary files a/widgets/table/image2.png and /dev/null differ diff --git a/widgets/table/image3.png b/widgets/table/image3.png deleted file mode 100644 index 50e16e8620..0000000000 Binary files a/widgets/table/image3.png and /dev/null 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 62160e7035..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 -#include -#include -#include -#include -#include "e-util/e-cursors.h" -#include "table-test.h" - -int -main (int argc, char *argv []) -{ - - if (isatty (0)){ - int fd; - - close (0); - fd = open ("sample.table", O_RDONLY); - if (fd == -1){ - fprintf (stderr, "Could not find sample.table, try feeding a table on stdin"); - exit (1); - } - dup2 (fd, 0); - } - - gnome_init ("TableTest", "TableTest", argc, argv); - e_cursors_init (); - - - table_browser_test (); - multi_cols_test (); - check_test (); - - e_table_test (); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} diff --git a/widgets/table/table-test.h b/widgets/table/table-test.h deleted file mode 100644 index ad8cfcc083..0000000000 --- a/widgets/table/table-test.h +++ /dev/null @@ -1,4 +0,0 @@ -void table_browser_test (void); -void multi_cols_test (void); -void check_test (void); -void e_table_test (void); diff --git a/widgets/table/test-check.c b/widgets/table/test-check.c deleted file mode 100644 index 7894898255..0000000000 --- a/widgets/table/test-check.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include -#include -#include -#include -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-util/e-cursors.h" -#include "e-util/e-canvas-utils.h" -#include "e-util/e-util.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 * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0){ - return (void *) value; - } else { - return g_strdup(value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0){ - g_free(value); - } -} - -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed(etc); -} - -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; - GdkPixbuf *pixbuf; - GnomeCanvasItem *item; - - 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, - duplicate_value, free_value, thaw, NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - cell_image_check = e_cell_checkbox_new (); - pixbuf = gdk_pixbuf_new_from_file("clip.png"); - col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 18, 18, cell_image_check, g_int_compare, TRUE); - gdk_pixbuf_unref(pixbuf); - 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_compare, TRUE); - e_table_header_add_column (e_table_header, col_1, 1); - e_table_col_set_arrow ( col_1, E_TABLE_COL_ARROW_DOWN ); - - /* - * 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); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); - e_canvas_item_move_absolute(item, 0, 30); -} - diff --git a/widgets/table/test-cols.c b/widgets/table/test-cols.c deleted file mode 100644 index d65b9945b7..0000000000 --- a/widgets/table/test-cols.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include -#include -#include -#include -#include "e-util/e-canvas-utils.h" -#include "e-util/e-cursors.h" -#include "e-util/e-util.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-cell-toggle.h" - -#include "table-test.h" - -#define LINES 4 - -static struct { - int value; - char *string; -} my_table [LINES] = { - { 0, "You are not" }, - { 1, "A beautiful and unique " }, - { 0, "Snowflake" }, - { 2, "You are not your wallet" }, -}; -/* - * ETableSimple callbacks - */ -static int -col_count (ETableModel *etc, void *data) -{ - return 2; -} - -static int -row_count (ETableModel *etc, void *data) -{ - return LINES; -} - -static void * -value_at (ETableModel *etc, int col, int row, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0) - return GINT_TO_POINTER (my_table [row].value); - else - return my_table [row].string; - -} - -static void -set_value_at (ETableModel *etc, int col, int row, const void *val, void *data) -{ - g_assert (col < 2); - g_assert (row < LINES); - - if (col == 0){ - my_table [row].value = GPOINTER_TO_INT (val); - printf ("Value at %d,%d set to %d\n", col, row, GPOINTER_TO_INT (val)); - } else { - my_table [row].string = g_strdup (val); - printf ("Value at %d,%d set to %s\n", col, row, (char *) val); - } -} - -static gboolean -is_cell_editable (ETableModel *etc, int col, int row, void *data) -{ - return TRUE; -} - -static void * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - if (col == 0){ - return (void *)value; - } else { - return g_strdup(value); - } -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - if (col != 0){ - g_free(value); - } -} - -static void -set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc) -{ - gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height); -} - -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed(etc); -} - -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; - GnomeCanvasItem *item; - - 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, - duplicate_value, free_value, - thaw, NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - { - 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_compare, 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_compare, 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); - - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); - - e_canvas_item_move_absolute(item, 0, 30); - - 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); - item = gnome_canvas_item_new ( - gnome_canvas_root (GNOME_CANVAS (canvas)), - e_table_item_get_type (), - "ETableHeader", e_table_header_multiple, - "ETableModel", e_table_model, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); - e_canvas_item_move_absolute(item, 300, 30); -} - - - - - diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c deleted file mode 100644 index 0fdf32fcbe..0000000000 --- a/widgets/table/test-table.c +++ /dev/null @@ -1,331 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Test code for the ETable package - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - */ -#include -#include -#include -#include -#include "e-util/e-cursors.h" -#include "e-table-simple.h" -#include "e-table-header.h" -#include "e-table-header-item.h" -#include "e-table-item.h" -#include "e-cell-text.h" -#include "e-table.h" - -#include "table-test.h" - -char buffer [1024]; -char **column_labels; -char ***table_data; -int cols = 0; -int lines = 0; -int lines_alloc = 0; - -static void -parse_headers () -{ - char *p, *s; - int in_value = 0, i; - - fgets (buffer, sizeof (buffer)-1, stdin); - - for (p = buffer; *p; p++){ - if (*p == ' ' || *p == '\t'){ - if (in_value){ - cols++; - in_value = 0; - } - } else - in_value = 1; - } - if (in_value) - cols++; - - if (!cols){ - fprintf (stderr, "No columns in first row\n"); - exit (1); - } - - column_labels = g_new0 (char *, cols); - - p = buffer; - for (i = 0; (s = strtok (p, " \t")) != NULL; i++){ - column_labels [i] = g_strdup (s); - if ( strchr(column_labels [i], '\n') ) - *strchr(column_labels [i], '\n') = 0; - 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 * -duplicate_value (ETableModel *etc, int col, const void *value, void *data) -{ - return g_strdup(value); -} - -static void -free_value (ETableModel *etc, int col, void *value, void *data) -{ - g_free(value); -} - -static void -thaw (ETableModel *etc, void *data) -{ - e_table_model_changed(etc); -} - -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, - duplicate_value, free_value, thaw, NULL); - - /* - * Header - */ - e_table_header = e_table_header_new (); - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - for (i = 0; i < cols; i++){ - ETableCol *ecol = e_table_col_new ( - i, column_labels [i], - 80, 20, cell_left_just, - g_str_compare, 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, - "drawgrid", TRUE, - "drawfocus", TRUE, - "spreadsheet", TRUE, - NULL); -} - -static void -do_e_table_demo (const char *spec) -{ - GtkWidget *e_table, *window, *frame; - ECell *cell_left_just; - ETableHeader *full_header; - int i; - - /* - * Data model - */ - static ETableModel *e_table_model = NULL; - - if ( e_table_model == NULL ) - e_table_model = - e_table_simple_new (col_count, row_count, value_at, - set_value_at, is_cell_editable, - duplicate_value, free_value, - thaw, NULL); - - full_header = e_table_header_new (); - cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT, TRUE); - - for (i = 0; i < cols; i++){ - ETableCol *ecol = e_table_col_new ( - i, column_labels [i], - 80, 20, cell_left_just, - g_str_compare, TRUE); - - e_table_header_add_column (full_header, ecol, i); - } - - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - frame = gtk_frame_new (NULL); - e_table = e_table_new (full_header, e_table_model, spec); - gtk_container_add (GTK_CONTAINER (frame), e_table); - gtk_container_add (GTK_CONTAINER (window), frame); - - gtk_widget_set_usize (window, 200, 200); - gtk_widget_show (e_table); - gtk_widget_show (frame); - gtk_widget_show (window); -} - -void -e_table_test (void) -{ - load_data (); - - if (1){/*getenv ("DO")){*/ - do_e_table_demo (" 0 1 2 3 4 "); - do_e_table_demo (" 0 0 1 2 3 4 "); - } - do_e_table_demo (" 0 1 2 3 4 "); - do_e_table_demo (" 0 1 2 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 -#include "e-table-simple.h" - -struct { - char *str; - int val; -} data [] = { - { "Miguel", 10 }, - { "Nat", 20 }, - { NULL, 0 }, -}; - -main () -{ - -} - diff --git a/widgets/text/.cvsignore b/widgets/text/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/widgets/text/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/widgets/text/e-text-event-processor-emacs-like.c b/widgets/text/e-text-event-processor-emacs-like.c deleted file mode 100644 index 41bcd0c31d..0000000000 --- a/widgets/text/e-text-event-processor-emacs-like.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-text-event-processor-emacs-like.h" -static void e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *card); -static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass); -static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -static ETextEventProcessorClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0 -}; - -static const ETextEventProcessorCommand control_keys[26] = -{ - { E_TEP_START_OF_LINE, E_TEP_MOVE, 0, "" }, /* a */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_COPY, 0, "" }, /* c */ - { E_TEP_FORWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_END_OF_LINE, E_TEP_MOVE, 0, "" }, /* e */ - { E_TEP_FORWARD_CHARACTER, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_BACKWARD_CHARACTER, E_TEP_DELETE, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_END_OF_LINE, E_TEP_DELETE, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_FORWARD_LINE, E_TEP_MOVE, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_BACKWARD_LINE, E_TEP_MOVE, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_START_OF_LINE, E_TEP_DELETE, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_PASTE, 0, "" }, /* v */ - { E_TEP_BACKWARD_WORD, E_TEP_DELETE, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ -}; - -static const ETextEventProcessorCommand alt_keys[26] = -{ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* a */ - { E_TEP_BACKWARD_WORD, E_TEP_MOVE, 0, "" }, /* b */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* c */ - { E_TEP_FORWARD_WORD, E_TEP_DELETE, 0, "" }, /* d */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* e */ - { E_TEP_FORWARD_WORD, E_TEP_MOVE, 0, "" }, /* f */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* g */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* h */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* i */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* j */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* k */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* l */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* m */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* n */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* o */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* p */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* q */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* r */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* s */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* t */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* u */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* v */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* w */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* x */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" }, /* y */ - { E_TEP_SELECTION, E_TEP_NOP, 0, "" } /* z */ - -}; - -GtkType -e_text_event_processor_emacs_like_get_type (void) -{ - static GtkType text_event_processor_emacs_like_type = 0; - - if (!text_event_processor_emacs_like_type) - { - static const GtkTypeInfo text_event_processor_emacs_like_info = - { - "ETextEventProcessorEmacsLike", - sizeof (ETextEventProcessorEmacsLike), - sizeof (ETextEventProcessorEmacsLikeClass), - (GtkClassInitFunc) e_text_event_processor_emacs_like_class_init, - (GtkObjectInitFunc) e_text_event_processor_emacs_like_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_emacs_like_type = gtk_type_unique (e_text_event_processor_get_type (), &text_event_processor_emacs_like_info); - } - - return text_event_processor_emacs_like_type; -} - -static void -e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass) -{ - GtkObjectClass *object_class; - ETextEventProcessorClass *processor_class; - - object_class = (GtkObjectClass*) klass; - processor_class = (ETextEventProcessorClass*) klass; - - parent_class = gtk_type_class (e_text_event_processor_get_type ()); - - processor_class->event = e_text_event_processor_emacs_like_event; -} - -static void -e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *tep) -{ -} - -static gint -e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - ETextEventProcessorCommand command; - ETextEventProcessorEmacsLike *tep_el = E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(tep); - command.action = E_TEP_NOP; - switch (event->type) { - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - command.action = E_TEP_GRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - if (event->button.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - tep_el->mouse_down = TRUE; - } - break; - case GDK_BUTTON_RELEASE: - if (event->button.button == 1) { - command.action = E_TEP_UNGRAB; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - command.time = event->button.time; - tep_el->mouse_down = FALSE; - } else if (event->button.button == 2) { - command.action = E_TEP_MOVE; - command.position = E_TEP_VALUE; - command.value = event->button.position; - command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_GET_SELECTION; - command.position = E_TEP_SELECTION; - command.value = 0; - command.time = event->button.time; - } - break; - case GDK_MOTION_NOTIFY: - if (tep_el->mouse_down) { - command.action = E_TEP_SELECT; - command.position = E_TEP_VALUE; - command.time = event->motion.time; - command.value = event->motion.position; - } - break; - case GDK_KEY_PRESS: - { - ETextEventProcessorEventKey key = event->key; - command.time = event->key.time; - if (key.state & GDK_SHIFT_MASK) - command.action = E_TEP_SELECT; - else - command.action = E_TEP_MOVE; - switch(key.keyval) { - case GDK_Home: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_START_OF_BUFFER; - else - command.position = E_TEP_START_OF_LINE; - break; - case GDK_End: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_END_OF_BUFFER; - else - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break; - case GDK_Page_Down: command.position = E_TEP_FORWARD_PAGE; break; - /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */ - case GDK_Up: command.position = E_TEP_BACKWARD_LINE; break; - case GDK_Down: command.position = E_TEP_FORWARD_LINE; break; - case GDK_Left: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Right: - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_FORWARD_WORD; - else - command.position = E_TEP_FORWARD_CHARACTER; - break; - - case GDK_BackSpace: - command.action = E_TEP_DELETE; - if (key.state & GDK_CONTROL_MASK) - command.position = E_TEP_BACKWARD_WORD; - else - command.position = E_TEP_BACKWARD_CHARACTER; - break; - case GDK_Clear: - command.action = E_TEP_DELETE; - command.position = E_TEP_END_OF_LINE; - break; - case GDK_Insert: - if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_PASTE; - command.position = E_TEP_SELECTION; - } else if (key.state & GDK_CONTROL_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - } else { - /* gtk_toggle_insert(text) -- IMPLEMENT */ - } - break; - case GDK_Delete: - if (key.state & GDK_CONTROL_MASK){ - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_WORD; - } else if (key.state & GDK_SHIFT_MASK) { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } else { - command.action = E_TEP_DELETE; - command.position = E_TEP_FORWARD_CHARACTER; - } - break; - case GDK_Tab: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - case GDK_Return: - if (key.state & GDK_CONTROL_MASK) { - command.action = E_TEP_ACTIVATE; - command.position = E_TEP_SELECTION; - } else { - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = 1; - command.string = "\n"; - } - break; - case GDK_Escape: - /* Don't insert literally */ - command.action = E_TEP_NOP; - command.position = E_TEP_SELECTION; - break; - - default: - if (key.state & GDK_CONTROL_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = control_keys[(int) (key.keyval - 'a')].position; - if (control_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = control_keys[(int) (key.keyval - 'a')].action; - command.value = control_keys[(int) (key.keyval - 'a')].value; - command.string = control_keys[(int) (key.keyval - 'a')].string; - } - - if (key.keyval == 'x') { - command.action = E_TEP_COPY; - command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - - command.action = E_TEP_DELETE; - command.position = E_TEP_SELECTION; - } - - break; - } else if (key.state & GDK_MOD1_MASK) { - if ((key.keyval >= 'A') && (key.keyval <= 'Z')) - key.keyval -= 'A' - 'a'; - - if ((key.keyval >= 'a') && (key.keyval <= 'z')) { - command.position = alt_keys[(int) (key.keyval - 'a')].position; - if (alt_keys[(int) (key.keyval - 'a')].action != E_TEP_MOVE) - command.action = alt_keys[(int) (key.keyval - 'a')].action; - command.value = alt_keys[(int) (key.keyval - 'a')].value; - command.string = alt_keys[(int) (key.keyval - 'a')].string; - } - } else if (key.length > 0) { - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.value = strlen(key.string); - command.string = key.string; - - } else { - command.action = E_TEP_NOP; - } - } - break; - case GDK_KEY_RELEASE: - command.time = event->key.time; - command.action = E_TEP_NOP; - break; - default: - command.action = E_TEP_NOP; - break; - } - } - if (command.action != E_TEP_NOP) { - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); - return 1; - } - else - return 0; -} - -ETextEventProcessor * -e_text_event_processor_emacs_like_new (void) -{ - ETextEventProcessorEmacsLike *retval = gtk_type_new (e_text_event_processor_emacs_like_get_type ()); - return E_TEXT_EVENT_PROCESSOR (retval); -} - diff --git a/widgets/text/e-text-event-processor-emacs-like.h b/widgets/text/e-text-event-processor-emacs-like.h deleted file mode 100644 index 651bb552b3..0000000000 --- a/widgets/text/e-text-event-processor-emacs-like.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor-emacs-like.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ -#define __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ - -#include -#include "e-text-event-processor.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessorEmacsLike - Turns events on a text widget into commands. Uses an emacs-ish interface. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE (e_text_event_processor_emacs_like_get_type ()) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike)) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) - - -typedef struct _ETextEventProcessorEmacsLike ETextEventProcessorEmacsLike; -typedef struct _ETextEventProcessorEmacsLikeClass ETextEventProcessorEmacsLikeClass; - -struct _ETextEventProcessorEmacsLike -{ - ETextEventProcessor parent; - - /* object specific fields */ - gboolean mouse_down; -}; - -struct _ETextEventProcessorEmacsLikeClass -{ - ETextEventProcessorClass parent_class; -}; - - -GtkType e_text_event_processor_emacs_like_get_type (void); -ETextEventProcessor *e_text_event_processor_emacs_like_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__ */ diff --git a/widgets/text/e-text-event-processor-types.h b/widgets/text/e-text-event-processor-types.h deleted file mode 100644 index 32a39bf0c0..0000000000 --- a/widgets/text/e-text-event-processor-types.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 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/. - */ - -#ifndef __E_TEXT_EVENT_PROCESSOR_TYPES_H__ -#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__ - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include - -typedef enum _ETextEventProcessorCommandPosition ETextEventProcessorCommandPosition; -typedef enum _ETextEventProcessorCommandAction ETextEventProcessorCommandAction; -typedef struct _ETextEventProcessorCommand ETextEventProcessorCommand; - -typedef union _ETextEventProcessorEvent ETextEventProcessorEvent; -typedef struct _ETextEventProcessorEventButton ETextEventProcessorEventButton; -typedef struct _ETextEventProcessorEventKey ETextEventProcessorEventKey; -typedef struct _ETextEventProcessorEventMotion ETextEventProcessorEventMotion; - -enum _ETextEventProcessorCommandPosition { - E_TEP_VALUE, - E_TEP_SELECTION, - - E_TEP_START_OF_BUFFER, - E_TEP_END_OF_BUFFER, - - E_TEP_START_OF_LINE, - E_TEP_END_OF_LINE, - - E_TEP_FORWARD_CHARACTER, - E_TEP_BACKWARD_CHARACTER, - - E_TEP_FORWARD_WORD, - E_TEP_BACKWARD_WORD, - - E_TEP_FORWARD_LINE, - E_TEP_BACKWARD_LINE, - - E_TEP_FORWARD_PARAGRAPH, - E_TEP_BACKWARD_PARAGRAPH, - - E_TEP_FORWARD_PAGE, - E_TEP_BACKWARD_PAGE -}; - -enum _ETextEventProcessorCommandAction { - E_TEP_MOVE, - E_TEP_SELECT, - E_TEP_DELETE, - E_TEP_INSERT, - - E_TEP_COPY, - E_TEP_PASTE, - E_TEP_GET_SELECTION, - E_TEP_SET_SELECT_BY_WORD, - E_TEP_ACTIVATE, - - E_TEP_GRAB, - E_TEP_UNGRAB, - - E_TEP_NOP -}; - -struct _ETextEventProcessorCommand { - ETextEventProcessorCommandPosition position; - ETextEventProcessorCommandAction action; - int value; - char *string; - guint32 time; -}; - -struct _ETextEventProcessorEventButton { - GdkEventType type; - guint32 time; - guint state; - guint button; - gint position; -}; - -struct _ETextEventProcessorEventKey { - GdkEventType type; - guint32 time; - guint state; - guint keyval; - gint length; - gchar *string; -}; - -struct _ETextEventProcessorEventMotion { - GdkEventType type; - guint32 time; - guint state; - gint position; -}; - -union _ETextEventProcessorEvent { - GdkEventType type; - ETextEventProcessorEventButton button; - ETextEventProcessorEventKey key; - ETextEventProcessorEventMotion motion; -}; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_TYPES_H__ */ diff --git a/widgets/text/e-text-event-processor.c b/widgets/text/e-text-event-processor.c deleted file mode 100644 index 47f028ca62..0000000000 --- a/widgets/text/e-text-event-processor.c +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-text-event-processor.h" -static void e_text_event_processor_init (ETextEventProcessor *card); -static void e_text_event_processor_class_init (ETextEventProcessorClass *klass); - -static GtkObjectClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0 -}; - -enum { - E_TEP_EVENT, - E_TEP_LAST_SIGNAL -}; - -static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 }; - -GtkType -e_text_event_processor_get_type (void) -{ - static GtkType text_event_processor_type = 0; - - if (!text_event_processor_type) - { - static const GtkTypeInfo text_event_processor_info = - { - "ETextEventProcessor", - sizeof (ETextEventProcessor), - sizeof (ETextEventProcessorClass), - (GtkClassInitFunc) e_text_event_processor_class_init, - (GtkObjectInitFunc) e_text_event_processor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_type = gtk_type_unique (gtk_object_get_type (), &text_event_processor_info); - } - - return text_event_processor_type; -} - -static void -e_text_event_processor_class_init (ETextEventProcessorClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - e_tep_signals[E_TEP_EVENT] = - gtk_signal_new ("command", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, e_tep_signals, E_TEP_LAST_SIGNAL); - - klass->event = NULL; - klass->command = NULL; -} - -static void -e_text_event_processor_init (ETextEventProcessor *tep) -{ -} - -gint -e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event) -{ - if (E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event) { - return E_TEXT_EVENT_PROCESSOR_CLASS(GTK_OBJECT(tep)->klass)->event(tep, event); - } else { - return 0; - } -} diff --git a/widgets/text/e-text-event-processor.h b/widgets/text/e-text-event-processor.h deleted file mode 100644 index 1fc79f3f70..0000000000 --- a/widgets/text/e-text-event-processor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-text-event-processor.h - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Lahey - * - * This library 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 library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_TEXT_EVENT_PROCESSOR_H__ -#define __E_TEXT_EVENT_PROCESSOR_H__ - -#include -#include "e-text-event-processor-types.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ETextEventProcessor - Turns events on a text widget into commands. - * - */ - -#define E_TEXT_EVENT_PROCESSOR_TYPE (e_text_event_processor_get_type ()) -#define E_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor)) -#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass)) -#define E_IS_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) - - -typedef struct _ETextEventProcessor ETextEventProcessor; -typedef struct _ETextEventProcessorClass ETextEventProcessorClass; - -struct _ETextEventProcessor -{ - GtkObject parent; - - /* object specific fields */ - -}; - -struct _ETextEventProcessorClass -{ - GtkObjectClass parent_class; - - /* signals */ - void (* command) (ETextEventProcessor *tep, ETextEventProcessorCommand *command); - - /* virtual functions */ - gint (* event) (ETextEventProcessor *tep, ETextEventProcessorEvent *event); -}; - - -GtkType e_text_event_processor_get_type (void); -gint e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_TEXT_EVENT_PROCESSOR_H__ */ diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c deleted file mode 100644 index ae43d41611..0000000000 --- a/widgets/text/e-text-test.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - ETextTest: E-Text item test program - Copyright (C)2000: Iain Holmes - - This code is licensed under the GPL -*/ - -#include "e-text.h" -#include - -void -quit_cb (GtkWidget *widget, - gpointer data) -{ - gtk_main_quit (); -} - -void -change_text_cb (GtkEntry *entry, - EText *text) -{ - gchar *str; - - str = gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "text", str, - NULL); -} - -void -change_font_cb (GtkEntry *entry, - EText *text) -{ - gchar *font; - - font = gtk_entry_get_text (entry); - gnome_canvas_item_set (GNOME_CANVAS_ITEM (text), - "font", font, - NULL); -} - -int -main (int argc, - char **argv) -{ - GtkWidget *window, *canvas, *scroller, *vbox, *text, *font; - GtkWidget *frame; - GnomeCanvasItem *item; - - gnome_init ("ETextTest", "0.0.1", argc, argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), "EText Test"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (quit_cb), NULL); - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - canvas = gnome_canvas_new (); - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); - scroller = gtk_scrolled_window_new (NULL, NULL); - vbox = gtk_vbox_new (FALSE, 2); - - gtk_container_add (GTK_CONTAINER (window), vbox); - gtk_box_pack_start (GTK_BOX (vbox), scroller, TRUE, TRUE, 2); - gtk_container_add (GTK_CONTAINER (scroller), canvas); - - frame = gtk_frame_new ("Text"); - text = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (frame), text); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - frame = gtk_frame_new ("Font"); - font = gtk_entry_new (); - gtk_container_add (GTK_CONTAINER (frame), font); - gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); - - item = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)), - e_text_get_type (), - "text", "Hello World! This is a really long string to test out the ellipsis stuff.", - "x", 10.0, - "y", 10.0, - "font", "-adobe-helvetica-medium-r-normal--12-*-72-72-p-*-iso8859-1", - "fill_color", "black", - "anchor", GTK_ANCHOR_NW, - "use_ellipsis", TRUE, - "ellipsis", "...", - "editable", TRUE, - "line_wrap", TRUE, - "max_lines", 3, - "clip_width", 150.0, - NULL); - - gtk_signal_connect (GTK_OBJECT (text), "activate", - GTK_SIGNAL_FUNC (change_text_cb), item); - gtk_signal_connect (GTK_OBJECT (font), "activate", - GTK_SIGNAL_FUNC (change_font_cb), item); - - gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, 400.0, 400.0); - gtk_widget_show_all (window); - gtk_main (); - - return 0; -} diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c deleted file mode 100644 index 6647531eee..0000000000 --- a/widgets/text/e-text.c +++ /dev/null @@ -1,2549 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* EText - Text item for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ - -#include -#include -#include -#include "e-text.h" -#include /* for BlackPixel */ -#include -#include -#include -#include - -#include "e-text-event-processor-emacs-like.h" - -enum { - E_TEXT_RESIZE, - E_TEXT_CHANGE, - E_TEXT_LAST_SIGNAL -}; - -static guint e_text_signals[E_TEXT_LAST_SIGNAL] = { 0 }; - - - -/* This defines a line of text */ -struct line { - char *text; /* Line's text, it is a pointer into the text->text string */ - int length; /* Line's length in characters */ - int width; /* Line's width in pixels */ - int ellipsis_length; /* Length before adding ellipsis */ -}; - - - -/* Object argument IDs */ -enum { - ARG_0, - ARG_TEXT, - ARG_X, - ARG_Y, - ARG_FONT, - ARG_FONTSET, - ARG_FONT_GDK, - ARG_ANCHOR, - ARG_JUSTIFICATION, - ARG_CLIP_WIDTH, - ARG_CLIP_HEIGHT, - ARG_CLIP, - ARG_X_OFFSET, - ARG_Y_OFFSET, - ARG_FILL_COLOR, - ARG_FILL_COLOR_GDK, - ARG_FILL_COLOR_RGBA, - ARG_FILL_STIPPLE, - ARG_TEXT_WIDTH, - ARG_TEXT_HEIGHT, - ARG_EDITABLE, - ARG_USE_ELLIPSIS, - ARG_ELLIPSIS, - ARG_LINE_WRAP, - ARG_MAX_LINES -}; - - -enum { - E_SELECTION_PRIMARY, - E_SELECTION_CLIPBOARD -}; -enum { - TARGET_STRING, - TARGET_TEXT, - TARGET_COMPOUND_TEXT -}; - -static void e_text_class_init (ETextClass *class); -static void e_text_init (EText *text); -static void e_text_destroy (GtkObject *object); -static void e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void e_text_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); -static void e_text_realize (GnomeCanvasItem *item); -static void e_text_unrealize (GnomeCanvasItem *item); -static void e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height); -static double e_text_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, - GnomeCanvasItem **actual_item); -static void e_text_bounds (GnomeCanvasItem *item, - double *x1, double *y1, double *x2, double *y2); -static void e_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf); -static gint e_text_event (GnomeCanvasItem *item, GdkEvent *event); - -static void e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data); - -static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time); -static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length); - -static GtkWidget *e_text_get_invisible(EText *text); -static void _selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - EText *text); -static void _selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - EText *text); -static void _selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - EText *text); - -static ETextSuckFont *e_suck_font (GdkFont *font); -static void e_suck_font_free (ETextSuckFont *suckfont); - - -static GnomeCanvasItemClass *parent_class; -static GdkAtom clipboard_atom = GDK_NONE; - - - -/** - * e_text_get_type: - * @void: - * - * Registers the &EText class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &EText class. - **/ -GtkType -e_text_get_type (void) -{ - static GtkType text_type = 0; - - if (!text_type) { - GtkTypeInfo text_info = { - "EText", - sizeof (EText), - sizeof (ETextClass), - (GtkClassInitFunc) e_text_class_init, - (GtkObjectInitFunc) e_text_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - text_type = gtk_type_unique (gnome_canvas_item_get_type (), &text_info); - } - - return text_type; -} - -/* Class initialization function for the text item */ -static void -e_text_class_init (ETextClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass *) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (gnome_canvas_item_get_type ()); - - e_text_signals[E_TEXT_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - e_text_signals[E_TEXT_CHANGE] = - gtk_signal_new ("change", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, change), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - - gtk_object_class_add_signals (object_class, e_text_signals, E_TEXT_LAST_SIGNAL); - - gtk_object_add_arg_type ("EText::text", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT); - gtk_object_add_arg_type ("EText::x", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X); - gtk_object_add_arg_type ("EText::y", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y); - gtk_object_add_arg_type ("EText::font", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT); - gtk_object_add_arg_type ("EText::fontset", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET); - gtk_object_add_arg_type ("EText::font_gdk", - GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK); - gtk_object_add_arg_type ("EText::anchor", - GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR); - gtk_object_add_arg_type ("EText::justification", - GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION); - gtk_object_add_arg_type ("EText::clip_width", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_WIDTH); - gtk_object_add_arg_type ("EText::clip_height", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_HEIGHT); - gtk_object_add_arg_type ("EText::clip", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CLIP); - gtk_object_add_arg_type ("EText::x_offset", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X_OFFSET); - gtk_object_add_arg_type ("EText::y_offset", - GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y_OFFSET); - gtk_object_add_arg_type ("EText::fill_color", - GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR); - gtk_object_add_arg_type ("EText::fill_color_gdk", - GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK); - gtk_object_add_arg_type ("EText::fill_color_rgba", - GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA); - gtk_object_add_arg_type ("EText::fill_stipple", - GTK_TYPE_GDK_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE); - gtk_object_add_arg_type ("EText::text_width", - GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_WIDTH); - gtk_object_add_arg_type ("EText::text_height", - GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_HEIGHT); - gtk_object_add_arg_type ("EText::editable", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); - gtk_object_add_arg_type ("EText::use_ellipsis", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USE_ELLIPSIS); - gtk_object_add_arg_type ("EText::ellipsis", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ELLIPSIS); - gtk_object_add_arg_type ("EText::line_wrap", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_LINE_WRAP); - gtk_object_add_arg_type ("EText::max_lines", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES); - - if (!clipboard_atom) - clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - - - - klass->resize = NULL; - klass->change = NULL; - - object_class->destroy = e_text_destroy; - object_class->set_arg = e_text_set_arg; - object_class->get_arg = e_text_get_arg; - - item_class->update = e_text_update; - item_class->realize = e_text_realize; - item_class->unrealize = e_text_unrealize; - item_class->draw = e_text_draw; - item_class->point = e_text_point; - item_class->bounds = e_text_bounds; - item_class->render = e_text_render; - item_class->event = e_text_event; -} - -/* Object initialization function for the text item */ -static void -e_text_init (EText *text) -{ - text->x = 0.0; - text->y = 0.0; - text->anchor = GTK_ANCHOR_CENTER; - text->justification = GTK_JUSTIFY_LEFT; - text->clip_width = 0.0; - text->clip_height = 0.0; - text->xofs = 0.0; - text->yofs = 0.0; - - text->ellipsis = NULL; - text->use_ellipsis = FALSE; - text->ellipsis_width = 0; - - text->editable = FALSE; - text->editing = FALSE; - text->xofs_edit = 0; - - text->selection_start = 0; - text->selection_end = 0; - text->select_by_word = FALSE; - - text->timeout_id = 0; - text->timer = NULL; - - text->lastx = 0; - text->lasty = 0; - text->last_state = 0; - - text->scroll_start = 0; - text->show_cursor = TRUE; - text->button_down = FALSE; - - text->tep = NULL; - - text->has_selection = FALSE; - - text->invisible = NULL; - text->primary_selection = NULL; - text->primary_length = 0; - text->clipboard_selection = NULL; - text->clipboard_length = 0; - - text->pointer_in = FALSE; - text->default_cursor_shown = TRUE; - - text->line_wrap = FALSE; - text->max_lines = -1; -} - -/* Destroy handler for the text item */ -static void -e_text_destroy (GtkObject *object) -{ - EText *text; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_TEXT (object)); - - text = E_TEXT (object); - - if (text->text) - g_free (text->text); - - if (text->tep) - gtk_object_unref (GTK_OBJECT(text->tep)); - - if (text->invisible) - gtk_object_unref (GTK_OBJECT(text->invisible)); - - if (text->lines) - g_free (text->lines); - - if (text->font) - gdk_font_unref (text->font); - - if (text->suckfont) - e_suck_font_free (text->suckfont); - - if (text->stipple) - gdk_bitmap_unref (text->stipple); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, double *py2) -{ - GnomeCanvasItem *item; - double x, y; - double clip_x, clip_y; - int old_height; - - item = GNOME_CANVAS_ITEM (text); - - x = text->x; - y = text->y; - - clip_x = x; - clip_y = y; - - /* Calculate text dimensions */ - - old_height = text->height; - - if (text->text && text->font) - text->height = (text->font->ascent + text->font->descent) * text->num_lines; - else - text->height = 0; - - if (old_height != text->height) - gtk_signal_emit_by_name (GTK_OBJECT (text), "resize"); - - /* Anchor text */ - - switch (text->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 -= text->max_width / 2; - clip_x -= text->clip_width / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - x -= text->max_width; - clip_x -= text->clip_width; - break; - } - - switch (text->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 -= text->height / 2; - clip_y -= text->clip_height / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - y -= text->height; - clip_y -= text->clip_height; - break; - } - - /* Bounds */ - - if (text->clip) { - /* maybe do bbox intersection here? */ - *px1 = clip_x; - *py1 = clip_y; - *px2 = clip_x + text->clip_width; - *py2 = clip_y + text->clip_height; - } else { - *px1 = x; - *py1 = y; - *px2 = x + text->max_width; - *py2 = y + text->height; - } -} - -static void -get_bounds (EText *text, double *px1, double *py1, double *px2, double *py2) -{ - GnomeCanvasItem *item; - double wx, wy; - int old_height; - - item = GNOME_CANVAS_ITEM (text); - - /* Get canvas pixel coordinates for text position */ - - wx = text->x; - wy = text->y; - gnome_canvas_item_i2w (item, &wx, &wy); - gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy); - - /* Get canvas pixel coordinates for clip rectangle position */ - - gnome_canvas_w2c (item->canvas, wx, wy, &text->clip_cx, &text->clip_cy); - text->clip_cwidth = text->clip_width * item->canvas->pixels_per_unit; - text->clip_cheight = text->clip_height * item->canvas->pixels_per_unit; - - /* Calculate text dimensions */ - - old_height = text->height; - - if (text->text && text->font) - text->height = (text->font->ascent + text->font->descent) * text->num_lines; - else - text->height = 0; - - if (old_height != text->height) - gtk_signal_emit_by_name (GTK_OBJECT (text), "resize"); - - /* Anchor text */ - - switch (text->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: - text->cx -= text->max_width / 2; - text->clip_cx -= text->clip_cwidth / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - text->cx -= text->max_width; - text->clip_cx -= text->clip_cwidth; - break; - } - - switch (text->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: - text->cy -= text->height / 2; - text->clip_cy -= text->clip_cheight / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - text->cy -= text->height; - text->clip_cy -= text->clip_cheight; - break; - } - - /* Bounds */ - - if (text->clip) { - *px1 = text->clip_cx; - *py1 = text->clip_cy; - *px2 = text->clip_cx + text->clip_cwidth; - *py2 = text->clip_cy + text->clip_cheight; - } else { - *px1 = text->cx; - *py1 = text->cy; - *px2 = text->cx + text->max_width; - *py2 = text->cy + text->height; - } -} - -/* Recalculates the bounding box of the text item. The bounding box is defined - * by the text's extents if the clip rectangle is disabled. If it is enabled, - * the bounding box is defined by the clip rectangle itself. - */ -static void -recalc_bounds (EText *text) -{ - GnomeCanvasItem *item; - - item = GNOME_CANVAS_ITEM (text); - - get_bounds (text, &item->x1, &item->y1, &item->x2, &item->y2); - - gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item); -} - -static void -calc_ellipsis (EText *text) -{ - if (text->font) - text->ellipsis_width = - gdk_text_width (text->font, - text->ellipsis ? text->ellipsis : "...", - text->ellipsis ? strlen (text->ellipsis) : 3); -} - -/* Calculates the line widths (in pixels) of the text's splitted lines */ -static void -calc_line_widths (EText *text) -{ - struct line *lines; - int i; - int j; - - lines = text->lines; - text->max_width = 0; - - if (!lines) - return; - - for (i = 0; i < text->num_lines; i++) { - if (lines->length != 0) { - if (text->font) { - lines->width = gdk_text_width (text->font, - lines->text, lines->length); - lines->ellipsis_length = 0; - } else { - lines->width = 0; - } - - if (text->clip && - text->use_ellipsis && - ! text->editing && - lines->width > text->clip_width) { - if (text->font) { - lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++ ) { - if (gdk_text_width (text->font, lines->text, j) + text->ellipsis_width <= text->clip_width) - lines->ellipsis_length = j; - else - break; - } - } - else - lines->ellipsis_length = 0; - lines->width = gdk_text_width (text->font, lines->text, lines->ellipsis_length) + - text->ellipsis_width; - } - else - lines->ellipsis_length = lines->length; - - if (lines->width > text->max_width) - text->max_width = lines->width; - } - - lines++; - } -} - -/* Splits the text of the text item into lines */ -static void -split_into_lines (EText *text) -{ - char *p; - struct line *lines; - int len; - int line_num; - char *laststart; - char *lastend; - char *linestart; - - /* Free old array of lines */ - - if (text->lines) - g_free (text->lines); - - text->lines = NULL; - text->num_lines = 0; - - if (!text->text) - return; - - /* First, count the number of lines */ - - lastend = text->text; - laststart = text->text; - linestart = text->text; - - for (p = text->text; *p; p++) { - if (text->line_wrap && (*p == ' ' || *p == '\n')) { - if ( laststart != lastend - && gdk_text_width(text->font, - linestart, - p - linestart) - > text->clip_width ) { - text->num_lines ++; - linestart = laststart; - laststart = p + 1; - lastend = p; - } else if (*p == ' ') { - laststart = p + 1; - lastend = p; - } - } - if (*p == '\n') { - text->num_lines ++; - lastend = p + 1; - laststart = p + 1; - linestart = p + 1; - } - } - - if (text->line_wrap) { - if ( laststart != lastend - && gdk_text_width(text->font, - linestart, - p - linestart) - > text->clip_width ) { - text->num_lines ++; - } - } - - text->num_lines++; - - if ( (!text->editing) && text->max_lines != -1 && text->num_lines > text->max_lines ) { - text->num_lines = text->max_lines; - } - - /* Allocate array of lines and calculate split positions */ - - text->lines = lines = g_new0 (struct line, text->num_lines); - len = 0; - line_num = 1; - lastend = text->text; - laststart = text->text; - - for (p = text->text; line_num < text->num_lines && *p; p++) { - gboolean handled = FALSE; - if (len == 0) - lines->text = p; - if (text->line_wrap && (*p == ' ' || *p == '\n')) { - if ( gdk_text_width(text->font, - lines->text, - p - lines->text) - > text->clip_width - && laststart != lastend ) { - lines->length = lastend - lines->text; - lines++; - line_num ++; - len = p - laststart; - lines->text = laststart; - laststart = p + 1; - lastend = p; - } else if (*p == ' ') { - laststart = p + 1; - lastend = p; - len ++; - } - handled = TRUE; - } - if ( line_num >= text->num_lines ) - break; - if (*p == '\n') { - lines->length = p - lines->text; - lines++; - line_num ++; - len = 0; - lastend = p + 1; - laststart = p + 1; - handled = TRUE; - } - if (!handled) - len++; - } - - if ( line_num < text->num_lines && text->line_wrap ) { - if ( gdk_text_width(text->font, - lines->text, - p - lines->text) - > text->clip_width - && laststart != lastend ) { - lines->length = lastend - lines->text; - lines++; - line_num ++; - len = p - laststart; - lines->text = laststart; - laststart = p + 1; - lastend = p; - } - } - - if (len == 0) - lines->text = p; - lines->length = strlen(lines->text); - - calc_line_widths (text); -} - -/* Convenience function to set the text's GC's foreground color */ -static void -set_text_gc_foreground (EText *text) -{ - GdkColor c; - - if (!text->gc) - return; - - c.pixel = text->pixel; - gdk_gc_set_foreground (text->gc, &c); -} - -/* Sets the stipple pattern for the text */ -static void -set_stipple (EText *text, GdkBitmap *stipple, int reconfigure) -{ - if (text->stipple && !reconfigure) - gdk_bitmap_unref (text->stipple); - - text->stipple = stipple; - if (stipple && !reconfigure) - gdk_bitmap_ref (stipple); - - if (text->gc) { - if (stipple) { - gdk_gc_set_stipple (text->gc, stipple); - gdk_gc_set_fill (text->gc, GDK_STIPPLED); - } else - gdk_gc_set_fill (text->gc, GDK_SOLID); - } -} - -/* Set_arg handler for the text item */ -static void -e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EText *text; - GdkColor color = { 0, 0, 0, 0, }; - GdkColor *pcolor; - gboolean color_changed; - int have_pixel; - - item = GNOME_CANVAS_ITEM (object); - text = E_TEXT (object); - - color_changed = FALSE; - have_pixel = FALSE; - - switch (arg_id) { - case ARG_TEXT: - if (text->text) - g_free (text->text); - - text->text = g_strdup (GTK_VALUE_STRING (*arg)); - split_into_lines (text); - recalc_bounds (text); - break; - - case ARG_X: - text->x = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_Y: - text->y = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_FONT: - if (text->font) - gdk_font_unref (text->font); - - text->font = gdk_font_load (GTK_VALUE_STRING (*arg)); - - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } - - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_FONTSET: - if (text->font) - gdk_font_unref (text->font); - - text->font = gdk_fontset_load (GTK_VALUE_STRING (*arg)); - - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } - - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_FONT_GDK: - if (text->font) - gdk_font_unref (text->font); - - text->font = GTK_VALUE_BOXED (*arg); - gdk_font_ref (text->font); - - if (item->canvas->aa) { - if (text->suckfont) - e_suck_font_free (text->suckfont); - - text->suckfont = e_suck_font (text->font); - } - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_ANCHOR: - text->anchor = GTK_VALUE_ENUM (*arg); - recalc_bounds (text); - break; - - case ARG_JUSTIFICATION: - text->justification = GTK_VALUE_ENUM (*arg); - break; - - case ARG_CLIP_WIDTH: - text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg)); - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_CLIP_HEIGHT: - text->clip_height = fabs (GTK_VALUE_DOUBLE (*arg)); - recalc_bounds (text); - break; - - case ARG_CLIP: - text->clip = GTK_VALUE_BOOL (*arg); - calc_ellipsis (text); - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_X_OFFSET: - text->xofs = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_Y_OFFSET: - text->yofs = GTK_VALUE_DOUBLE (*arg); - recalc_bounds (text); - break; - - case ARG_FILL_COLOR: - if (GTK_VALUE_STRING (*arg)) - gdk_color_parse (GTK_VALUE_STRING (*arg), &color); - - text->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - color_changed = TRUE; - break; - - case ARG_FILL_COLOR_GDK: - pcolor = GTK_VALUE_BOXED (*arg); - if (pcolor) { - color = *pcolor; - gdk_color_context_query_color (item->canvas->cc, &color); - have_pixel = TRUE; - } - - text->rgba = ((color.red & 0xff00) << 16 | - (color.green & 0xff00) << 8 | - (color.blue & 0xff00) | - 0xff); - color_changed = TRUE; - break; - - case ARG_FILL_COLOR_RGBA: - text->rgba = GTK_VALUE_UINT (*arg); - color_changed = TRUE; - break; - - case ARG_FILL_STIPPLE: - set_stipple (text, GTK_VALUE_BOXED (*arg), FALSE); - break; - - case ARG_EDITABLE: - text->editable = GTK_VALUE_BOOL (*arg); - break; - - case ARG_USE_ELLIPSIS: - text->use_ellipsis = GTK_VALUE_BOOL (*arg); - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_ELLIPSIS: - if (text->ellipsis) - g_free (text->ellipsis); - - text->ellipsis = g_strdup (GTK_VALUE_STRING (*arg)); - calc_ellipsis (text); - calc_line_widths (text); - recalc_bounds (text); - break; - - case ARG_LINE_WRAP: - text->line_wrap = GTK_VALUE_BOOL (*arg); - split_into_lines (text); - recalc_bounds (text); - break; - - case ARG_MAX_LINES: - text->max_lines = GTK_VALUE_INT (*arg); - split_into_lines (text); - recalc_bounds (text); - break; - - default: - break; - } - - if (color_changed) { - if (have_pixel) - text->pixel = color.pixel; - else - text->pixel = gnome_canvas_get_color_pixel (item->canvas, text->rgba); - - if (!item->canvas->aa) - set_text_gc_foreground (text); - - gnome_canvas_item_request_update (item); - } -} - -/* Get_arg handler for the text item */ -static void -e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EText *text; - GdkColor *color; - - text = E_TEXT (object); - - switch (arg_id) { - case ARG_TEXT: - GTK_VALUE_STRING (*arg) = g_strdup (text->text); - break; - - case ARG_X: - GTK_VALUE_DOUBLE (*arg) = text->x; - break; - - case ARG_Y: - GTK_VALUE_DOUBLE (*arg) = text->y; - break; - - case ARG_FONT_GDK: - GTK_VALUE_BOXED (*arg) = text->font; - break; - - case ARG_ANCHOR: - GTK_VALUE_ENUM (*arg) = text->anchor; - break; - - case ARG_JUSTIFICATION: - GTK_VALUE_ENUM (*arg) = text->justification; - break; - - case ARG_CLIP_WIDTH: - GTK_VALUE_DOUBLE (*arg) = text->clip_width; - break; - - case ARG_CLIP_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = text->clip_height; - break; - - case ARG_CLIP: - GTK_VALUE_BOOL (*arg) = text->clip; - break; - - case ARG_X_OFFSET: - GTK_VALUE_DOUBLE (*arg) = text->xofs; - break; - - case ARG_Y_OFFSET: - GTK_VALUE_DOUBLE (*arg) = text->yofs; - break; - - case ARG_FILL_COLOR_GDK: - color = g_new (GdkColor, 1); - color->pixel = text->pixel; - gdk_color_context_query_color (text->item.canvas->cc, color); - GTK_VALUE_BOXED (*arg) = color; - break; - - case ARG_FILL_COLOR_RGBA: - GTK_VALUE_UINT (*arg) = text->rgba; - break; - - case ARG_FILL_STIPPLE: - GTK_VALUE_BOXED (*arg) = text->stipple; - break; - - case ARG_TEXT_WIDTH: - GTK_VALUE_DOUBLE (*arg) = text->max_width / text->item.canvas->pixels_per_unit; - break; - - case ARG_TEXT_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = text->height / text->item.canvas->pixels_per_unit; - break; - - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = text->editable; - break; - - case ARG_USE_ELLIPSIS: - GTK_VALUE_BOOL (*arg) = text->use_ellipsis; - break; - - case ARG_ELLIPSIS: - GTK_VALUE_STRING (*arg) = g_strdup (text->ellipsis); - break; - - case ARG_LINE_WRAP: - GTK_VALUE_BOOL (*arg) = text->line_wrap; - break; - - case ARG_MAX_LINES: - GTK_VALUE_INT (*arg) = text->max_lines; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/* Update handler for the text item */ -static void -e_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags) -{ - EText *text; - double x1, y1, x2, y2; - ArtDRect i_bbox, c_bbox; - int i; - - text = E_TEXT (item); - - if (parent_class->update) - (* parent_class->update) (item, affine, clip_path, flags); - - if (!item->canvas->aa) { - set_text_gc_foreground (text); - set_stipple (text, text->stipple, TRUE); - get_bounds (text, &x1, &y1, &x2, &y2); - - gnome_canvas_update_bbox (item, x1, y1, x2, y2); - } else { - /* aa rendering */ - for (i = 0; i < 6; i++) - text->affine[i] = affine[i]; - get_bounds_item_relative (text, &i_bbox.x0, &i_bbox.y0, &i_bbox.x1, &i_bbox.y1); - art_drect_affine_transform (&c_bbox, &i_bbox, affine); - gnome_canvas_update_bbox (item, c_bbox.x0, c_bbox.y0, c_bbox.x1, c_bbox.y1); - - } -} - -/* Realize handler for the text item */ -static void -e_text_realize (GnomeCanvasItem *item) -{ - EText *text; - - text = E_TEXT (item); - - if (parent_class->realize) - (* parent_class->realize) (item); - - text->gc = gdk_gc_new (item->canvas->layout.bin_window); - - text->i_cursor = gdk_cursor_new (GDK_XTERM); - text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR); -} - -/* Unrealize handler for the text item */ -static void -e_text_unrealize (GnomeCanvasItem *item) -{ - EText *text; - - text = E_TEXT (item); - - gdk_gc_unref (text->gc); - text->gc = NULL; - - gdk_cursor_destroy (text->i_cursor); - gdk_cursor_destroy (text->default_cursor); - - if (parent_class->unrealize) - (* parent_class->unrealize) (item); -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static double -get_line_xpos_item_relative (EText *text, struct line *line) -{ - double x; - - x = text->x; - - switch (text->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 -= text->max_width / 2; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - x -= text->max_width; - break; - } - - switch (text->justification) { - case GTK_JUSTIFY_RIGHT: - x += text->max_width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (text->max_width - line->width) * 0.5; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -/* Calculates the y position of the first line of text. */ -static double -get_line_ypos_item_relative (EText *text) -{ - double y; - - y = text->y; - - switch (text->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 -= text->height / 2; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - y -= text->height; - break; - } - - return y; -} - -/* Calculates the x position of the specified line of text, based on the text's justification */ -static int -get_line_xpos (EText *text, struct line *line) -{ - int x; - - x = text->cx; - - switch (text->justification) { - case GTK_JUSTIFY_RIGHT: - x += text->max_width - line->width; - break; - - case GTK_JUSTIFY_CENTER: - x += (text->max_width - line->width) / 2; - break; - - default: - /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support - * GTK_JUSTIFY_FILL, yet. - */ - break; - } - - return x; -} - -static void -_get_tep(EText *text) -{ - if (!text->tep) { - text->tep = e_text_event_processor_emacs_like_new(); - gtk_object_ref (GTK_OBJECT (text->tep)); - gtk_object_sink (GTK_OBJECT (text->tep)); - gtk_signal_connect(GTK_OBJECT(text->tep), - "command", - GTK_SIGNAL_FUNC(e_text_command), - (gpointer) text); - } -} - -/* Draw handler for the text item */ -static void -e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, int width, int height) -{ - EText *text; - GdkRectangle rect, *clip_rect; - struct line *lines; - int i; - int xpos, ypos; - int start_char, end_char; - int sel_start, sel_end; - GdkRectangle sel_rect; - GdkGC *fg_gc; - GnomeCanvas *canvas; - - text = E_TEXT (item); - canvas = GNOME_CANVAS_ITEM(text)->canvas; - - fg_gc = GTK_WIDGET(canvas)->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE]; - - if (!text->text || !text->font) - return; - - clip_rect = NULL; - if (text->clip) { - rect.x = text->clip_cx - x; - rect.y = text->clip_cy - y; - rect.width = text->clip_cwidth; - rect.height = text->clip_cheight; - - gdk_gc_set_clip_rectangle (text->gc, &rect); - gdk_gc_set_clip_rectangle (fg_gc, &rect); - clip_rect = ▭ - } - lines = text->lines; - ypos = text->cy + text->font->ascent; - - if (text->stipple) - gnome_canvas_set_stipple_origin (item->canvas, text->gc); - - for (i = 0; i < text->num_lines; i++) { - xpos = get_line_xpos (text, lines); - if (text->editing) { - xpos -= text->xofs_edit; - start_char = lines->text - text->text; - end_char = start_char + lines->length; - sel_start = text->selection_start; - sel_end = text->selection_end; - if (sel_start > sel_end ) { - sel_start ^= sel_end; - sel_end ^= sel_start; - sel_start ^= sel_end; - } - if ( sel_start < start_char ) - sel_start = start_char; - if ( sel_end > end_char ) - sel_end = end_char; - if ( sel_start < sel_end ) { - sel_rect.x = xpos - x + gdk_text_width (text->font, - lines->text, - sel_start - start_char); - sel_rect.y = ypos - y - text->font->ascent; - sel_rect.width = gdk_text_width (text->font, - lines->text + sel_start - start_char, - sel_end - sel_start); - sel_rect.height = text->font->ascent + text->font->descent; - gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style, - drawable, - text->has_selection ? - GTK_STATE_SELECTED : - GTK_STATE_ACTIVE, - GTK_SHADOW_NONE, - clip_rect, - GTK_WIDGET(item->canvas), - "text", - sel_rect.x, - sel_rect.y, - sel_rect.width, - sel_rect.height); - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - sel_start - start_char); - gdk_draw_text (drawable, - text->font, - fg_gc, - xpos - x + gdk_text_width (text->font, - lines->text, - sel_start - start_char), - ypos - y, - lines->text + sel_start - start_char, - sel_end - sel_start); - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x + gdk_text_width (text->font, - lines->text, - sel_end - start_char), - ypos - y, - lines->text + sel_end - start_char, - end_char - sel_end); - } else { - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->length); - } - if (text->selection_start == text->selection_end && - text->selection_start >= start_char && - text->selection_start <= end_char && - text->show_cursor) { - gdk_draw_rectangle (drawable, - text->gc, - TRUE, - xpos - x + gdk_text_width (text->font, - lines->text, - sel_start - start_char), - ypos - y - text->font->ascent, - 1, - text->font->ascent + text->font->descent); - } - } else { - if ( text->clip && text->use_ellipsis && lines->ellipsis_length < lines->length) { - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->ellipsis_length); - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x + - lines->width - text->ellipsis_width, - ypos - y, - text->ellipsis ? text->ellipsis : "...", - text->ellipsis ? strlen (text->ellipsis) : 3); - } else - - gdk_draw_text (drawable, - text->font, - text->gc, - xpos - x, - ypos - y, - lines->text, - lines->length); - } - - ypos += text->font->ascent + text->font->descent; - lines++; - } - - if (text->clip) { - gdk_gc_set_clip_rectangle (text->gc, NULL); - gdk_gc_set_clip_rectangle (fg_gc, NULL); - } -} - -/* Render handler for the text item */ -static void -e_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf) -{ - EText *text; - guint32 fg_color; - double xpos, ypos; - struct line *lines; - int i, j; - double affine[6]; - ETextSuckFont *suckfont; - int dx, dy; - ArtPoint start_i, start_c; - - text = E_TEXT (item); - - if (!text->text || !text->font || !text->suckfont) - return; - - suckfont = text->suckfont; - - fg_color = text->rgba; - - gnome_canvas_buf_ensure_buf (buf); - - lines = text->lines; - start_i.y = get_line_ypos_item_relative (text); - - art_affine_scale (affine, item->canvas->pixels_per_unit, item->canvas->pixels_per_unit); - for (i = 0; i < 6; i++) - affine[i] = text->affine[i]; - - for (i = 0; i < text->num_lines; i++) { - if (lines->length != 0) { - start_i.x = get_line_xpos_item_relative (text, lines); - art_affine_point (&start_c, &start_i, text->affine); - xpos = start_c.x; - ypos = start_c.y; - - for (j = 0; j < lines->length; j++) { - ETextSuckChar *ch; - - ch = &suckfont->chars[(unsigned char)((lines->text)[j])]; - - affine[4] = xpos; - affine[5] = ypos; - art_rgb_bitmap_affine ( - buf->buf, - buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1, - buf->buf_rowstride, - suckfont->bitmap + (ch->bitmap_offset >> 3), - ch->width, - suckfont->bitmap_height, - suckfont->bitmap_width >> 3, - fg_color, - affine, - ART_FILTER_NEAREST, NULL); - - dx = ch->left_sb + ch->width + ch->right_sb; - xpos += dx * affine[0]; - ypos += dx * affine[1]; - } - } - - dy = text->font->ascent + text->font->descent; - start_i.y += dy; - lines++; - } - - buf->is_bg = 0; -} - -/* Point handler for the text item */ -static double -e_text_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, GnomeCanvasItem **actual_item) -{ - EText *text; - int i; - struct line *lines; - int x1, y1, x2, y2; - int font_height; - int dx, dy; - double dist, best; - - text = E_TEXT (item); - - *actual_item = item; - - /* The idea is to build bounding rectangles for each of the lines of - * text (clipped by the clipping rectangle, if it is activated) and see - * whether the point is inside any of these. If it is, we are done. - * Otherwise, calculate the distance to the nearest rectangle. - */ - - if (text->font) - font_height = text->font->ascent + text->font->descent; - else - font_height = 0; - - best = 1.0e36; - - lines = text->lines; - - for (i = 0; i < text->num_lines; i++) { - /* Compute the coordinates of rectangle for the current line, - * clipping if appropriate. - */ - - x1 = get_line_xpos (text, lines); - y1 = text->cy + i * font_height; - x2 = x1 + lines->width; - y2 = y1 + font_height; - - if (text->clip) { - if (x1 < text->clip_cx) - x1 = text->clip_cx; - - if (y1 < text->clip_cy) - y1 = text->clip_cy; - - if (x2 > (text->clip_cx + text->clip_width)) - x2 = text->clip_cx + text->clip_width; - - if (y2 > (text->clip_cy + text->clip_height)) - y2 = text->clip_cy + text->clip_height; - - if ((x1 >= x2) || (y1 >= y2)) - continue; - } - - /* Calculate distance from point to rectangle */ - - if (cx < x1) - dx = x1 - cx; - else if (cx >= x2) - dx = cx - x2 + 1; - else - dx = 0; - - if (cy < y1) - dy = y1 - cy; - else if (cy >= y2) - dy = cy - y2 + 1; - else - dy = 0; - - if ((dx == 0) && (dy == 0)) - return 0.0; - - dist = sqrt (dx * dx + dy * dy); - if (dist < best) - best = dist; - - /* Next! */ - - lines++; - } - - return best / item->canvas->pixels_per_unit; -} - -/* Bounds handler for the text item */ -static void -e_text_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) -{ - EText *text; - double width, height; - - text = E_TEXT (item); - - *x1 = text->x; - *y1 = text->y; - - if (text->clip) { - width = text->clip_width; - height = text->clip_height; - } else { - width = text->max_width / item->canvas->pixels_per_unit; - height = text->height / item->canvas->pixels_per_unit; - } - - switch (text->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: - *x1 -= width / 2.0; - break; - - case GTK_ANCHOR_NE: - case GTK_ANCHOR_E: - case GTK_ANCHOR_SE: - *x1 -= width; - break; - } - - switch (text->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: - *y1 -= height / 2.0; - break; - - case GTK_ANCHOR_SW: - case GTK_ANCHOR_S: - case GTK_ANCHOR_SE: - *y1 -= height; - break; - } - - *x2 = *x1 + width; - *y2 = *y1 + height; -} - -static void -_get_xy_from_position (EText *text, gint position, gint *xp, gint *yp) -{ - if (xp || yp) { - struct line *lines = NULL; - int x, y; - int j; - x = get_line_xpos (text, lines); - y = text->cy; - for (j = 0, lines = text->lines; j < text->num_lines; lines++, j++) { - if (lines->text > text->text + position) - break; - y += text->font->ascent + text->font->descent; - } - lines --; - y -= text->font->descent; - - x += gdk_text_width (text->font, - lines->text, - position - (lines->text - text->text)); - x -= text->xofs_edit; - if (xp) - *xp = x; - if (yp) - *yp = y; - } -} - -static gint -_get_position_from_xy (EText *text, gint x, gint y) -{ - int i, j; - int ypos = text->cy; - int xpos; - struct line *lines; - j = 0; - while (y > ypos) { - ypos += text->font->ascent + text->font->descent; - j ++; - } - j--; - if (j >= text->num_lines) - j = text->num_lines - 1; - if (j < 0) - j = 0; - i = 0; - lines = text->lines; - lines += j; - x += text->xofs_edit; - xpos = get_line_xpos (text, lines); - for(i = 0; i < lines->length; i++) { - int charwidth = gdk_text_width(text->font, - lines->text + i, - 1); - xpos += charwidth / 2; - if (xpos > x) { - break; - } - xpos += (charwidth + 1) / 2; - } - return lines->text + i - text->text; -} - -#define SCROLL_WAIT_TIME 30000 - -static gboolean -_blink_scroll_timeout (gpointer data) -{ - EText *text = E_TEXT(data); - gulong current_time; - gboolean scroll = FALSE; - gboolean redraw = FALSE; - - g_timer_elapsed(text->timer, ¤t_time); - - if (text->scroll_start + SCROLL_WAIT_TIME > 1000000) { - if (current_time > text->scroll_start - (1000000 - SCROLL_WAIT_TIME) && - current_time < text->scroll_start) - scroll = TRUE; - } else { - if (current_time > text->scroll_start + SCROLL_WAIT_TIME || - current_time < text->scroll_start) - scroll = TRUE; - } - if (scroll && text->button_down) { - if (text->lastx - text->clip_cx > text->clip_cwidth && - text->xofs_edit < text->max_width - text->clip_cwidth) { - text->xofs_edit += 4; - if (text->xofs_edit > text->max_width - text->clip_cwidth + 1) - text->xofs_edit = text->max_width - text->clip_cwidth + 1; - redraw = TRUE; - } - if (text->lastx - text->clip_cx < 0 && - text->xofs_edit > 0) { - text->xofs_edit -= 4; - if (text->xofs_edit < 0) - text->xofs_edit = 0; - redraw = TRUE; - } - if (redraw) { - ETextEventProcessorEvent e_tep_event; - e_tep_event.type = GDK_MOTION_NOTIFY; - e_tep_event.motion.state = text->last_state; - e_tep_event.motion.time = 0; - e_tep_event.motion.position = _get_position_from_xy(text, text->lastx, text->lasty); - _get_tep(text); - e_text_event_processor_handle_event (text->tep, - &e_tep_event); - text->scroll_start = current_time; - } - } - - if (!((current_time / 500000) % 2)) { - if (!text->show_cursor) - redraw = TRUE; - text->show_cursor = TRUE; - } else { - if (text->show_cursor) - redraw = TRUE; - text->show_cursor = FALSE; - } - if (redraw) - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); - return TRUE; -} - -static gboolean -_do_tooltip (gpointer data) -{ - EText *text = E_TEXT (data); - struct line *lines; - GtkWidget *label, *vbox; - gint x, y, pointer_x, pointer_y, scr_w, scr_h, tip_w, tip_h; - int i; - - lines = text->lines; - - scr_w = gdk_screen_width (); - scr_h = gdk_screen_height (); - gdk_window_get_pointer (NULL, &pointer_x, &pointer_y, NULL); - - text->tooltip_window = gtk_window_new (GTK_WINDOW_POPUP); - vbox = gtk_vbox_new (TRUE, 0); - for (i = 0; i < text->num_lines; i++) { - gchar *linetext; - - linetext = g_strndup (lines->text, lines->length); - label = gtk_label_new (linetext); - g_free (linetext); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); - lines++; - } - - gtk_widget_show_all (vbox); - gtk_container_add (GTK_CONTAINER (text->tooltip_window), vbox); - gtk_widget_realize (text->tooltip_window); - tip_w = text->tooltip_window->allocation.width; - tip_h = text->tooltip_window->allocation.height; - - /* Stay on screen */ - x = pointer_x + tip_w <= scr_w ? pointer_x : scr_w - tip_w; - y = pointer_y + tip_h + 1 <= scr_h ? pointer_y + 1: pointer_y - tip_h; - gtk_widget_popup (text->tooltip_window, x, y); - - return FALSE; -} - -static gint -e_text_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EText *text = E_TEXT(item); - ETextEventProcessorEvent e_tep_event; - - gint return_val = 0; - - e_tep_event.type = event->type; - switch (event->type) { - case GDK_FOCUS_CHANGE: - if (text->editable) { - GdkEventFocus *focus_event; - focus_event = (GdkEventFocus *) event; - if (focus_event->in) { - if(!text->editing) { - text->editing = TRUE; - if ( text->pointer_in ) { - if ( text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->i_cursor); - text->default_cursor_shown = FALSE; - } - } - text->selection_start = 0; - text->selection_end = 0; - text->select_by_word = FALSE; - text->xofs_edit = 0; - if (text->timeout_id == 0) - text->timeout_id = g_timeout_add(10, _blink_scroll_timeout, text); - text->timer = g_timer_new(); - g_timer_elapsed(text->timer, &(text->scroll_start)); - g_timer_start(text->timer); - } - } else { - text->editing = FALSE; - if ( ! text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->default_cursor); - text->default_cursor_shown = TRUE; - } - if (text->timeout_id) { - g_source_remove(text->timeout_id); - text->timeout_id = 0; - } - if (text->timer) { - g_timer_stop(text->timer); - g_timer_destroy(text->timer); - text->timer = NULL; - } - } - if ( text->line_wrap ) - split_into_lines (text); - else - calc_line_widths (text); - recalc_bounds (text); - } - return_val = 0; - break; - case GDK_KEY_PRESS: /* Fall Through */ - case GDK_KEY_RELEASE: - if (text->editing) { - GdkEventKey key = event->key; - e_tep_event.key.time = key.time; - e_tep_event.key.state = key.state; - e_tep_event.key.keyval = key.keyval; - e_tep_event.key.length = key.length; - e_tep_event.key.string = key.string; - _get_tep(text); - return e_text_event_processor_handle_event (text->tep, - &e_tep_event); - } - else - return 0; - break; - case GDK_BUTTON_PRESS: /* Fall Through */ - case GDK_BUTTON_RELEASE: - if ((!text->editing) - && text->editable - && event->type == GDK_BUTTON_RELEASE - && event->button.button == 1) { - GdkEventButton button = event->button; - - gnome_canvas_item_grab_focus (item); - - e_tep_event.type = GDK_BUTTON_PRESS; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(text, button.x, button.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - e_tep_event.type = GDK_BUTTON_RELEASE; - } - if (text->editing) { - GdkEventButton button = event->button; - e_tep_event.button.time = button.time; - e_tep_event.button.state = button.state; - e_tep_event.button.button = button.button; - e_tep_event.button.position = _get_position_from_xy(text, button.x, button.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - if (event->button.button == 1) { - if (event->type == GDK_BUTTON_PRESS) - text->button_down = TRUE; - else - text->button_down = FALSE; - } - text->lastx = button.x; - text->lasty = button.y; - text->last_state = button.state; - } - break; - case GDK_MOTION_NOTIFY: - if (text->editing) { - GdkEventMotion motion = event->motion; - e_tep_event.motion.time = motion.time; - e_tep_event.motion.state = motion.state; - e_tep_event.motion.position = _get_position_from_xy(text, motion.x, motion.y); - _get_tep(text); - return_val = e_text_event_processor_handle_event (text->tep, - &e_tep_event); - text->lastx = motion.x; - text->lasty = motion.y; - text->last_state = motion.state; - } - break; - case GDK_ENTER_NOTIFY: - if ( text->tooltip_count == 0 ) - text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text); - text->tooltip_count ++; - text->pointer_in = TRUE; - if (text->editing) { - if ( text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->i_cursor); - text->default_cursor_shown = FALSE; - } - } - break; - case GDK_LEAVE_NOTIFY: - text->tooltip_count --; - if ( text->tooltip_count == 0 ) { - gtk_timeout_remove (text->tooltip_timeout); - if (text->tooltip_window) { - gtk_widget_destroy (text->tooltip_window); - text->tooltip_window = NULL; - } - } - - text->pointer_in = FALSE; - if (text->editing) { - if ( ! text->default_cursor_shown ) { - gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->default_cursor); - text->default_cursor_shown = TRUE; - } - } - break; - default: - break; - } - if (return_val) - return return_val; - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); - else - return 0; -} - -static int -_get_position(EText *text, ETextEventProcessorCommand *command) -{ - int i; - int length; - int x, y; - - switch (command->position) { - - case E_TEP_VALUE: - return command->value; - - case E_TEP_SELECTION: - return text->selection_end; - - case E_TEP_START_OF_BUFFER: - return 0; - case E_TEP_END_OF_BUFFER: - return strlen(text->text); - - case E_TEP_START_OF_LINE: - for (i = text->selection_end - 2; i > 0; i--) - if (text->text[i] == '\n') { - i++; - break; - } - return i; - case E_TEP_END_OF_LINE: - length = strlen(text->text); - for (i = text->selection_end + 1; i < length; i++) - if (text->text[i] == '\n') { - break; - } - if (i > length) - i = length; - return i; - - case E_TEP_FORWARD_CHARACTER: - length = strlen(text->text); - i = text->selection_end + 1; - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_CHARACTER: - i = text->selection_end - 1; - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_WORD: - length = strlen(text->text); - for (i = text->selection_end + 1; i < length; i++) - if (isspace(text->text[i])) { - break; - } - if (i > length) - i = length; - return i; - case E_TEP_BACKWARD_WORD: - for (i = text->selection_end - 2; i > 0; i--) - if (isspace(text->text[i])) { - i++; - break; - } - if (i < 0) - i = 0; - return i; - - case E_TEP_FORWARD_LINE: - _get_xy_from_position(text, text->selection_end, &x, &y); - y += text->font->ascent + text->font->descent; - return _get_position_from_xy(text, x, y); - case E_TEP_BACKWARD_LINE: - _get_xy_from_position(text, text->selection_end, &x, &y); - y -= text->font->ascent + text->font->descent; - return _get_position_from_xy(text, x, y); - - case E_TEP_FORWARD_PARAGRAPH: - case E_TEP_BACKWARD_PARAGRAPH: - - case E_TEP_FORWARD_PAGE: - case E_TEP_BACKWARD_PAGE: - return text->selection_end; - default: - return text->selection_end; - } -} - -static void -_delete_selection(EText *text) -{ - gint length = strlen(text->text); - if (text->selection_end == text->selection_start) - return; - if (text->selection_end < text->selection_start) { - text->selection_end ^= text->selection_start; - text->selection_start ^= text->selection_end; - text->selection_end ^= text->selection_start; - } - memmove( text->text + text->selection_start, - text->text + text->selection_end, - length - text->selection_end + 1 ); - length -= text->selection_end - text->selection_start; - text->selection_end = text->selection_start; -} - -static void -_insert(EText *text, char *string, int value) -{ - if (value > 0) { - char *temp; - gint length = strlen(text->text); - temp = g_new(gchar, length + value + 1); - strncpy(temp, text->text, text->selection_start); - strncpy(temp + text->selection_start, string, value); - strcpy(temp + text->selection_start + value, text->text + text->selection_start); - g_free(text->text); - text->text = temp; - text->selection_start += value; - text->selection_end = text->selection_start; - } -} - -static void -e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data) -{ - EText *text = E_TEXT(data); - int sel_start, sel_end; - switch (command->action) { - case E_TEP_MOVE: - text->selection_start = _get_position(text, command); - text->selection_end = text->selection_start; - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_SELECT: - text->selection_end = _get_position(text, command); - sel_start = MIN(text->selection_start, text->selection_end); - sel_end = MAX(text->selection_start, text->selection_end); - if (sel_start != sel_end) { - e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY, text->text + sel_start, sel_end - sel_start); - } else if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_DELETE: - if (text->selection_end == text->selection_start) { - text->selection_end = _get_position(text, command); - } - _delete_selection(text); - split_into_lines (text); - recalc_bounds (text); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - - case E_TEP_INSERT: - if (text->selection_end != text->selection_start) { - _delete_selection(text); - } - _insert(text, command->string, command->value); - split_into_lines (text); - recalc_bounds (text); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_COPY: - sel_start = MIN(text->selection_start, text->selection_end); - sel_end = MAX(text->selection_start, text->selection_end); - if (sel_start != sel_end) { - e_text_supply_selection (text, command->time, clipboard_atom, text->text + sel_start, sel_end - sel_start); - } - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_PASTE: - e_text_get_selection (text, clipboard_atom, command->time); - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_GET_SELECTION: - e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time); - break; - case E_TEP_ACTIVATE: - if (text->timer) { - g_timer_reset(text->timer); - } - break; - case E_TEP_SET_SELECT_BY_WORD: - text->select_by_word = command->value; - break; - case E_TEP_GRAB: - gnome_canvas_item_grab (GNOME_CANVAS_ITEM(text), - GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, - text->i_cursor, - command->time); - break; - case E_TEP_UNGRAB: - gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time); - break; - case E_TEP_NOP: - break; - } - - if (!text->button_down) { - int x; - int i; - struct line *lines = text->lines; - for (lines = text->lines, i = 0; i < text->num_lines ; i++, lines ++) { - if (lines->text - text->text > text->selection_end) { - break; - } - } - lines --; - x = gdk_text_width(text->font, - lines->text, - text->selection_end - (lines->text - text->text)); - - - if (x < text->xofs_edit) { - text->xofs_edit = x; - } - - if (2 + x - text->clip_width > text->xofs_edit) { - text->xofs_edit = 2 + x - text->clip_width; - } - } - - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); -} - -static void _invisible_destroy (GtkInvisible *invisible, - EText *text) -{ - text->invisible = NULL; -} - -static GtkWidget *e_text_get_invisible(EText *text) -{ - GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - gtk_signal_connect (GTK_OBJECT(invisible), "selection_get", - GTK_SIGNAL_FUNC (_selection_get), - text); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event", - GTK_SIGNAL_FUNC (_selection_clear_event), - text); - gtk_signal_connect (GTK_OBJECT(invisible), "selection_received", - GTK_SIGNAL_FUNC (_selection_received), - text); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } - return invisible; -} - -static void -_selection_clear_event (GtkInvisible *invisible, - GdkEventSelection *event, - EText *text) -{ - if (event->selection == GDK_SELECTION_PRIMARY) { - g_free (text->primary_selection); - text->primary_selection = NULL; - text->primary_length = 0; - - text->has_selection = FALSE; - gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); - - } else if (event->selection == clipboard_atom) { - g_free (text->clipboard_selection); - text->clipboard_selection = NULL; - text->clipboard_length = 0; - } -} - -static void -_selection_get (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint info, - guint time_stamp, - EText *text) -{ - switch (info) { - case E_SELECTION_PRIMARY: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, text->primary_selection, text->primary_length); - break; - case E_SELECTION_CLIPBOARD: - gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING, - 8, text->clipboard_selection, text->clipboard_length); - break; - } -} - -static void -_selection_received (GtkInvisible *invisible, - GtkSelectionData *selection_data, - guint time, - EText *text) -{ - if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - return; - } else { - ETextEventProcessorCommand command; - command.action = E_TEP_INSERT; - command.position = E_TEP_SELECTION; - command.string = selection_data->data; - command.value = selection_data->length; - command.time = time; - e_text_command(text->tep, &command, text); - } -} - -static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length) -{ - gboolean successful; - GtkWidget *invisible; - - invisible = e_text_get_invisible(text); - - if (selection == GDK_SELECTION_PRIMARY ) { - if (text->primary_selection) { - g_free (text->primary_selection); - } - text->primary_selection = g_strndup(data, length); - text->primary_length = length; - } else if (selection == clipboard_atom) { - if (text->clipboard_selection) { - g_free (text->clipboard_selection); - } - text->clipboard_selection = g_strndup(data, length); - text->clipboard_length = length; - } - - successful = gtk_selection_owner_set (invisible, - selection, - time); - - if (selection == GDK_SELECTION_PRIMARY) - text->has_selection = successful; -} - -static void -e_text_get_selection(EText *text, GdkAtom selection, guint32 time) -{ - GtkWidget *invisible; - invisible = e_text_get_invisible(text); - gtk_selection_convert(invisible, - selection, - GDK_SELECTION_TYPE_STRING, - time); -} - -#if 0 -static void -e_text_real_copy_clipboard (EText *text) -{ - guint32 time; - gint selection_start_pos; - gint selection_end_pos; - - g_return_if_fail (text != NULL); - g_return_if_fail (E_IS_TEXT (text)); - - time = gtk_text_get_event_time (text); - selection_start_pos = MIN (text->selection_start, text->selection_end); - selection_end_pos = MAX (text->selection_start, text->selection_end); - - if (selection_start_pos != selection_end_pos) - { - if (gtk_selection_owner_set (GTK_WIDGET (text->canvas), - clipboard_atom, - time)) - text->clipboard_text = ""; - } -} - -static void -e_text_real_paste_clipboard (EText *text) -{ - guint32 time; - - g_return_if_fail (text != NULL); - g_return_if_fail (E_IS_TEXT (text)); - - time = e_text_get_event_time (text); - if (text->editable) - gtk_selection_convert (GTK_WIDGET(text->widget), - clipboard_atom, - gdk_atom_intern ("COMPOUND_TEXT", FALSE), time); -} -#endif - - - -/* Routines for sucking fonts from the X server */ - -static ETextSuckFont * -e_suck_font (GdkFont *font) -{ - ETextSuckFont *suckfont; - int i; - int x, y; - char text[1]; - int lbearing, rbearing, ch_width, ascent, descent; - GdkPixmap *pixmap; - GdkColor black, white; - GdkImage *image; - GdkGC *gc; - guchar *line; - int width, height; - int black_pixel, pixel; - - if (!font) - return NULL; - - suckfont = g_new (ETextSuckFont, 1); - - height = font->ascent + font->descent; - x = 0; - for (i = 0; i < 256; i++) { - text[0] = i; - gdk_text_extents (font, text, 1, - &lbearing, &rbearing, &ch_width, &ascent, &descent); - suckfont->chars[i].left_sb = lbearing; - suckfont->chars[i].right_sb = ch_width - rbearing; - suckfont->chars[i].width = rbearing - lbearing; - suckfont->chars[i].ascent = ascent; - suckfont->chars[i].descent = descent; - suckfont->chars[i].bitmap_offset = x; - x += (ch_width + 31) & -32; - } - - width = x; - - suckfont->bitmap_width = width; - suckfont->bitmap_height = height; - suckfont->ascent = font->ascent; - - pixmap = gdk_pixmap_new (NULL, suckfont->bitmap_width, - suckfont->bitmap_height, 1); - gc = gdk_gc_new (pixmap); - gdk_gc_set_font (gc, font); - - black_pixel = BlackPixel (gdk_display, DefaultScreen (gdk_display)); - black.pixel = black_pixel; - white.pixel = WhitePixel (gdk_display, DefaultScreen (gdk_display)); - gdk_gc_set_foreground (gc, &white); - gdk_draw_rectangle (pixmap, gc, 1, 0, 0, width, height); - - gdk_gc_set_foreground (gc, &black); - for (i = 0; i < 256; i++) { - text[0] = i; - gdk_draw_text (pixmap, font, gc, - suckfont->chars[i].bitmap_offset - suckfont->chars[i].left_sb, - font->ascent, - text, 1); - } - - /* The handling of the image leaves me with distinct unease. But this - * is more or less copied out of gimp/app/text_tool.c, so it _ought_ to - * work. -RLL - */ - - image = gdk_image_get (pixmap, 0, 0, width, height); - suckfont->bitmap = g_malloc0 ((width >> 3) * height); - - line = suckfont->bitmap; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - pixel = gdk_image_get_pixel (image, x, y); - if (pixel == black_pixel) - line[x >> 3] |= 128 >> (x & 7); - } - line += width >> 3; - } - - gdk_image_destroy (image); - - /* free the pixmap */ - gdk_pixmap_unref (pixmap); - - /* free the gc */ - gdk_gc_destroy (gc); - - return suckfont; -} - -static void -e_suck_font_free (ETextSuckFont *suckfont) -{ - g_free (suckfont->bitmap); - g_free (suckfont); -} diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h deleted file mode 100644 index 2f29fb189b..0000000000 --- a/widgets/text/e-text.h +++ /dev/null @@ -1,196 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* EText - Text item for evolution. - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Chris Lahey - * - * A majority of code taken from: - * - * Text item type for GnomeCanvas widget - * - * GnomeCanvas is basically a port of the Tk toolkit's most excellent - * canvas widget. Tk is copyrighted by the Regents of the University - * of California, Sun Microsystems, and other parties. - * - * Copyright (C) 1998 The Free Software Foundation - * - * Author: Federico Mena */ - -#ifndef E_TEXT_H -#define E_TEXT_H - -#include -#include "e-text-event-processor.h" - - -BEGIN_GNOME_DECLS - - -/* Text item for the canvas. Text items are positioned by an anchor point and an anchor direction. - * - * A clipping rectangle may be specified for the text. The rectangle is anchored at the text's anchor - * point, and is specified by clipping width and height parameters. If the clipping rectangle is - * enabled, it will clip the text. - * - * In addition, x and y offset values may be specified. These specify an offset from the anchor - * position. If used in conjunction with the clipping rectangle, these could be used to implement - * simple scrolling of the text within the clipping rectangle. - * - * The following object arguments are available: - * - * name type read/write description - * ------------------------------------------------------------------------------------------ - * text string RW The string of the text label - * x double RW X coordinate of anchor point - * y double RW Y coordinate of anchor point - * font string W X logical font descriptor - * fontset string W X logical fontset descriptor - * font_gdk GdkFont* RW Pointer to a GdkFont - * anchor GtkAnchorType RW Anchor side for the text - * justification GtkJustification RW Justification for multiline text - * fill_color string W X color specification for text - * fill_color_gdk GdkColor* RW Pointer to an allocated GdkColor - * fill_stipple GdkBitmap* RW Stipple pattern for filling the text - * clip_width double RW Width of clip rectangle - * clip_height double RW Height of clip rectangle - * clip boolean RW Use clipping rectangle? - * x_offset double RW Horizontal offset distance from anchor position - * y_offset double RW Vertical offset distance from anchor position - * text_width double R Used to query the width of the rendered text - * text_height double R Used to query the rendered height of the text - * - * These are currently ignored in the AA version: - * editable boolean RW Can this item be edited - * use_ellipsis boolean RW Whether to use ellipsises if text gets cut off. Meaningless if clip == false. - * ellipsis string RW The characters to use as ellipsis. NULL = "...". - * line_wrap boolean RW Line wrap when not editing. - * max_line_wrap int RW Number of lines possible when doing line wrap. - */ - -#define E_TYPE_TEXT (e_text_get_type ()) -#define E_TEXT(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT, EText)) -#define E_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass)) -#define E_IS_TEXT(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT)) -#define E_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT)) - - -typedef struct _EText EText; -typedef struct _ETextClass ETextClass; -typedef struct _ETextSuckFont ETextSuckFont; -typedef struct _ETextSuckChar ETextSuckChar; - -struct _ETextSuckChar { - int left_sb; - int right_sb; - int width; - int ascent; - int descent; - int bitmap_offset; /* in pixels */ -}; - -struct _ETextSuckFont { - guchar *bitmap; - gint bitmap_width; - gint bitmap_height; - gint ascent; - ETextSuckChar chars[256]; -}; - -struct _EText { - GnomeCanvasItem item; - - char *text; /* Text to display */ - gpointer lines; /* Text split into lines (private field) */ - int num_lines; /* Number of lines of text */ - - double x, y; /* Position at anchor */ - GdkFont *font; /* Font for text */ - GtkAnchorType anchor; /* Anchor side for text */ - GtkJustification justification; /* Justification for text */ - - double clip_width; /* Width of optional clip rectangle */ - double clip_height; /* Height of optional clip rectangle */ - - double xofs, yofs; /* Text offset distance from anchor position */ - - gulong pixel; /* Fill color */ - GdkBitmap *stipple; /* Stipple for text */ - GdkGC *gc; /* GC for drawing text */ - - int cx, cy; /* Top-left canvas coordinates for text */ - int clip_cx, clip_cy; /* Top-left canvas coordinates for clip rectangle */ - int clip_cwidth, clip_cheight; /* Size of clip rectangle in pixels */ - int max_width; /* Maximum width of text lines */ - int height; /* Rendered text height in pixels */ - - guint clip : 1; /* Use clip rectangle? */ - - /* Antialiased specific stuff follows */ - ETextSuckFont *suckfont; /* Sucked font */ - guint32 rgba; /* RGBA color for text */ - double affine[6]; /* The item -> canvas affine */ - - char *ellipsis; /* The ellipsis characters. NULL = "...". */ - double ellipsis_width; /* The width of the ellipsis. */ - gboolean use_ellipsis; /* Whether to use the ellipsis. */ - - gboolean editable; /* Item is editable */ - gboolean editing; /* Item is currently being edited */ - - int xofs_edit; /* Offset because of editing */ - - /* This needs to be reworked a bit once we get line wrapping. */ - int selection_start; /* Start of selection */ - int selection_end; /* End of selection */ - gboolean select_by_word; /* Current selection is by word */ - - /* This section is for drag scrolling and blinking cursor. */ - gint timeout_id; /* Current timeout id for scrolling */ - GTimer *timer; /* Timer for blinking cursor and scrolling */ - - gint lastx, lasty; /* Last x and y motion events */ - gint last_state; /* Last state */ - gulong scroll_start; /* Starting time for scroll (microseconds) */ - - gint show_cursor; /* Is cursor currently shown */ - gboolean button_down; /* Is mouse button 1 down */ - - ETextEventProcessor *tep; /* Text Event Processor */ - - GtkWidget *invisible; /* For selection handling */ - gboolean has_selection; /* TRUE if we have the selection */ - gchar *primary_selection; /* Primary selection text */ - gint primary_length; /* Primary selection text length */ - gchar *clipboard_selection; /* Clipboard selection text */ - gint clipboard_length; /* Clipboard selection text length*/ - - guint pointer_in : 1; /* Is the pointer currently over us? */ - guint default_cursor_shown : 1; /* Is the default cursor currently shown? */ - - guint line_wrap : 1; /* Do line wrap */ - - gint max_lines; /* Max number of lines (-1 = infinite) */ - - GdkCursor *default_cursor; /* Default cursor (arrow) */ - GdkCursor *i_cursor; /* I beam cursor */ - - gint tooltip_timeout; /* Timeout for the tooltip */ - GtkWidget *tooltip_window; /* GtkWindow for displaying the tooltip */ - gint tooltip_count; /* GDK_ENTER_NOTIFY count. */ -}; - -struct _ETextClass { - GnomeCanvasItemClass parent_class; - - void (* resize) (EText *text); - void (* change) (EText *text); -}; - - -/* Standard Gtk function */ -GtkType e_text_get_type (void); - - -END_GNOME_DECLS - -#endif -- cgit v1.2.3